PeriDyno 1.0.0
Loading...
Searching...
No Matches
GlfwRenderWindow.h
Go to the documentation of this file.
1#pragma once
2
3#include <Platform.h>
4#include <ImWindow.h>
5
6#include "RenderWindow.h"
7
8struct GLFWwindow;
9namespace dyno {
10
11 class Camera;
12 class Node;
13 struct Picture;
14
16 {
19 };
20
22 {
23 public:
24 GlfwRenderWindow(int argc = 0, char **argv = NULL);
26
27 void initialize(int width, int height) override;
28
29 void mainLoop() override;
30
31 const std::string& name() const;
32
33 void setWindowTitle(const std::string& title);
34
35 void setCursorPos(double x, double y);
36 double getCursorPosX();
37 double getCursorPosY();
38
39 void setButtonType(uint button) { mButtonType = button; }
40 void setButtonMode(uint mode) { mButtonMode = mode; }
41 void setButtonAction(uint action) { mButtonAction = action; }
42 void setButtonState(ButtonState state) { mButtonState = state; }
43
44 uint getButtonType() const { return mButtonType; }
48
49 void turnOnVSync();
50 void turnOffVSync();
51
52 void toggleAnimation();
53
54 int getWidth();
55 int getHeight();
56
57 // ImGui extend function
58 // 全局样式设定
59 void initializeStyle();
60
61 ImWindow* imWindow() { return &mImWindow; }
62
63 protected:
64 void initCallbacks(); //init default callbacks
65
66 void drawScene(void);
67
68 static void mouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
69 static void keyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
70 static void reshapeCallback(GLFWwindow* window, int w, int h);
71 static void cursorPosCallback(GLFWwindow* window, double x, double y);
72 static void cursorEnterCallback(GLFWwindow* window, int entered);
73 static void scrollCallback(GLFWwindow* window, double offsetX, double OffsetY);
74
75 //save screenshot to file
76 void onSaveScreen(const std::string& filename) override; //save to file with given name
77
78 private:
79 //pointers to callback methods
80 void(*mMouseButtonFunc)(GLFWwindow* window, int button, int action, int mods);
81 void(*mKeyboardFunc)(GLFWwindow* window, int key, int scancode, int action, int mods);
82 void(*mReshapeFunc)(GLFWwindow* window, int w, int h);
83 void(*mCursorPosFunc)(GLFWwindow* window, double x, double y);
84 void(*mCursorEnterFunc)(GLFWwindow* window, int entered);
85 void(*mScrollFunc)(GLFWwindow* window, double offsetX, double OffsetY);
86
87 GLFWwindow* mWindow = nullptr;
88
89 //state of the mouse
94
95 int mPlaneSize = 4;
96
99
100 bool mAnimationToggle = false;
101
102 bool mBackgroundToggle = true;
103 bool mBoundingboxToggle = false;
104
105 double mCursorTempX = -1.0;
106
107 std::string mWindowTitle;
108
109 private:
111 };
112
113}
void(* mCursorPosFunc)(GLFWwindow *window, double x, double y)
void setCursorPos(double x, double y)
void setWindowTitle(const std::string &title)
void(* mScrollFunc)(GLFWwindow *window, double offsetX, double OffsetY)
void setButtonState(ButtonState state)
void initialize(int width, int height) override
static void scrollCallback(GLFWwindow *window, double offsetX, double OffsetY)
void onSaveScreen(const std::string &filename) override
static void keyboardCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
static void reshapeCallback(GLFWwindow *window, int w, int h)
GlfwRenderWindow(int argc=0, char **argv=NULL)
const std::string & name() const
void setButtonAction(uint action)
void(* mReshapeFunc)(GLFWwindow *window, int w, int h)
ButtonState getButtonState() const
void setButtonType(uint button)
void(* mKeyboardFunc)(GLFWwindow *window, int key, int scancode, int action, int mods)
static void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
static void cursorPosCallback(GLFWwindow *window, double x, double y)
static void cursorEnterCallback(GLFWwindow *window, int entered)
void(* mCursorEnterFunc)(GLFWwindow *window, int entered)
void(* mMouseButtonFunc)(GLFWwindow *window, int button, int action, int mods)
void setButtonMode(uint mode)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
unsigned int uint
Definition VkProgram.h:14