Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
PlatformUtils.h
Go to the documentation of this file.
1#pragma once
2/// @file PlatformUtils.h
3/// @author Damon S. Green II
4/// @brief Declares platform-specific utilities for file dialogs and file system operations.
5
6#include <string>
7
8namespace Muto {
9
10 /// @class FileDialogs
11 /// @brief Cross-platform file dialog utilities.
13 {
14 public:
15 /// @brief Opens a file dialog to select a file to open.
16 ///
17 /// @param filter The file type filter for the dialog.
18 /// @return The selected file path or an empty string if cancelled.
19 static std::string OpenFile(const char* filter);
20
21 /// @brief Opens a file dialog to select a location to save a file.
22 ///
23 /// @param filter The file type filter for the dialog.
24 /// @return The selected file path or an empty string if cancelled.
25 static std::string SaveFile(const char* filter);
26 };
27
28
29 /// WIP
31 {
32 public:
33 static void Initialize();
34 static std::string GetCurrentWorkingDirectory();
35 static std::string GetAbsolutePath(const std::string& relativePath);
36 static std::string GetTravelingUpPath(const std::string& path);
37 static bool IsInitialized() { return m_Initialized; }
38
39 static bool m_Initialized;
40 static std::string m_RootEngineDirectory;
41 static std::string m_RootEditorDirectory;
42 static std::string m_ResourcesDirectory;
43 static std::string m_AssetsDirectory;
44 static std::string m_ProjectsDirectory;
45 static std::string m_CurrentProjectDirectory;
46 };
47
48
49};
#define MU_CORE_ASSERT(x,...)
Definition Asserts.h:32
#define MU_BIND_EVENT_FN(fn)
Binds a member function as an event handler.
Definition Defines_Macros.h:17
static const uint32_t s_MapHeight
Definition EditorLayer.cpp:14
static const char * s_MapTiles
Definition EditorLayer.cpp:15
static const uint32_t s_MapWidth
Definition EditorLayer.cpp:13
#define MU_PROFILE_SCOPE(name)
Definition Instrumentor.h:239
#define MU_PROFILE_FUNCTION()
Definition Instrumentor.h:240
#define MU_CORE_ERROR(...)
error: indicates an error that has occurred
Definition Log.h:42
#define MU_CORE_INFO(...)
info: general information about application flow
Definition Log.h:38
The core application class that manages the main loop, window, layers, and event handling.
Definition Application.h:70
void Close()
Closes the application.
Definition Application.cpp:103
ImGuiLayer * GetImGuiLayer()
Retrieves the ImGui layer.
Definition Application.h:104
static Application & Get()
Retrieves the singleton instance of the Application.
Definition Application.h:107
Definition EditorLayer.h:13
virtual void OnAttach() override
Called when the layer is attached to the application.
Definition EditorLayer.cpp:46
void OpenScene()
Definition EditorLayer.cpp:539
int m_GizmoType
Definition EditorLayer.h:49
bool OnKeyPressed(KeyPressedEvent &e)
Definition EditorLayer.cpp:480
EditorLayer()
Definition EditorLayer.cpp:38
void NewScene()
Definition EditorLayer.cpp:532
void SaveSceneAs()
Definition EditorLayer.cpp:555
virtual void OnDetach() override
Called when the layer is detached from the application.
Definition EditorLayer.cpp:230
virtual void OnEvent(Event &e) override
Called when an event is dispatched to the layer.
Definition EditorLayer.cpp:468
virtual void OnUpdate(Timestep ts) override
Called every frame to update the layer with the given timestep.
Definition EditorLayer.cpp:235
void ResetScene()
Definition EditorLayer.cpp:566
float m_TranslationSnap
Definition EditorLayer.h:50
SceneState m_SceneState
Definition EditorLayer.h:41
float m_ScaleSnap
Definition EditorLayer.h:50
bool m_ViewportFocused
Definition EditorLayer.h:43
float m_RotationSnap
Definition EditorLayer.h:50
virtual void OnImGuiRender() override
Called when the layer should render its ImGui components.
Definition EditorLayer.cpp:281
SceneState
Definition EditorLayer.h:38
bool m_ViewportHovered
Definition EditorLayer.h:43
Represents an entity in a scene.
Definition Entity.h:17
Stack-based templated event dispatcher.
Definition Event.h:66
EventDispatcher(Event &event)
Construct an EventDispatcher for a specific event.
Definition Event.h:76
Abstract base class for all events.
Definition Event.h:35
Cross-platform file dialog utilities.
Definition PlatformUtils.h:13
static std::string SaveFile(const char *filter)
Opens a file dialog to select a location to save a file.
Definition LinuxPlatformUtils.cpp:165
static std::string OpenFile(const char *filter)
Opens a file dialog to select a file to open.
Definition LinuxPlatformUtils.cpp:160
WIP.
Definition PlatformUtils.h:31
static std::string m_RootEditorDirectory
Definition PlatformUtils.h:41
static std::string m_RootEngineDirectory
Definition PlatformUtils.h:40
static std::string m_ProjectsDirectory
Definition PlatformUtils.h:44
static std::string m_AssetsDirectory
Definition PlatformUtils.h:43
static bool IsInitialized()
Definition PlatformUtils.h:37
static void Initialize()
Definition FileSystem.cpp:16
static bool m_Initialized
Definition PlatformUtils.h:39
static std::string GetAbsolutePath(const std::string &relativePath)
Definition FileSystem.cpp:38
static std::string GetCurrentWorkingDirectory()
Definition FileSystem.cpp:33
static std::string m_ResourcesDirectory
Definition PlatformUtils.h:42
static std::string m_CurrentProjectDirectory
Definition PlatformUtils.h:45
static std::string GetTravelingUpPath(const std::string &path)
Definition FileSystem.cpp:43
virtual void SetBlockEvents(bool block)
Definition ImGuiLayer.h:29
Base input class for querying input states.
Definition Input.h:15
static bool IsKeyPressed(int keycode)
Checks if the specified key is currently pressed.
Definition WindowsInput.cpp:9
int GetKeyCode() const
Get the key code associated with the event.
Definition KeyEvent.h:20
Event for registering key press.
Definition KeyEvent.h:37
int GetRepeatCount() const
Get the repeat count of the key press event.
Definition KeyEvent.h:48
Represents a reusable application layer that receives lifecycle callbacks (attach,...
Definition Layer.h:17
A static class that provides an interface for issuing rendering commands.
Definition RenderCommand.h:13
static void Clear()
Clears the rendering buffers.
Definition RenderCommand.h:35
A 2D renderer for drawing quads and sprites.
Definition Renderer2D.h:21
static void ResetStats()
Resets the rendering statistics.
Definition Renderer2D.cpp:516
static Statistics GetStats()
Retrieves the current rendering statistics.
Definition Renderer2D.cpp:521
Handles serialization and deserialization of scenes.
Definition SceneSerializer.h:16
void Serialize(const std::string &filepath)
Definition SceneSerializer.cpp:179
bool Deserialize(const std::string &filepath)
Definition SceneSerializer.cpp:206
Represents a time step in seconds.
Definition Timestep.h:11
@ RightControl
Definition KeyCodes.h:147
@ LeftControl
Definition KeyCodes.h:143
@ S
Definition KeyCodes.h:59
@ N
Definition KeyCodes.h:54
@ Q
Definition KeyCodes.h:57
@ O
Definition KeyCodes.h:55
@ LeftShift
Definition KeyCodes.h:142
@ RightShift
Definition KeyCodes.h:146
The main namespace for the Muto engine.
Definition Application.cpp:15
uint32_t Height
Definition Framebuffer.h:15
uint32_t Width
Definition Framebuffer.h:15
Specification for creating a Framebuffer.
Definition Framebuffer.h:14
Component that holds the transform of an entity.
Definition Components.h:68