Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.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>
7 #include <Strings/components/resources/project_info/project_info.h>
8 #include <Strings/components/diagnostics/errors/errors.h>
9 
10 #ifdef BLAM_EXPORTS
11 #define BLAM_EXT_API __declspec(dllexport)
12 #else
13 #define BLAM_EXT_API __declspec(dllimport)
14 #endif
15 
16 typedef union SDL_Event;
17 struct SDL_Window;
18 class BlamTagClass;
19 class BlamConsoleCommand;
20 
24 namespace Blam::API::v1
25 {
26  namespace Project
27  {
28  BLAM_EXT_API void SetCurrentProjectInfo(BlamProjectInfo project_info);
29  }
30 
34  namespace Console
35  {
43  BLAM_EXT_API std::string RegisterCommand(BlamConsoleCommand* command);
44 
57  BLAM_EXT_API bool UnregisterCommand(std::string name);
58 
68 
74  BLAM_EXT_API std::vector<std::string> GetKnownCommands();
75  }
76 
80  namespace Globals
81  {
90  BLAM_EXT_API std::map<std::string, BlamEngineGlobal>* GetGlobalsList();
91 
100 
108  BLAM_EXT_API bool GlobalExists(std::string id);
109 
116 
124  BLAM_EXT_API void RegisterGlobal(std::string name, std::string value_raw, BlamGlobalType type);
125 
134  BLAM_EXT_API void RegisterGlobal(std::string name, std::string value_raw, BlamGlobalType type, std::string info);
135 
143  BLAM_EXT_API BlamEngineGlobal* GetGlobal(std::string name);
144 
153  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, std::string new_value);
154 
163  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, bool new_value);
164 
173  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, int new_value);
174 
183  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, short new_value);
184 
193  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, long new_value);
194 
203  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, float new_value);
204 
213  BLAM_EXT_API BlamGlobalUpdateResult UpdateGlobal(std::string name, BlamColor new_value);
214 
222  BLAM_EXT_API bool* GetGlobalAsBoolean(std::string name);
223 
231  BLAM_EXT_API std::string* GetGlobalAsString(std::string name);
232 
240  BLAM_EXT_API short* GetGlobalAsShort(std::string name);
241 
249  BLAM_EXT_API long* GetGlobalAsLong(std::string name);
250 
258  BLAM_EXT_API int* GetGlobalAsInteger(std::string name);
259 
267  BLAM_EXT_API float* GetGlobalAsFloat(std::string name);
268 
276  BLAM_EXT_API BlamColor* GetGlobalAsColor(std::string name);
277  }
278 
282  namespace Logger
283  {
291  BLAM_EXT_API void LogEvent(std::string message);
292  }
293 
297  namespace Tags
298  {
304  BLAM_EXT_API void LoadScenarioTag(std::string path);
305 
313  BLAM_EXT_API BlamTagClass* GetTagClass(std::string class_name);
314 
330  BLAM_EXT_API BlamResult LoadTagFromMemory(char* address, int size, const char* tag_path);
331 
342  BLAM_EXT_API BlamTagData* GetTagData(std::string tag_path);
343 
350  }
351 
352  namespace World
353  {
360 
364  BLAM_EXT_API std::vector<BlamWorldObject*> Raycast();
365  }
366 
372  namespace HS
373  {
374  void Abort(std::string confirm = "");
375  void Classify(std::string command);
376  void Cls();
377  void Crash(std::string confirm);
378  void CreateCmdObj();
379  void DebugMenuRebuild();
380  void Drop(std::string tag_name);
381  void DxRenderTargetClear(bool enable);
382  void Explore(std::string mode, std::string path);
383  void GeneratePlugins();
384  void H2Help(std::string command);
385  void H2Print(std::string message);
386  void Help();
387  void History();
388  void ListColors();
389  void ListLevels();
390  void ListenerBugCheck();
391  void MapName(std::string scenario_name);
392  void NoU();
393  void OpenGameDir();
394  void OpenWebURL(std::string url);
395  void Print(std::string message);
396  void Quit();
398  void ScreenRes(std::string resolution);
399  void Screenshot(std::string filename = "");
400  void ScriptDoc(bool quiet = false);
401  void SentryTest();
402  void ShowStats();
403  void TagFieldSizes();
404  void TagLoadForce(std::string tag_path);
405  void ToggleImguiWindow(std::string window_name);
406  void Version();
407  void Win32DialogTest();
408  }
409 
416  namespace Hooking
417  {
428 
436  BLAM_EXT_API void SetEngineHookState(bool hook_state);
437 
452 
460  BLAM_EXT_API int StartEngine(int args_count, char* args[], SDL_Window* window);
461 
465  BLAM_EXT_API void MainLoop();
466 
473 
478  }
479 
485  BLAM_EXT_API void ExecuteConsoleCommand(const char* command);
486 
493  BLAM_EXT_API void ResizeViewport(int width, int height);
494 
500  BLAM_EXT_API BlamVector3 GetDirectorPosition();
501 
508 
514  BLAM_EXT_API BlamVector2 GetMousePosition2D();
515 
521  BLAM_EXT_API BlamVector3 GetMousePosition3D();
522 
529  BLAM_EXT_API void SetEngineViewportActive(bool viewport_active);
530 
537 
543  BLAM_EXT_API BlamVector2 GetGameResolution();
544 }
Blam::API::v1::Tags::RegisterTagClass
BLAM_EXT_API void RegisterTagClass(BlamTagClass *data)
Registers a new tag class within the engine.
Definition: api.cpp:202
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:284
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::World::Raycast
BLAM_EXT_API std::vector< BlamWorldObject * > Raycast()
Definition: api.cpp:212
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:264
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:227
world_objects.h
Blam::API::v1::HS::OpenGameDir
void OpenGameDir()
Definition: hs.cpp:109
Blam::API::v1::IsMouseCapturedByDirector
BLAM_EXT_API bool IsMouseCapturedByDirector()
Checks if the mouse is currently captured by the debug director.
Definition: api.cpp:274
Blam::API::v1::Globals::GetGlobalAsFloat
BLAM_EXT_API float * GetGlobalAsFloat(std::string name)
Retrieves a global's value as a float.
Definition: api.cpp:167
Blam::API::v1::Console::GetKnownCommands
BLAM_EXT_API std::vector< std::string > GetKnownCommands()
Retrieves a list of known console commands.
Definition: api.cpp:57
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:87
Blam::API::v1::HS::Quit
void Quit()
Definition: hs.cpp:124
Blam::API::v1::Hooking::CleanupEngineResources
BLAM_EXT_API void CleanupEngineResources()
Instructs the engine to clean up any resources.
Definition: hooking.cpp:39
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:162
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::Globals::GetGlobalAsShort
BLAM_EXT_API short * GetGlobalAsShort(std::string name)
Retrieves a global's value as a short.
Definition: api.cpp:152
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:45
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:197
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:172
Blam::API::v1::HS::TagFieldSizes
void TagFieldSizes()
Definition: hs.cpp:159
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:142
Blam::API::v1::GetDirectorSpeed
BLAM_EXT_API float GetDirectorSpeed()
Retrieves the current speed of the debug director.
Definition: api.cpp:239
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:102
Blam::API::v1::GetMousePosition2D
BLAM_EXT_API BlamVector2 GetMousePosition2D()
Retrieves the 2D position of the mouse pointer.
Definition: api.cpp:251
Blam::API::v1::Tags::LoadScenarioTag
BLAM_EXT_API void LoadScenarioTag(std::string path)
Attempts to load a scenario tag from a given tag path.
Definition: api.cpp:182
BlamGlobalType
BlamGlobalType
Enumerator for the type of global variable.
Definition: globals.h:22
Blam::API::v1::HS::DebugMenuRebuild
void DebugMenuRebuild()
Definition: hs.cpp:39
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:157
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:24
Blam::API::v1::World::GetWorldState
BLAM_EXT_API BlamWorldState * GetWorldState()
Retrieves the current world state.
Definition: api.cpp:207
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:187
Blam::API::v1::SetEngineViewportActive
BLAM_EXT_API void SetEngineViewportActive(bool viewport_active)
API wrapper around ImGui_ImplSDL2_SetActiveWindowOverride.
Definition: api.cpp:269
Blam::API::v1::Project::SetCurrentProjectInfo
BLAM_EXT_API void SetCurrentProjectInfo(BlamProjectInfo project_info)
Definition: api.cpp:16
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:21
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:147
Blam::API::v1::ExecuteConsoleCommand
BLAM_EXT_API void ExecuteConsoleCommand(const char *command)
Runs a command through the engine's console.
Definition: api.cpp:217
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:177
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:107
Blam::API::v1::HS::ShowStats
void ShowStats()
Definition: hs.cpp:154
BLAM_EXT_API
#define BLAM_EXT_API
Definition: api.h:13
Blam::API::v1::Console::UnregisterCommand
BLAM_EXT_API bool UnregisterCommand(std::string name)
Unregisters the console command with the specified name.
Definition: api.cpp:27
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:192
Blam::API::v1::ResizeViewport
BLAM_EXT_API void ResizeViewport(int width, int height)
Resizes the engine's viewport resolution.
Definition: api.cpp:222
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:124
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:77
Blam::API::v1::Globals::GlobalExists
BLAM_EXT_API bool GlobalExists(std::string id)
Determines whether or not a global exists.
Definition: api.cpp:82
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:540
BlamTagClass
Class representing a tag class.
Definition: tags.h:193
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:72