23 #define _CRT_SECURE_NO_WARNINGS 24 #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 1 51 fprintf(stderr,
"GLFW error occured. Code: %d. Description: %s\n", error, description);
79 printf(
"ImGui_ImplGlfw_InitForOpenGL failed\n");
86 printf(
"ImGui_ImplOpenGL3_Init failed\n");
91 const char* fontPath1 =
"data/droid_sans.ttf";
92 const char* fontPath2 =
"../data/droid_sans.ttf";
93 const char* fontPath =
nullptr;
94 FILE* file1 = fopen(fontPath1,
"rb");
95 FILE* file2 = fopen(fontPath2,
"rb");
104 fontPath = fontPath2;
275 b2Vec2 ps((
float)xd, (
float)yd);
317 b2Vec2 ps((
float)xd, (
float)yd);
424 int categoryIndex = 0;
484 _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
499 fprintf(stderr,
"Failed to initialize GLFW\n");
504 const char* glslVersion =
"#version 150";
506 const char* glslVersion = NULL;
516 bool fullscreen =
false;
528 fprintf(stderr,
"Failed to open GLFW g_mainWindow.\n");
561 std::chrono::duration<double> frameTime(0.0);
562 std::chrono::duration<double> sleepAdjust(0.0);
566 std::chrono::steady_clock::time_point t1 = std::chrono::steady_clock::now();
570 int bufferWidth, bufferHeight;
594 s_test->
Step(s_settings);
602 sprintf(buffer,
"%.1f ms", 1000.0 * frameTime.count());
624 std::chrono::steady_clock::time_point t2 = std::chrono::steady_clock::now();
625 std::chrono::duration<double> target(1.0 / 60.0);
626 std::chrono::duration<double> timeUsed = t2 - t1;
627 std::chrono::duration<double> sleepTime = target - timeUsed + sleepAdjust;
628 if (sleepTime > std::chrono::duration<double>(0))
630 std::this_thread::sleep_for(sleepTime);
633 std::chrono::steady_clock::time_point t3 = std::chrono::steady_clock::now();
637 sleepAdjust = 0.9 * sleepAdjust + 0.1 * (target - frameTime);
bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow *window, bool install_callbacks)
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
bool ImGui_ImplOpenGL3_Init(const char *glsl_version)
#define GL_COLOR_BUFFER_BIT
TestCreateFcn * createFcn
bool m_drawFrictionImpulse
GLFWAPI void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
#define GLFW_MOD_CONTROL
If this bit is set one or more Control keys were held down.
b2Vec2 ConvertScreenToWorld(const b2Vec2 &screenPoint)
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow *window, GLFWwindowsizefun cbfun)
Sets the size callback for the specified window.
B2_API const b2Vec2 b2Vec2_zero
Useful constant.
static void CharCallback(GLFWwindow *window, unsigned int c)
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
#define GL_DEPTH_BUFFER_BIT
static void RestartTest()
void glfwErrorCallback(int error, const char *description)
#define GLFW_OPENGL_FORWARD_COMPAT
OpenGL forward-compatibility hint and attribute.
IMGUI_API bool IsItemClicked(int mouse_button=0)
#define GLFW_CONTEXT_VERSION_MAJOR
Context client API major version hint and attribute.
static void CreateUI(GLFWwindow *window, const char *glslVersion=NULL)
virtual void MouseDown(const b2Vec2 &p)
IMGUI_API void NewFrame()
void ImGui_ImplGlfw_Shutdown()
B2_API b2Version b2_version
Current version.
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
#define GLFW_KEY_LEFT_BRACKET
void ShiftOrigin(const b2Vec2 &newOrigin)
#define GLFW_OPENGL_PROFILE
OpenGL profile hint and attribute.
IMGUI_API void EndTabItem()
static bool s_rightMouseDown
struct GLFWwindow GLFWwindow
Opaque window object.
void DrawTitle(const char *string)
static int32 s_testSelection
static void ScrollCallback(GLFWwindow *window, double dx, double dy)
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
#define GLAD_VERSION_MAJOR(version)
void ImGui_ImplGlfw_KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
virtual void KeyboardUp(int key)
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
#define GLAD_VERSION_MINOR(version)
void ShiftMouseDown(const b2Vec2 &p)
void ImGui_ImplGlfw_NewFrame()
bool m_drawContactNormals
static void MouseMotionCallback(GLFWwindow *, double xd, double yd)
#define GLFW_MOD_SHIFT
If this bit is set one or more Shift keys were held down.
IMGUI_API ImGuiIO & GetIO()
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow *window, double xoffset, double yoffset)
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
void Set(float x_, float y_)
Set this vector to some specified coordinates.
bool m_drawContactImpulse
void ImGui_ImplGlfw_CharCallback(GLFWwindow *window, unsigned int c)
IMGUI_API ImGuiContext * CreateContext(ImFontAtlas *shared_font_atlas=NULL)
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
IMGUI_API void Separator()
T b2Clamp(T a, T low, T high)
IMGUI_API void EndTabBar()
GLAD_API_CALL int gladLoadGL(GLADloadfunc load)
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow *window, int value)
Sets the close flag of the specified window.
bool m_enableWarmStarting
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
virtual void Keyboard(int key)
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *format="%d")
static void MouseButtonCallback(GLFWwindow *window, int32 button, int32 action, int32 mods)
virtual void MouseMove(const b2Vec2 &p)
#define GLFW_KEY_RIGHT_BRACKET
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData *draw_data)
GLFWwindow * g_mainWindow
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f)
IMGUI_API void SetNextWindowBgAlpha(float alpha)
static void ResizeWindowCallback(GLFWwindow *, int width, int height)
#define IMGUI_CHECKVERSION()
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
TestEntry g_testEntries[MAX_TESTS]
#define GLFW_OPENGL_CORE_PROFILE
GLFWAPI GLFWmonitor * glfwGetPrimaryMonitor(void)
Returns the primary monitor.
GLFWAPI void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the framebuffer of the specified window.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
int32 major
significant changes
IMGUI_API bool Checkbox(const char *label, bool *v)
static Settings s_settings
void DrawString(int x, int y, const char *string,...)
GLFWAPI void glfwPollEvents(void)
Processes all pending events.
static b2Vec2 s_clickPointWS
virtual void Step(Settings &settings)
virtual void MouseUp(const b2Vec2 &p)
int32 minor
incremental changes
static bool CompareTests(const TestEntry &a, const TestEntry &b)
void ImGui_ImplOpenGL3_Shutdown()
#define GLFW_CONTEXT_VERSION_MINOR
Context client API minor version hint and attribute.
IMGUI_API ImDrawData * GetDrawData()
error
Error code indicating why parse failed.
IMGUI_API bool BeginTabItem(const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
GLFWAPI void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
#define GL_SHADING_LANGUAGE_VERSION
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.
IMGUI_API bool BeginTabBar(const char *str_id, ImGuiTabBarFlags flags=0)
IMGUI_API ImFont * AddFontFromFileTTF(const char *filename, float size_pixels, const ImFontConfig *font_cfg=NULL, const ImWchar *glyph_ranges=NULL)
void ImGui_ImplOpenGL3_NewFrame()