Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
api.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <map>
8 #include <Strings/components/diagnostics/errors/errors.h>
9 #include <sdl2/SDL_keycode.h>
10 
11 #ifdef BLAM_EXPORTS
12 #define BLAM_EXT_API __declspec(dllexport)
13 #else
14 #define BLAM_EXT_API __declspec(dllimport)
15 #endif
16 
17 typedef union SDL_Event;
18 struct SDL_Window;
19 class BlamTagClass;
20 class BlamConsoleCommand;
21 
25 namespace Blam::API::v1
26 {
27  namespace Project
28  {
30  }
31 
32  namespace Input
33  {
34  BLAM_EXT_API bool IsKeyDown(SDL_KeyCode keycode);
35  BLAM_EXT_API void SetMouseCaptured(bool captured);
36  }
37 
41  namespace Console
42  {
50  BLAM_EXT_API std::string RegisterCommand(BlamConsoleCommand* command);
51 
64  BLAM_EXT_API bool UnregisterCommand(std::string name);
65 
75 
81  BLAM_EXT_API std::vector<std::string> GetKnownCommands();
82  }
83 
87  namespace Globals
88  {
97  BLAM_EXT_API std::map<std::string, BlamEngineGlobal>* GetGlobalsList();
98 
107 
115  BLAM_EXT_API bool GlobalExists(std::string id);
116 
123 
131  BLAM_EXT_API void RegisterGlobal(std::string name, std::string value_raw, BlamGlobalType type);
132 
141  BLAM_EXT_API void RegisterGlobal(std::string name, std::string value_raw, BlamGlobalType type, std::string info);
142 
150  BLAM_EXT_API BlamEngineGlobal* GetGlobal(std::string name);
151 
160  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, std::string new_value);
161 
170  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, bool new_value);
171 
180  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, int new_value);
181 
190  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, short new_value);
191 
200  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, long new_value);
201 
210  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, float new_value);
211 
220  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, BlamColor new_value);
221 
229  BLAM_EXT_API bool* GetGlobalAsBoolean(std::string name);
230 
238  BLAM_EXT_API std::string* GetGlobalAsString(std::string name);
239 
247  BLAM_EXT_API short* GetGlobalAsShort(std::string name);
248 
256  BLAM_EXT_API long* GetGlobalAsLong(std::string name);
257 
265  BLAM_EXT_API int* GetGlobalAsInteger(std::string name);
266 
274  BLAM_EXT_API float* GetGlobalAsFloat(std::string name);
275 
283  BLAM_EXT_API BlamColor* GetGlobalAsColor(std::string name);
284  }
285 
289  namespace Logger
290  {
298  BLAM_EXT_API void LogEvent(std::string message);
299  }
300 
304  namespace Tags
305  {
313  BLAM_EXT_API BlamResult LoadScenarioTag(std::string path);
314 
322  BLAM_EXT_API BlamTagClass* GetTagClass(std::string class_name);
323 
339  BLAM_EXT_API BlamResult LoadTagFromMemory(char* address, int size, const char* tag_path);
340 
351  BLAM_EXT_API BlamTagData* GetTagData(std::string tag_path);
352 
359  }
360 
361  namespace World
362  {
369 
374 
379 
383  BLAM_EXT_API std::vector<BlamWorldObject*> Raycast();
384 
394  BLAM_EXT_API void MarkWorldStateForDestroy(bool wait_for_destroy = false);
395  }
396 
402  namespace HS
403  {
404  void Abort(std::string confirm = "");
405  void Classify(std::string command);
406  void Cls();
407  void Crash(std::string confirm);
408  void CreateCmdObj();
409  void DebugMenuRebuild();
410  void Drop(std::string tag_name);
411  void DxRenderTargetClear(bool enable);
412  void Explore(std::string mode, std::string path);
413  void GeneratePlugins();
414  void H2Help(std::string command);
415  void H2Print(std::string message);
416  void Help();
417  void History();
418  void ListColors();
419  void ListLevels();
420  void ListenerBugCheck();
421  void MapName(std::string scenario_name);
422  void NoU();
423  void OpenGameDir();
424  void OpenWebURL(std::string url);
425  void Print(std::string message);
426  void Quit();
428  void ScreenRes(std::string resolution);
429  void Screenshot(std::string filename = "");
430  void ScriptDoc(bool quiet = false);
431  void SentryTest();
432  void ShowStats();
433  void TagFieldSizes();
434  void TagLoadForce(std::string tag_path);
435  void ToggleImguiWindow(std::string window_name);
436  void Version();
437  void Win32DialogTest();
438  }
439 
446  namespace Hooking
447  {
458 
466  BLAM_EXT_API void SetEngineHookState(bool hook_state);
467 
482 
490  BLAM_EXT_API int StartEngine(int args_count, char* args[], SDL_Window* window);
491 
495  BLAM_EXT_API void MainLoop();
496 
503 
508  }
509 
515  BLAM_EXT_API void ExecuteConsoleCommand(const char* command);
516 
523  BLAM_EXT_API void ResizeViewport(int width, int height);
524 
530  BLAM_EXT_API BlamVector3 GetDirectorPosition();
531 
537  BLAM_EXT_API BlamVector3 GetDirectorRotation();
538 
545 
551  BLAM_EXT_API void SetDirectorPosition(BlamVector3 position);
552 
558  BLAM_EXT_API void SetDirectorRotation(BlamVector3 rotation);
559 
565  BLAM_EXT_API void SetDirectorSpeed(float speed);
566 
572  BLAM_EXT_API BlamVector2 GetMousePosition2D();
573 
579  BLAM_EXT_API BlamVector3 GetMousePosition3D();
580 
587  BLAM_EXT_API void SetEngineViewportActive(bool viewport_active);
588 
595 
601  BLAM_EXT_API BlamVector2 GetGameResolution();
602 }
Blam::API::v1::Tags::RegisterTagClass
BLAM_EXT_API void RegisterTagClass(BlamTagClass *data)
Registers a new tag class within the engine.
Definition: api.cpp:213
Blam::API::v1::HS::MapName
void MapName(std::string scenario_name)
Definition: hs.cpp:99
Blam::API::v1::GetGameResolution
BLAM_EXT_API BlamVector2 GetGameResolution()
Retrieves the current render resolution for the engine.
Definition: api.cpp:366
Blam::API::v1::HS::Classify
void Classify(std::string command)
Definition: hs.cpp:19
Blam::API::v1::Hooking::EngineThreadInit
BLAM_EXT_API int EngineThreadInit()
Performs any additional engine initialization that needs to be called within the engine loop thread.
Definition: hooking.cpp:34
window_name
const wchar_t * window_name
Main window name (replaces what used to be called 'ver_conv').
Definition: main.cpp:64
Blam::API::v1::HS::Win32DialogTest
void Win32DialogTest()
Definition: hs.cpp:179
Blam::API::v1::HS::ToggleImguiWindow
void ToggleImguiWindow(std::string window_name)
Definition: hs.cpp:169
Blam::API::v1::SetDirectorPosition
BLAM_EXT_API void SetDirectorPosition(BlamVector3 position)
Sets the current position of the debug director.
Definition: api.cpp:302
Blam::API::v1::World::Raycast
BLAM_EXT_API std::vector< BlamWorldObject * > Raycast()
Definition: api.cpp:233
Blam::API::v1::HS::Cls
void Cls()
Definition: hs.cpp:24
Blam::API::v1::HS::H2Print
void H2Print(std::string message)
Definition: hs.cpp:69
Blam::API::v1::GetMousePosition3D
BLAM_EXT_API BlamVector3 GetMousePosition3D()
Retrieves the 3D position of the mouse pointer.
Definition: api.cpp:339
Blam::API::v1::HS::NoU
void NoU()
Definition: hs.cpp:104
Blam::API::v1::HS::Drop
void Drop(std::string tag_name)
Definition: hs.cpp:44
Blam::API::v1::GetDirectorPosition
BLAM_EXT_API BlamVector3 GetDirectorPosition()
Retrieves the current position of the debug director.
Definition: api.cpp:268
Blam::API::v1::Tags::LoadScenarioTag
BLAM_EXT_API BlamResult LoadScenarioTag(std::string path)
Attempts to load a scenario tag from a given tag path.
Definition: api.cpp:193
world_objects.h
Blam::API::v1::Input::IsKeyDown
BLAM_EXT_API bool IsKeyDown(SDL_KeyCode keycode)
Definition: api.cpp:22
Blam::API::v1::HS::OpenGameDir
void OpenGameDir()
Definition: hs.cpp:109
Blam::API::v1::World::InitializeWorldState
BLAM_EXT_API void InitializeWorldState()
Initializes a new world state.
Definition: api.cpp:223
Blam::API::v1::IsMouseCapturedByDirector
BLAM_EXT_API bool IsMouseCapturedByDirector()
Checks if the mouse is currently captured by the debug director.
Definition: api.cpp:356
Blam::API::v1::Globals::GetGlobalAsFloat
BLAM_EXT_API float * GetGlobalAsFloat(std::string name)
Retrieves a global's value as a float.
Definition: api.cpp:178
Blam::API::v1::Console::GetKnownCommands
BLAM_EXT_API std::vector< std::string > GetKnownCommands()
Retrieves a list of known console commands.
Definition: api.cpp:68
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:33
Blam::API::v1::HS::SentryTest
void SentryTest()
Definition: hs.cpp:149
BlamVersionStringDisplayMode::Console
@ Console
Indicates the build string should be formatted for the in-game console.
Blam::API::v1::Globals::RegisterGlobal
BLAM_EXT_API void RegisterGlobal(BlamEngineGlobal var)
Registers a new engine global.
Definition: api.cpp:98
Blam::API::v1::HS::Quit
void Quit()
Definition: hs.cpp:124
Blam::API::v1::SetDirectorRotation
BLAM_EXT_API void SetDirectorRotation(BlamVector3 rotation)
Sets the current rotation of the debug director.
Definition: api.cpp:310
Blam::API::v1::Hooking::CleanupEngineResources
BLAM_EXT_API void CleanupEngineResources()
Instructs the engine to clean up any resources.
Definition: hooking.cpp:39
project_info.h
Blam::API::v1::HS::GeneratePlugins
void GeneratePlugins()
Definition: hs.cpp:59
Blam::API::v1::HS::Crash
void Crash(std::string confirm)
Definition: hs.cpp:29
Blam::API::v1::HS::ListLevels
void ListLevels()
Definition: hs.cpp:89
Blam::API::v1::Globals::GetGlobalAsInteger
BLAM_EXT_API int * GetGlobalAsInteger(std::string name)
Retrieves a global's value as an int.
Definition: api.cpp:173
Blam::API::v1::Hooking::MainLoop
BLAM_EXT_API void MainLoop()
Function for the engine's main loop.
Definition: hooking.cpp:29
Blam::API::v1::HS::ScreenRes
void ScreenRes(std::string resolution)
Definition: hs.cpp:134
Blam::API::v1::Input::SetMouseCaptured
BLAM_EXT_API void SetMouseCaptured(bool captured)
Definition: api.cpp:27
Blam::API::v1::SetDirectorSpeed
BLAM_EXT_API void SetDirectorSpeed(float speed)
Sets the current speed of the debug director.
Definition: api.cpp:318
Blam::API::v1::Globals::GetGlobalAsShort
BLAM_EXT_API short * GetGlobalAsShort(std::string name)
Retrieves a global's value as a short.
Definition: api.cpp:163
Blam::API::v1::Hooking::MainWindowProcedure
BLAM_EXT_API bool MainWindowProcedure(SDL_Event event)
Window Procedure for the main application window.
Definition: hooking.cpp:19
Blam::API::v1::Console::GetCommandInfo
BLAM_EXT_API BlamConsoleCommand GetCommandInfo(std::string name)
Retrieves a command with the specified name.
Definition: api.cpp:56
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:208
BlamGlobalUpdateResult
BlamGlobalUpdateResult
Enumerator for the result of a global update attempt.
Definition: globals.h:9
Blam::API::v1::Globals::GetGlobalAsColor
BLAM_EXT_API BlamColor * GetGlobalAsColor(std::string name)
Retrieves a global's value as a BlamColor.
Definition: api.cpp:183
Blam::API::v1::HS::TagFieldSizes
void TagFieldSizes()
Definition: hs.cpp:159
Blam::API::v1::World::MarkWorldStateForDestroy
BLAM_EXT_API void MarkWorldStateForDestroy(bool wait_for_destroy=false)
Marks the current world state to be destroyed before rendering the next frame.
Definition: api.cpp:238
BlamTransformSpace::World
@ World
BlamContentSource::Tags
@ Tags
The engine will load all content from tags.
Blam::API::v1::Globals::GetGlobalAsBoolean
BLAM_EXT_API bool * GetGlobalAsBoolean(std::string name)
Retrieves a global's value as a boolean.
Definition: api.cpp:153
Blam::API::v1::GetDirectorSpeed
BLAM_EXT_API float GetDirectorSpeed()
Retrieves the current speed of the debug director.
Definition: api.cpp:290
Blam::API::v1::HS::ListColors
void ListColors()
Definition: hs.cpp:84
Blam::API::v1::Globals::GetGlobal
BLAM_EXT_API BlamEngineGlobal * GetGlobal(std::string name)
Retrieves a global with the specified ID.
Definition: api.cpp:113
Blam::API::v1::GetMousePosition2D
BLAM_EXT_API BlamVector2 GetMousePosition2D()
Retrieves the 2D position of the mouse pointer.
Definition: api.cpp:326
BlamGlobalType
BlamGlobalType
Enumerator for the type of global variable.
Definition: globals.h:22
Blam::API::v1::HS::DebugMenuRebuild
void DebugMenuRebuild()
Definition: hs.cpp:39
Blam::API::v1::GetDirectorRotation
BLAM_EXT_API BlamVector3 GetDirectorRotation()
Retrieves the current rotation of the debug director.
Definition: api.cpp:280
BlamEngineGlobal
Structure containing data for a game engine global.
Definition: globals.h:44
Blam::API::v1::Globals::GetGlobalAsLong
BLAM_EXT_API long * GetGlobalAsLong(std::string name)
Retrieves a global's value as a long.
Definition: api.cpp:168
Blam::API::v1::HS::ScriptDoc
void ScriptDoc(bool quiet=false)
Definition: hs.cpp:144
Blam::API::v1::HS::Version
void Version()
Definition: hs.cpp:174
Blam::API::v1::HS::Explore
void Explore(std::string mode, std::string path)
Definition: hs.cpp:54
Blam::API::v1
Namespace for version 1 of the Blamite Game Engine API.
Definition: api.h:25
Blam::API::v1::World::GetWorldState
BLAM_EXT_API BlamWorldState * GetWorldState()
Retrieves the current world state.
Definition: api.cpp:218
BlamProjectInfo
Definition: project_info.h:5
Blam::API::v1::HS::Abort
void Abort(std::string confirm="")
Definition: hs.cpp:5
Blam::API::v1::Hooking::StartEngine
BLAM_EXT_API int StartEngine(int args_count, char *args[], SDL_Window *window)
Entry point for the engine.
Definition: hooking.cpp:24
Blam::API::v1::Tags::GetTagClass
BLAM_EXT_API BlamTagClass * GetTagClass(std::string class_name)
Retrieves a tag class from either its short or long class name.
Definition: api.cpp:198
Blam::API::v1::SetEngineViewportActive
BLAM_EXT_API void SetEngineViewportActive(bool viewport_active)
API wrapper around ImGui_ImplSDL2_SetActiveWindowOverride.
Definition: api.cpp:351
Blam::API::v1::Project::SetCurrentProjectInfo
BLAM_EXT_API void SetCurrentProjectInfo(BlamProjectInfo project_info)
Definition: api.cpp:17
Blam::API::v1::Hooking::GetEngineHookState
BLAM_EXT_API bool GetEngineHookState()
Retrieves the engine's hook state.
Definition: hooking.cpp:14
Blam::API::v1::Console::RegisterCommand
BLAM_EXT_API std::string RegisterCommand(BlamConsoleCommand *command)
Register a new command object.
Definition: api.cpp:32
Blam::API::v1::HS::H2Help
void H2Help(std::string command)
Definition: hs.cpp:64
Blam::API::v1::Globals::GetGlobalAsString
BLAM_EXT_API std::string * GetGlobalAsString(std::string name)
Retrieves a global's value as a string.
Definition: api.cpp:158
Blam::API::v1::ExecuteConsoleCommand
BLAM_EXT_API void ExecuteConsoleCommand(const char *command)
Runs a command through the engine's console.
Definition: api.cpp:251
Blam::API::v1::HS::OpenWebURL
void OpenWebURL(std::string url)
Definition: hs.cpp:114
Blam::API::v1::HS::Help
void Help()
Definition: hs.cpp:74
Blam::API::v1::HS::CreateCmdObj
void CreateCmdObj()
Definition: hs.cpp:34
Blam::API::v1::Logger::LogEvent
BLAM_EXT_API void LogEvent(std::string message)
Writes a message to the game engine log.
Definition: api.cpp:188
Blam::API::v1::HS::ReloadMaterialDatablocks
void ReloadMaterialDatablocks()
Definition: hs.cpp:129
Blam::API::v1::Globals::UpdateGlobal
BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, std::string new_value)
Updates the value of a String global.
Definition: api.cpp:118
Blam::API::v1::HS::ShowStats
void ShowStats()
Definition: hs.cpp:154
BLAM_EXT_API
#define BLAM_EXT_API
Definition: api.h:14
Blam::API::v1::Console::UnregisterCommand
BLAM_EXT_API bool UnregisterCommand(std::string name)
Unregisters the console command with the specified name.
Definition: api.cpp:38
Blam::API::v1::HS::TagLoadForce
void TagLoadForce(std::string tag_path)
Definition: hs.cpp:164
Blam::API::v1::Tags::LoadTagFromMemory
BLAM_EXT_API BlamResult LoadTagFromMemory(char *address, int size, const char *tag_path)
Loads a tag from a block of memory.
Definition: api.cpp:203
Blam::API::v1::ResizeViewport
BLAM_EXT_API void ResizeViewport(int width, int height)
Resizes the engine's viewport resolution.
Definition: api.cpp:256
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
Blam::API::v1::Globals::GetGlobalTypeLabel
BLAM_EXT_API std::string GetGlobalTypeLabel(BlamGlobalType type)
Retrieves a string representation of a global's type, for use in UI.
Definition: api.cpp:88
Blam::API::v1::Globals::GlobalExists
BLAM_EXT_API bool GlobalExists(std::string id)
Determines whether or not a global exists.
Definition: api.cpp:93
SDL_Event
Definition: SdlEmulationLayer.h:735
Blam::API::v1::HS::Print
void Print(std::string message)
Definition: hs.cpp:119
Blam::API::v1::Hooking::SetEngineHookState
BLAM_EXT_API void SetEngineHookState(bool hook_state)
Sets whether or not the engine is hooked via Qt.
Definition: hooking.cpp:9
Blam::API::v1::HS::Screenshot
void Screenshot(std::string filename="")
Definition: hs.cpp:139
Blam::API::v1::HS::ListenerBugCheck
void ListenerBugCheck()
Definition: hs.cpp:94
Blam::API::v1::HS::History
void History()
Definition: hs.cpp:79
globals.h
BlamWorldState
Class representing a world state.
Definition: world_objects.h:715
BlamTagClass
Class representing a tag class.
Definition: tags.h:202
Blam::API::v1::HS::DxRenderTargetClear
void DxRenderTargetClear(bool enable)
Definition: hs.cpp:49
Blam::API::v1::Globals::GetGlobalsList
BLAM_EXT_API std::map< std::string, BlamEngineGlobal > * GetGlobalsList()
Retrieves the list of loaded globals.
Definition: api.cpp:83
Blam::API::v1::World::DestroyWorldState
BLAM_EXT_API void DestroyWorldState()
Destroys the current world state.
Definition: api.cpp:228