Engine API Enhancements
This commit is contained in:
@ -25,6 +25,8 @@ EXTERN GameFunctionTable g_gameFunctions;
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
EXTERN SDL_Window *g_windowHandle;
|
||||
|
||||
BOOL Engine::IsDebugMode()
|
||||
{
|
||||
#if defined(__DEBUG_MODE__)
|
||||
@ -36,25 +38,28 @@ namespace ia::iae
|
||||
|
||||
VOID Engine::ResizeDisplay(IN INT32 newWidth, IN INT32 newHeight)
|
||||
{
|
||||
SDL_SetWindowSize(g_windowHandle, newWidth, newHeight);
|
||||
Renderer::OnScreenResize(newWidth, newHeight);
|
||||
g_gameFunctions.OnResize(newWidth, newHeight);
|
||||
}
|
||||
|
||||
Handle Engine::CreateImageFromFile(IN CONST String &path)
|
||||
Handle Engine::CreateImageFromFile(IN CONST String &name, IN CONST String &path, IN INT32 resizeToWidth,
|
||||
IN INT32 resizeToHeight)
|
||||
{
|
||||
const auto data = File::ReadToVector(path.c_str());
|
||||
return CreateImage(data.data(), data.size());
|
||||
const auto handle = CreateImage(name, data.data(), data.size());
|
||||
return (resizeToWidth && resizeToHeight) ? ResizeImage(handle, resizeToWidth, resizeToHeight) : handle;
|
||||
}
|
||||
|
||||
Handle Engine::CreateSoundFromFile(IN CONST String &path)
|
||||
Handle Engine::CreateSoundFromFile(IN CONST String &name, IN CONST String &path)
|
||||
{
|
||||
const auto data = File::ReadToVector(path.c_str());
|
||||
return CreateSound(data.data(), data.size());
|
||||
return CreateSound(name, data.data(), data.size());
|
||||
}
|
||||
|
||||
Handle Engine::CreateSceneFromFile(IN CONST String &path)
|
||||
RefPtr<Scene> Engine::CreateSceneFromFile(IN CONST String &path)
|
||||
{
|
||||
const auto data = File::ReadToString(path.c_str());
|
||||
return CreateScene(data);
|
||||
return Scene::Create(data);
|
||||
}
|
||||
} // namespace ia::iae
|
||||
|
||||
Reference in New Issue
Block a user