Init
This commit is contained in:
116
glfw/impl_glfw.cpp
Normal file
116
glfw/impl_glfw.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.
|
||||
// **DO NOT EDIT DIRECTLY**
|
||||
// https://github.com/dearimgui/dear_bindings
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_glfw.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// Wrap this in a namespace to keep it separate from the C++ API
|
||||
namespace cimgui
|
||||
{
|
||||
#include "impl_glfw.h"
|
||||
}
|
||||
|
||||
// By-value struct conversions
|
||||
|
||||
// Function stubs
|
||||
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
CIMGUI_IMPL_API bool cimgui::cImGui_ImplGlfw_InitForOpenGL(cimgui::GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
return ::ImGui_ImplGlfw_InitForOpenGL(reinterpret_cast<::GLFWwindow*>(window), install_callbacks);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API bool cimgui::cImGui_ImplGlfw_InitForVulkan(cimgui::GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
return ::ImGui_ImplGlfw_InitForVulkan(reinterpret_cast<::GLFWwindow*>(window), install_callbacks);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API bool cimgui::cImGui_ImplGlfw_InitForOther(cimgui::GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
return ::ImGui_ImplGlfw_InitForOther(reinterpret_cast<::GLFWwindow*>(window), install_callbacks);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_Shutdown(void)
|
||||
{
|
||||
::ImGui_ImplGlfw_Shutdown();
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_NewFrame(void)
|
||||
{
|
||||
::ImGui_ImplGlfw_NewFrame();
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_InstallEmscriptenCallbacks(cimgui::GLFWwindow* window, const char* canvas_selector)
|
||||
{
|
||||
::ImGui_ImplGlfw_InstallEmscriptenCallbacks(reinterpret_cast<::GLFWwindow*>(window), canvas_selector);
|
||||
}
|
||||
|
||||
#endif // #ifdef __EMSCRIPTEN__
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_InstallCallbacks(cimgui::GLFWwindow* window)
|
||||
{
|
||||
::ImGui_ImplGlfw_InstallCallbacks(reinterpret_cast<::GLFWwindow*>(window));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_RestoreCallbacks(cimgui::GLFWwindow* window)
|
||||
{
|
||||
::ImGui_ImplGlfw_RestoreCallbacks(reinterpret_cast<::GLFWwindow*>(window));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows)
|
||||
{
|
||||
::ImGui_ImplGlfw_SetCallbacksChainForAllWindows(chain_for_all_windows);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_WindowFocusCallback(cimgui::GLFWwindow* window, int focused)
|
||||
{
|
||||
::ImGui_ImplGlfw_WindowFocusCallback(reinterpret_cast<::GLFWwindow*>(window), focused);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_CursorEnterCallback(cimgui::GLFWwindow* window, int entered)
|
||||
{
|
||||
::ImGui_ImplGlfw_CursorEnterCallback(reinterpret_cast<::GLFWwindow*>(window), entered);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_CursorPosCallback(cimgui::GLFWwindow* window, double x, double y)
|
||||
{
|
||||
::ImGui_ImplGlfw_CursorPosCallback(reinterpret_cast<::GLFWwindow*>(window), x, y);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_MouseButtonCallback(cimgui::GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
::ImGui_ImplGlfw_MouseButtonCallback(reinterpret_cast<::GLFWwindow*>(window), button, action, mods);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_ScrollCallback(cimgui::GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
::ImGui_ImplGlfw_ScrollCallback(reinterpret_cast<::GLFWwindow*>(window), xoffset, yoffset);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_KeyCallback(cimgui::GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
::ImGui_ImplGlfw_KeyCallback(reinterpret_cast<::GLFWwindow*>(window), key, scancode, action, mods);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_CharCallback(cimgui::GLFWwindow* window, unsigned int c)
|
||||
{
|
||||
::ImGui_ImplGlfw_CharCallback(reinterpret_cast<::GLFWwindow*>(window), c);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_MonitorCallback(cimgui::GLFWmonitor* monitor, int event)
|
||||
{
|
||||
::ImGui_ImplGlfw_MonitorCallback(reinterpret_cast<::GLFWmonitor*>(monitor), event);
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplGlfw_Sleep(int milliseconds)
|
||||
{
|
||||
::ImGui_ImplGlfw_Sleep(milliseconds);
|
||||
}
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
73
glfw/impl_glfw.h
Normal file
73
glfw/impl_glfw.h
Normal file
@@ -0,0 +1,73 @@
|
||||
// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.
|
||||
// **DO NOT EDIT DIRECTLY**
|
||||
// https://github.com/dearimgui/dear_bindings
|
||||
|
||||
// dear imgui: Platform Backend for GLFW
|
||||
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
|
||||
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
|
||||
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Resizing cursors requires GLFW 3.4+! Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "../dcimgui.h"
|
||||
#ifndef IMGUI_DISABLE
|
||||
typedef struct GLFWwindow GLFWwindow;
|
||||
typedef struct GLFWmonitor GLFWmonitor;
|
||||
|
||||
typedef struct ImDrawData_t ImDrawData;
|
||||
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
|
||||
CIMGUI_IMPL_API bool cImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
|
||||
CIMGUI_IMPL_API bool cImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
|
||||
CIMGUI_IMPL_API bool cImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_Shutdown(void);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_NewFrame(void);
|
||||
|
||||
// Emscripten related initialization phase methods (call after ImGui_ImplGlfw_InitForOpenGL)
|
||||
#ifdef __EMSCRIPTEN__
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_InstallEmscriptenCallbacks(GLFWwindow* window, const char* canvas_selector);
|
||||
//static inline void ImGui_ImplGlfw_InstallEmscriptenCanvasResizeCallback(const char* canvas_selector) { ImGui_ImplGlfw_InstallEmscriptenCallbacks(nullptr, canvas_selector); } } // Renamed in 1.91.0
|
||||
#endif // #ifdef __EMSCRIPTEN__
|
||||
// GLFW callbacks install
|
||||
// - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
|
||||
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window);
|
||||
|
||||
// GFLW callbacks options:
|
||||
// - Set 'chain_for_all_windows=true' to enable chaining callbacks for all windows (including secondary viewports created by backends or by user)
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows);
|
||||
|
||||
// GLFW callbacks (individual callbacks to call yourself if you didn't install callbacks)
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
|
||||
|
||||
// GLFW helpers
|
||||
CIMGUI_IMPL_API void cImGui_ImplGlfw_Sleep(int milliseconds);
|
||||
#endif// #ifndef IMGUI_DISABLE
|
||||
#ifdef __cplusplus
|
||||
} // End of extern "C" block
|
||||
#endif
|
||||
36
glfw/impl_glfw.odin
Normal file
36
glfw/impl_glfw.odin
Normal file
@@ -0,0 +1,36 @@
|
||||
package imgui_glfw
|
||||
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import imgui_glfw "../lib/dcimgui_impl_glfw.lib"
|
||||
}
|
||||
else when ODIN_OS == .Linux {
|
||||
foreign import imgui_glfw "../lib/linux/libdcimgui_impl_glfw.a"
|
||||
}
|
||||
else when ODIN_OS == .Darwin {
|
||||
foreign import imgui_glfw "../lib/darwin/libdcimgui_impl_glfw_arm64.a"
|
||||
}
|
||||
|
||||
import glfw "vendor:glfw"
|
||||
|
||||
@(default_calling_convention = "cdecl", link_prefix = "cImGui_ImplGlfw_")
|
||||
foreign imgui_glfw {
|
||||
InitForOpenGL :: proc(window: glfw.WindowHandle, install_callbacks: b32) -> b32 ---
|
||||
InitForVulkan :: proc(window: glfw.WindowHandle, install_callbacks: b32) -> b32 ---
|
||||
InitForOther :: proc(window: glfw.WindowHandle, install_callbacks: b32) -> b32 ---
|
||||
Shutdown :: proc() ---
|
||||
NewFrame :: proc() ---
|
||||
InstallEmscriptenCallbacks :: proc(window: glfw.WindowHandle, canvas_selector: cstring) ---
|
||||
InstallCallbacks :: proc(window: glfw.WindowHandle) ---
|
||||
RestoreCallbacks :: proc(window: glfw.WindowHandle) ---
|
||||
SetCallbacksChainForAllWindows :: proc(chain_for_all_windows: b32) ---
|
||||
WindowFocusCallback :: proc(window: glfw.WindowHandle, focused: i32) ---
|
||||
CursorEnterCallback :: proc(window: glfw.WindowHandle, entered: i32) ---
|
||||
CursorPosCallback :: proc(window: glfw.WindowHandle, x: f64, y: f64) ---
|
||||
MouseButtonCallback :: proc(window: glfw.WindowHandle, button: i32, action: i32, mods: i32) ---
|
||||
ScrollCallback :: proc(window: glfw.WindowHandle, xoffset: f64, yoffset: f64) ---
|
||||
KeyCallback :: proc(window: glfw.WindowHandle, key: i32, scancode: i32, action: i32, mods: i32) ---
|
||||
CharCallback :: proc(window: glfw.WindowHandle, c: u32) ---
|
||||
MonitorCallback :: proc(monitor: glfw.MonitorHandle, event: i32) ---
|
||||
Sleep :: proc(milliseconds: i32) ---
|
||||
}
|
||||
Reference in New Issue
Block a user