From 744123763f8143758f96f1ac8efc4389657baee4 Mon Sep 17 00:00:00 2001 From: redstrate <54911369+redstrate@users.noreply.github.com> Date: Mon, 19 Apr 2021 12:06:44 -0400 Subject: [PATCH] Begin work on converting to the new class naming scheme and the new prism namespace --- engine/core/include/app.hpp | 53 +- engine/core/include/engine.hpp | 717 +++++++++++++------------- engine/core/src/engine.cpp | 6 +- engine/gfx/vulkan/src/gfx_vulkan.cpp | 2 +- example/include/example.hpp | 2 +- extern/imgui/src/imgui_demo.cpp | 52 +- platforms/ios/ViewController.mm.in | 2 +- platforms/linux/main.cpp.in | 2 +- platforms/mac/main.mm.in | 2 +- platforms/sdl/main.cpp.in | 2 +- platforms/tvos/ViewController.mm.in | 2 +- platforms/windows/main.cpp.in | 2 +- tools/common/include/commoneditor.hpp | 2 +- tools/common/src/commoneditor.cpp | 2 +- tools/editor/src/prismeditor.cpp | 2 +- 15 files changed, 429 insertions(+), 421 deletions(-) diff --git a/engine/core/include/app.hpp b/engine/core/include/app.hpp index 9e78a26..4a718b8 100755 --- a/engine/core/include/app.hpp +++ b/engine/core/include/app.hpp @@ -1,34 +1,37 @@ #pragma once -class Engine; class GFXCommandBuffer; -/// The base class for any Prism application. -class App { -public: - /// Called when a render context is available. - virtual void initialize_render() {} +namespace prism { + class Engine; - /// Called when the engine is about to quit. Should be overriden if an app needs to save data before qutting. - virtual void prepare_quit() {} - - /// Called to check whether or not an app should intervene quitting. - virtual bool should_quit() { - return true; - } + /// The base class for any Prism application. + class app { + public: + /// Called when a render context is available. + virtual void initialize_render() {} - /// Called when a engine starts a new frame. Typically used for inserting new imgui windows. - virtual void begin_frame() {} - - /** Called during the engine's update cycle. - @param delta_time Delta time in milliseconds. - */ - virtual void update([[maybe_unused]] const float delta_time) {} + /// Called when the engine is about to quit. Should be overriden if an app needs to save data before qutting. + virtual void prepare_quit() {} - virtual void render([[maybe_unused]] GFXCommandBuffer* command_buffer) {} + /// Called to check whether or not an app should intervene quitting. + virtual bool should_quit() { + return true; + } - virtual bool wants_no_scene_rendering() { return false; } -}; + /// Called when a engine starts a new frame. Typically used for inserting new imgui windows. + virtual void begin_frame() {} -/// This is an app's equivalent main(). You can check command line arguments through Engine::comand_line_arguments. -void app_main(Engine* engine); + /** Called during the engine's update cycle. + @param delta_time Delta time in milliseconds. + */ + virtual void update([[maybe_unused]] const float delta_time) {} + + virtual void render([[maybe_unused]] GFXCommandBuffer* command_buffer) {} + + virtual bool wants_no_scene_rendering() { return false; } + }; +} + +/// This is an app's equivalent of main(). You can check command line arguments through Engine::command_line_arguments. +void app_main(prism::Engine* engine); diff --git a/engine/core/include/engine.hpp b/engine/core/include/engine.hpp index 69aba0b..ef9d66c 100755 --- a/engine/core/include/engine.hpp +++ b/engine/core/include/engine.hpp @@ -15,7 +15,6 @@ namespace ui { class Screen; } -class App; class Scene; class Input; class Renderer; @@ -24,368 +23,372 @@ class Physics; class ImGuiLayer; struct Timer; -struct AnimationTarget { - float current_time = 0.0f; - float animation_speed_modifier = 1.0f; - bool looping = false; +namespace prism { + class app; - Object target; - Animation animation; -}; + struct AnimationTarget { + float current_time = 0.0f; + float animation_speed_modifier = 1.0f; + bool looping = false; -/// An object that contains glue between App and systems such as the Renderer. -class Engine { -public: - /** - Constructs an Engine with command line arguments. Can be accessed later from command_line_arguments. - - @param argc Numer of arguments. Can be null. - @param argv Array of strings containing arguments. Can be null. - */ - Engine(const int argc, char* argv[]); - - Engine(const Engine& other) = delete; - Engine(Engine&& other) = delete; - - ~Engine(); - - /// Command line arguments, can be empty. - std::vector command_line_arguments; - - /** Sets the app object. - @param app The app object to set. Must not be null. - */ - void set_app(App* app); - - /** Gets the current app object - @return The current app object. Can be null. - */ - App* get_app() const; - - /** Call to begin the next frame. - @param delta_time Delta time in seconds. - */ - void begin_frame(const float delta_time); - - /** Call to start updating the current frame. - @param delta_time Delta time in seconds. - */ - void update(const float delta_time); - - /** Call to begin rendering for a window. - @param index The index of the window to begin rendering for. - */ - void render(const int index); - - void end_frame(); - - /// Pause updating. - void pause(); - - /// Resume updating. - void unpause(); - - /** Query the current pause state. - @return Whether or not the engine is currently paused. - */ - bool is_paused() const; - - /// Request to begin quitting immediately. This is not forced, and can be canceled by the user, platform, or app. - void quit(); - - /// Call right before the platform is about to quit the application, and requests the app or other systems to save work. - void prepare_quit(); - - /// Query whether or not the engine is in the process of quitting. - bool is_quitting() const; - - /** Set the GFX api to use. - @param gfx The GFX object to use. Must not be null. - */ - void set_gfx(GFX* gfx); - - /** Get the current GFX api. - @return The current GFX api. Can be null. - */ - GFX* get_gfx(); - - /** Get the input system. - @return Instance of the input system. Will not be null. - */ - Input* get_input(); - - /** Get the renderer for a window. - @param index Index of the window. Default is 0. - @return Instance of the renderer. Will not be null. - */ - Renderer* get_renderer(); - - /** Get the physics system. - @return Instance of the physics system. Will not be null. - */ - Physics* get_physics(); - - /// Creates an empty scene with no path. This will change the current scene. - void create_empty_scene(); - - /** Load a scene from disk. This will change the current scene if successful. - @param path The scene file path. - @return Returns a instance of the scene is successful, and nullptr on failure. - */ - Scene* load_scene(const file::Path path); - - /** Save the current scene to disk. - @param path The absolute file path. - */ - void save_scene(const std::string_view path); - - /** Load a UI screen from disk. This will not change the current screen. - @param path The screen file path. - @return Returns a instance of the screen if successful, and nullptr on failure. - */ - ui::Screen* load_screen(const file::Path path); - - /** Set the current screen. - @param screen The screen object to set as current. Can be null. - */ - void set_screen(ui::Screen* screen); - - /** Gets the current screen. - @return The current screen. Can be null. - */ - ui::Screen* get_screen() const; - - /** Load a prefab from disk. - @param scene The scene to add the prefab to. - @param path The prefab file path. - @param override_name If not empty, the root object's new name. Defaulted to a empty string. - */ - Object add_prefab(Scene& scene, const file::Path path, const std::string_view override_name = ""); - - /** Save a tree of objects as a prefab to disk. - @param root The parent object to save as a prefab. - @param path The absolue file path. - */ - void save_prefab(const Object root, const std::string_view path); - - /** Deserializes a animation channel from JSON. - @param j The animation channel json to deserialize. - @return An animation channel. - */ - AnimationChannel load_animation(nlohmann::json j); - - /** Load an animation from disk. - @param path The animation file path. - @return An animation. - */ - Animation load_animation(const file::Path path); - - /** Load a cutscene from disk. This changes the current cutscene. - @param path The cutscene file path. - */ - void load_cutscene(const file::Path path); - - /** Saves the current cutscene to disk. - @param path The absolute file path. - */ - void save_cutscene(const std::string_view path); - - /** Adds the window for engine management. - @param native_handle The platform's native handle to it's window equivalent. - @param identifier The identifier of the new window. - @param extent The extent of the window. - */ - void add_window(void* native_handle, const int identifier, const prism::Extent extent); - - /** Removes the window from engine management. Should be called before the window is actually closed. - @param identifier The identifier of the window to remove. - */ - void remove_window(const int identifier); - - /** Called when the window has changed size. - @param identifier The window that has been resized. - @param extent The new extent of the window. - */ - void resize(const int identifier, const prism::Extent extent); - - /** Called when a key has been pressed. - @param keyCode A platform-specific key code. - @note Use platform::get_keycode to get a InputButton equivalent if needed. - @note This function is only intended for debug purposes and all production code should be using the Input system instead. - */ - void process_key_down(const unsigned int keyCode); - - /** Called when a key has been released. - @param keyCode A platform-specific key code. - @note Use platform::get_keycode to get a InputButton equivalent if needed. - @note This function is only intended for debug purposes and all production code should be using the Input system instead. - */ - void process_key_up(const unsigned int keyCode); - - /** Called when a mouse button has been clicked.. - @param button The mouse button. - @param offset The mouse position relative to the window where the click occured. - @note This function is only intended for debug purposes and all production code should be using the Input system instead. - */ - void process_mouse_down(const int button, const prism::Offset offset); - - /** Pushes a UI event for the current screen. Does nothing if there is no screen set. - @param name The name of the event. - @param data Data for the event. Defaulted to an empty string. - */ - void push_event(const std::string_view name, const std::string_view data = ""); - - /** Load a localization file from disk. This will change the current localization. - @param path The localization file path. - */ - void load_localization(const std::string_view path); - - /** Queries whether or not the current localization loaded has a key. - @param id The key to query. - @return Whether or not the locale has the key specified. - @note Having no localization loaded will always return false. - */ - bool has_localization(const std::string_view id) const; - - /** Localizes a string. - @param id The locale key to use. - @return A localized string if the key is found, or an empty string if not found. - @note Having no localization loaded will always return a empty string. - */ - std::string localize(const std::string id); - - /** Adds a timer to the list of timers. - @param timer The timer to add. - @note The timer instance is passed by reference. Use this to keep track of your timers without having to query it's state back. - */ - void add_timer(Timer& timer); - - /** Gets the current scene. - @return The current scene if set, or nullptr if there isn't one. - */ - Scene* get_scene(); - - /** Get a scene by path. This does not change the current scene. - @param name The path to the scene file. - @return Returns a scene if it was previously loaded and found, or nullptr on failure. - */ - Scene* get_scene(const std::string_view name); - - /** Set the current scene. - @param scene The scene to set. Can be null. - */ - void set_current_scene(Scene* scene); - - /** Get the current scene's path. - @return If a scene is loaded, the path to the scene. Can be an empty string if there is no scene loaded, or if it's an empty scene. - */ - std::string_view get_scene_path() const; - - /** Updates the Transform hierarchy for a scene. - @param scene The scene to update. - */ - void update_scene(Scene& scene); - - /// The current cutscene. - std::unique_ptr cutscene; - - /// The current time in seconds for cutscene playback. - float current_cutscene_time = 0.0f; - - /// The cutscene playback state. - bool play_cutscene = false; - - /** Start playback of an animation. - @param animation The animation to play. - @param object The animation's target. - @param looping Whether or not the animation should loop or be discarded when finished. Default is false. - */ - void play_animation(const Animation animation, const Object target, const bool looping = false); - - /** Sets the animation speed of an object. - @param target The object you want to change the animation speed of. - @param modifier The speed to play the object's animations at. A modifier of 2.0 would be 2x the speed, and 0.5 would be 1/2x the speed. - */ - void set_animation_speed_modifier(const Object target, const float modifier); - - /** Stops all animation for an object. - @param target The object you want the animations to stop for. - */ - void stop_animation(const Object target); - - /// If there is a render context available. If this is false, avoid doing any GFX or Renderer work as it could crash or cause undefined behavior. - bool render_ready = false; - - /// If physics should upate. This is a control indepentent of the pause state. - bool update_physics = true; - -#if defined(PLATFORM_TVOS) || defined(PLATFORM_IOS) || defined(PLATFORM_WINDOWS) || defined(PLATFORM_LINUX) - bool debug_enabled = true; -#else - bool debug_enabled = false; -#endif - -private: - void setup_scene(Scene& scene); - - void on_remove(Object object); - - bool _paused = false; - - ui::Screen* _current_screen = nullptr; - - Scene* _current_scene = nullptr; - std::vector> _scenes; - std::map _path_to_scene; - - struct Window { - int identifier = -1; - prism::Extent extent; - bool quitRequested = false; - - RenderTarget* render_target = nullptr; + Object target = NullObject; + Animation animation; }; - std::vector _windows; + /// The glue between app and systems such as the Renderer. + class Engine { + public: + /** + Constructs an Engine with command line arguments. Can be accessed later from command_line_arguments. - Window* get_window(const int identifier) { - for(auto& window : _windows) { - if(window->identifier == identifier) - return window; + @param argc Numer of arguments. Can be null. + @param argv Array of strings containing arguments. Can be null. + */ + Engine(int argc, char* argv[]); + + Engine(const Engine& other) = delete; + Engine(Engine&& other) = delete; + + ~Engine(); + + /// Command line arguments, can be empty. + std::vector command_line_arguments; + + /** Sets the app object. + @param app The app object to set. Must not be null. + */ + void set_app(app* app); + + /** Gets the current app object + @return The current app object. Can be null. + */ + [[nodiscard]] app* get_app() const; + + /** Call to begin the next frame. + @param delta_time Delta time in seconds. + */ + void begin_frame(float delta_time); + + /** Call to start updating the current frame. + @param delta_time Delta time in seconds. + */ + void update(float delta_time); + + /** Call to begin rendering for a window. + @param index The index of the window to begin rendering for. + */ + void render(int index); + + void end_frame(); + + /// Pause updating. + void pause(); + + /// Resume updating. + void unpause(); + + /** Query the current pause state. + @return Whether or not the engine is currently paused. + */ + [[nodiscard]] bool is_paused() const; + + /// Request to begin quitting immediately. This is not forced, and can be canceled by the user, platform, or app. + void quit(); + + /// Call right before the platform is about to quit the application, and requests the app or other systems to save work. + void prepare_quit(); + + /// Query whether or not the engine is in the process of quitting. + [[nodiscard]] bool is_quitting() const; + + /** Set the GFX api to use. + @param gfx The GFX object to use. Must not be null. + */ + void set_gfx(GFX* gfx); + + /** Get the current GFX api. + @return The current GFX api. Can be null. + */ + GFX* get_gfx(); + + /** Get the input system. + @return Instance of the input system. Will not be null. + */ + Input* get_input(); + + /** Get the renderer for a window. + @param index Index of the window. Default is 0. + @return Instance of the renderer. Will not be null. + */ + Renderer* get_renderer(); + + /** Get the physics system. + @return Instance of the physics system. Will not be null. + */ + Physics* get_physics(); + + /// Creates an empty scene with no path. This will change the current scene. + void create_empty_scene(); + + /** Load a scene from disk. This will change the current scene if successful. + @param path The scene file path. + @return Returns a instance of the scene is successful, and nullptr on failure. + */ + Scene* load_scene(file::Path path); + + /** Save the current scene to disk. + @param path The absolute file path. + */ + void save_scene(std::string_view path); + + /** Load a UI screen from disk. This will not change the current screen. + @param path The screen file path. + @return Returns a instance of the screen if successful, and nullptr on failure. + */ + ui::Screen* load_screen(file::Path path); + + /** Set the current screen. + @param screen The screen object to set as current. Can be null. + */ + void set_screen(ui::Screen* screen); + + /** Gets the current screen. + @return The current screen. Can be null. + */ + [[nodiscard]] ui::Screen* get_screen() const; + + /** Load a prefab from disk. + @param scene The scene to add the prefab to. + @param path The prefab file path. + @param override_name If not empty, the root object's new name. Defaulted to a empty string. + */ + Object add_prefab(Scene& scene, file::Path path, std::string_view override_name = ""); + + /** Save a tree of objects as a prefab to disk. + @param root The parent object to save as a prefab. + @param path The absolue file path. + */ + void save_prefab(Object root, std::string_view path); + + /** Deserializes a animation channel from JSON. + @param j The animation channel json to deserialize. + @return An animation channel. + */ + AnimationChannel load_animation(nlohmann::json j); + + /** Load an animation from disk. + @param path The animation file path. + @return An animation. + */ + Animation load_animation(file::Path path); + + /** Load a cutscene from disk. This changes the current cutscene. + @param path The cutscene file path. + */ + void load_cutscene(file::Path path); + + /** Saves the current cutscene to disk. + @param path The absolute file path. + */ + void save_cutscene(std::string_view path); + + /** Adds the window for engine management. + @param native_handle The platform's native handle to it's window equivalent. + @param identifier The identifier of the new window. + @param extent The extent of the window. + */ + void add_window(void* native_handle, int identifier, prism::Extent extent); + + /** Removes the window from engine management. Should be called before the window is actually closed. + @param identifier The identifier of the window to remove. + */ + void remove_window(int identifier); + + /** Called when the window has changed size. + @param identifier The window that has been resized. + @param extent The new extent of the window. + */ + void resize(int identifier, prism::Extent extent); + + /** Called when a key has been pressed. + @param keyCode A platform-specific key code. + @note Use platform::get_keycode to get a InputButton equivalent if needed. + @note This function is only intended for debug purposes and all production code should be using the Input system instead. + */ + void process_key_down(unsigned int keyCode); + + /** Called when a key has been released. + @param keyCode A platform-specific key code. + @note Use platform::get_keycode to get a InputButton equivalent if needed. + @note This function is only intended for debug purposes and all production code should be using the Input system instead. + */ + void process_key_up(unsigned int keyCode); + + /** Called when a mouse button has been clicked.. + @param button The mouse button. + @param offset The mouse position relative to the window where the click occured. + @note This function is only intended for debug purposes and all production code should be using the Input system instead. + */ + void process_mouse_down(int button, prism::Offset offset); + + /** Pushes a UI event for the current screen. Does nothing if there is no screen set. + @param name The name of the event. + @param data Data for the event. Defaulted to an empty string. + */ + void push_event(std::string_view name, std::string_view data = ""); + + /** Load a localization file from disk. This will change the current localization. + @param path The localization file path. + */ + void load_localization(std::string_view path); + + /** Queries whether or not the current localization loaded has a key. + @param id The key to query. + @return Whether or not the locale has the key specified. + @note Having no localization loaded will always return false. + */ + [[nodiscard]] bool has_localization(std::string_view id) const; + + /** Localizes a string. + @param id The locale key to use. + @return A localized string if the key is found, or an empty string if not found. + @note Having no localization loaded will always return a empty string. + */ + std::string localize(std::string id); + + /** Adds a timer to the list of timers. + @param timer The timer to add. + @note The timer instance is passed by reference. Use this to keep track of your timers without having to query it's state back. + */ + void add_timer(Timer& timer); + + /** Gets the current scene. + @return The current scene if set, or nullptr if there isn't one. + */ + Scene* get_scene(); + + /** Get a scene by path. This does not change the current scene. + @param name The path to the scene file. + @return Returns a scene if it was previously loaded and found, or nullptr on failure. + */ + Scene* get_scene(std::string_view name); + + /** Set the current scene. + @param scene The scene to set. Can be null. + */ + void set_current_scene(Scene* scene); + + /** Get the current scene's path. + @return If a scene is loaded, the path to the scene. Can be an empty string if there is no scene loaded, or if it's an empty scene. + */ + [[nodiscard]] std::string_view get_scene_path() const; + + /** Updates the Transform hierarchy for a scene. + @param scene The scene to update. + */ + void update_scene(Scene& scene); + + /// The current cutscene. + std::unique_ptr cutscene; + + /// The current time in seconds for cutscene playback. + float current_cutscene_time = 0.0f; + + /// The cutscene playback state. + bool play_cutscene = false; + + /** Start playback of an animation. + @param animation The animation to play. + @param object The animation's target. + @param looping Whether or not the animation should loop or be discarded when finished. Default is false. + */ + void play_animation(Animation animation, Object target, bool looping = false); + + /** Sets the animation speed of an object. + @param target The object you want to change the animation speed of. + @param modifier The speed to play the object's animations at. A modifier of 2.0 would be 2x the speed, and 0.5 would be 1/2x the speed. + */ + void set_animation_speed_modifier(Object target, float modifier); + + /** Stops all animation for an object. + @param target The object you want the animations to stop for. + */ + void stop_animation(Object target); + + /// If there is a render context available. If this is false, avoid doing any GFX or Renderer work as it could crash or cause undefined behavior. + bool render_ready = false; + + /// If physics should upate. This is a control indepentent of the pause state. + bool update_physics = true; + +#if defined(PLATFORM_TVOS) || defined(PLATFORM_IOS) || defined(PLATFORM_WINDOWS) || defined(PLATFORM_LINUX) + bool debug_enabled = true; +#else + bool debug_enabled = false; +#endif + + private: + void setup_scene(Scene& scene); + + void on_remove(Object object); + + bool _paused = false; + + ui::Screen* _current_screen = nullptr; + + Scene* _current_scene = nullptr; + std::vector> _scenes; + std::map _path_to_scene; + + struct Window { + int identifier = -1; + prism::Extent extent; + bool quitRequested = false; + + RenderTarget* render_target = nullptr; + }; + + std::vector _windows; + + Window* get_window(const int identifier) { + for(auto& window : _windows) { + if(window->identifier == identifier) + return window; + } + + return nullptr; } - - return nullptr; + + void calculate_bone(Mesh& mesh, const Mesh::Part& part, Bone& bone, const Bone* parent_bone = nullptr); + void calculate_object(Scene& scene, Object object, Object parent_object = NullObject); + + Shot* get_shot(float time); + void update_animation(const Animation& anim, float time); + void update_cutscene(float time); + + void update_animation_channel(Scene& scene, const AnimationChannel& channel, float time); + + app* _app = nullptr; + GFX* _gfx = nullptr; + + std::unique_ptr _input; + std::unique_ptr _physics; + std::unique_ptr _renderer; + + std::vector _timers, _timersToRemove; + + std::map _strings; + + std::vector _animation_targets; + + std::unique_ptr _imgui; + + const InputButton debug_button = InputButton::Q; + }; + + inline bool operator==(const AnimationTarget& a1, const AnimationTarget& a2) { + return a1.current_time == a2.current_time; } - - void calculate_bone(Mesh& mesh, const Mesh::Part& part, Bone& bone, const Bone* parent_bone = nullptr); - void calculate_object(Scene& scene, Object object, const Object parent_object = NullObject); - - Shot* get_shot(const float time); - void update_animation(const Animation& anim, const float time); - void update_cutscene(const float time); - - void update_animation_channel(Scene& scene, const AnimationChannel& channel, const float time); - - App* _app = nullptr; - GFX* _gfx = nullptr; - - std::unique_ptr _input; - std::unique_ptr _physics; - std::unique_ptr _renderer; - - std::vector _timers, _timersToRemove; - - std::map _strings; - - std::vector _animation_targets; - - std::unique_ptr _imgui; - - const InputButton debug_button = InputButton::Q; -}; - -inline bool operator==(const AnimationTarget& a1, const AnimationTarget& a2) { - return a1.current_time == a2.current_time; } -inline Engine* engine = nullptr; +inline prism::Engine* engine = nullptr; diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index 457f87e..c019b5d 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -23,6 +23,8 @@ #include "shadowpass.hpp" #include "scenecapture.hpp" +using prism::Engine; + Engine::Engine(const int argc, char* argv[]) { console::info(System::Core, "Prism Engine loading..."); @@ -47,13 +49,13 @@ Engine::Engine(const int argc, char* argv[]) { Engine::~Engine() {} -void Engine::set_app(App* app) { +void Engine::set_app(app* app) { Expects(app != nullptr); _app = app; } -App* Engine::get_app() const { +prism::app* Engine::get_app() const { return _app; } diff --git a/engine/gfx/vulkan/src/gfx_vulkan.cpp b/engine/gfx/vulkan/src/gfx_vulkan.cpp index b745fb9..dcde606 100755 --- a/engine/gfx/vulkan/src/gfx_vulkan.cpp +++ b/engine/gfx/vulkan/src/gfx_vulkan.cpp @@ -1354,7 +1354,7 @@ void GFXVulkan::createInstance(std::vector layers, std::vectorset_app(app); diff --git a/platforms/linux/main.cpp.in b/platforms/linux/main.cpp.in index 230200c..c58126d 100755 --- a/platforms/linux/main.cpp.in +++ b/platforms/linux/main.cpp.in @@ -294,7 +294,7 @@ int main(int argc, char* argv[]) { xcb_screen_next(&iter); screen = iter.data; - engine = new Engine(argc, argv); + engine = new prism::Engine(argc, argv); app = new @APP_CLASS@(); engine->set_app(app); diff --git a/platforms/mac/main.mm.in b/platforms/mac/main.mm.in index fbf5a13..19669a7 100755 --- a/platforms/mac/main.mm.in +++ b/platforms/mac/main.mm.in @@ -496,7 +496,7 @@ int main(int argc, char* argv[]) { NSApp = [NSApplication sharedApplication]; - engine = new Engine(argc, argv); + engine = new prism::Engine(argc, argv); app = new @APP_CLASS@(); engine->set_app(app); diff --git a/platforms/sdl/main.cpp.in b/platforms/sdl/main.cpp.in index dc2a595..f2d2ff9 100644 --- a/platforms/sdl/main.cpp.in +++ b/platforms/sdl/main.cpp.in @@ -178,7 +178,7 @@ void platform::unmute_output() { int main(int argc, char* argv[]) { SDL_Init(SDL_INIT_VIDEO); - engine = new Engine(argc, argv); + engine = new prism::Engine(argc, argv); app = new @APP_CLASS@(); engine->set_app(app); diff --git a/platforms/tvos/ViewController.mm.in b/platforms/tvos/ViewController.mm.in index 2d121c1..89ef7d7 100644 --- a/platforms/tvos/ViewController.mm.in +++ b/platforms/tvos/ViewController.mm.in @@ -98,7 +98,7 @@ int drawable_width, drawable_height; drawable_width = [view frame].size.width * [view contentScaleFactor]; drawable_height = [view frame].size.height * [view contentScaleFactor]; - engine = new Engine(0, nullptr); + engine = new prism::Engine(0, nullptr); app = new @APP_CLASS@(); engine->set_app(app); diff --git a/platforms/windows/main.cpp.in b/platforms/windows/main.cpp.in index 9c65811..c82d420 100755 --- a/platforms/windows/main.cpp.in +++ b/platforms/windows/main.cpp.in @@ -144,7 +144,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow instance = hInstance; cmdShow = nCmdShow; - engine = new Engine(0, nullptr); + engine = new prism::Engine(0, nullptr); ginterface = new GFXVulkan(); if(ginterface->initialize(GFXCreateInfo())) { diff --git a/tools/common/include/commoneditor.hpp b/tools/common/include/commoneditor.hpp index 5365653..9d63b4f 100755 --- a/tools/common/include/commoneditor.hpp +++ b/tools/common/include/commoneditor.hpp @@ -102,7 +102,7 @@ AssetType get_asset_type() { constexpr int thumbnail_resolution = 256; -class CommonEditor : public App { +class CommonEditor : public prism::app { public: CommonEditor(std::string id); diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index 4551ad8..0ef9c05 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -49,7 +49,7 @@ const std::map imToPl = { CommonEditor::CommonEditor(std::string id) : id(id) { #ifdef PLATFORM_MACOS - file::set_domain_path(file::Domain::App, "../../../data"); + file::set_domain_path(file::Domain::app, "../../../data"); #else file::set_domain_path(file::Domain::App, "data"); #endif diff --git a/tools/editor/src/prismeditor.cpp b/tools/editor/src/prismeditor.cpp index 07116ec..d2793d5 100755 --- a/tools/editor/src/prismeditor.cpp +++ b/tools/editor/src/prismeditor.cpp @@ -24,7 +24,7 @@ std::string get_filename(const std::string path) { std::vector editors; -void app_main(Engine* engine) { +void app_main(prism::Engine* engine) { CommonEditor* editor = (CommonEditor*)engine->get_app(); platform::open_window("Prism Editor",