8 #define GLFW_INCLUDE_NONE
9 #include <GLFW/glfw3.h>
11 #define MOUSE_CURSOR_DISABLED 0
12 #define MOUSE_CURSOR_ENABLED 1
13 #define MOUSE_CURSOR_NORMAL 1
14 #define MOUSE_CURSOR_HAND 2
19 #include <unordered_set>
30 using std::unordered_set;
55 static constexpr
int FPS { 60 };
117 static void setLocale(
const string& locale);
162 static string execute(
const string& command);
319 virtual void reshape(
int width,
int height) = 0;
340 virtual void onDrop(
const vector<string>& paths);
406 static void glfwOnChar(GLFWwindow* window,
unsigned int key);
416 static void glfwOnKey(GLFWwindow* window,
int key,
int scanCode,
int action,
int mods);
433 static void glfwOnMouseButton(GLFWwindow* window,
int button,
int action,
int mods);
462 static void glfwOnDrop(GLFWwindow* window,
int count,
const char** paths);
Application base class, please make sure to allocate application on heap to have correct application ...
static void setMousePosition(int x, int y)
Set mouse position.
static STATIC_DLL_IMPEXT Renderer * renderer
static STATIC_DLL_IMPEXT int glfwMouseButtonLast
static void glfwOnMouseWheel(GLFWwindow *window, double x, double y)
GLFW on key.
static string getCPUName()
static string getOSName()
static constexpr int EXITCODE_FAILURE
static void executeBackground(const string &command)
Execute a command in background.
static STATIC_DLL_IMPEXT Application * application
static void swapBuffers()
Swap rendering buffers.
array< array< int64_t, 16 >, 16 > joystickButtons
void setIcon()
Set application icon.
static int getMouseCursor()
virtual void reshape(int width, int height)=0
Resize.
static void glfwOnMouseMoved(GLFWwindow *window, double x, double y)
GLFW on mouse moved.
int run(int argc, char **argv, const string &title, InputEventHandler *inputEventHandler=nullptr, int windowHints=WINDOW_HINT_NONE)
Run this application.
int getWindowWidth() const
void setWindowXPosition(int windowXPosition)
Set window X position when initializing.
static void glfwOnClose(GLFWwindow *window)
GLFW on close.
string executableFileName
const string & getTitle()
static void glfwOnWindowResize(GLFWwindow *window, int width, int height)
GLFW on window resize.
bool isFullScreen() const
static STATIC_DLL_IMPEXT array< unsigned int, 10 > glfwMouseButtonDownFrames
void setWindowYPosition(int windowYPosition)
Set window Y position when initializing.
static string execute(const string &command)
Execute a command and wait until it finished running.
void setClipboardContent(const string &content)
Set clipboard content.
static void glfwOnDrop(GLFWwindow *window, int count, const char **paths)
GLFW on drop.
static void displayInternal()
Display function.
static constexpr int64_t JOYSTICK_BUTTON_TIME_REPEAT
static void glfwOnChar(GLFWwindow *window, unsigned int key)
GLFW on char.
static void reshapeInternal(int width, int height)
Reshape function.
void setWindowWidth(int windowWidth)
Set window width.
static STATIC_DLL_IMPEXT bool limitFPS
static constexpr int EXITCODE_SUCCESS
static bool hasApplication()
void updateJoystickInput(int joystickIdx)
Update joystick input for given joystick index.
virtual ~Application()
Destructor.
static void cancelExit()
Cancels a users requested exit (ALT-F4 or X button)
int getWindowHeight() const
static Renderer * getRenderer()
virtual void onClose()
On close.
static void setLimitFPS(bool limitFPS)
Set frames per seconds limit.
static STATIC_DLL_IMPEXT bool glfwCapsLockEnabled
string getClipboardContent()
static void installExceptionHandler()
Windows only: Install exception handler that will print a stack trace if crashing.
virtual void display()=0
Display.
static Application * getApplication()
static STATIC_DLL_IMPEXT int64_t timeLast
void setFullScreen(bool fullScreen)
Set full screen mode.
static constexpr int WINDOW_HINT_MAXIMIZED
static STATIC_DLL_IMPEXT InputEventHandler * inputEventHandler
static int getMousePositionY()
static int getMousePositionX()
virtual void initialize()=0
Init.
static STATIC_DLL_IMPEXT int mouseCursor
static constexpr int WINDOW_HINT_NOTDECORATED
static constexpr int WINDOW_HINT_INVISIBLE
static void exit(int exitCode)
Exits this application with given exit code.
void updateGamepadInput(int gamepadIdx)
Update gamepad input for given gamepad index.
unordered_set< int > connectedGamepads
static STATIC_DLL_IMPEXT GLFWwindow * glfwWindow
static constexpr int WINDOW_HINT_NOTRESIZEABLE
unordered_set< int > connectedJoysticks
static void setVSyncEnabled(bool vSync)
Set vsync enabled.
void setWindowHeight(int windowHeight)
Set window height.
virtual void dispose()=0
Disposes.
static void glfwOnJoystickConnect(int joystickIdx, int event)
GLFW on joystick connect/disconnect.
static void glfwOnKey(GLFWwindow *window, int key, int scanCode, int action, int mods)
GLFW on key.
static void openBrowser(const string &url)
Open browser with given url.
void setInputEventHandler(InputEventHandler *inputEventHandler)
Set input event handler.
const string & getExecutableFileName()
static void setLocale(const string &locale)
Set locale.
static constexpr int WINDOW_HINT_NONE
Application()
Public constructor.
static void glfwOnMouseButton(GLFWwindow *window, int button, int action, int mods)
GLFW on key.
static void setMouseCursor(int mouseCursor)
Set mouse cursor.
static STATIC_DLL_IMPEXT GLFWcursor * glfwHandCursor
bool isDebuggingEnabled()
virtual void onDrop(const vector< string > &paths)
On drop.
#define STATIC_DLL_IMPEXT
#define FORBID_CLASS_COPY(CLASS)