internal/glfw/glfw: refactoring: reduce files

This commit is contained in:
Hajime Hoshi 2023-07-07 23:52:56 +09:00
parent 0db860b5dd
commit eba8713c64
8 changed files with 125 additions and 128 deletions

View File

@ -1,3 +0,0 @@
#include "_cgo_export.h"
void glfwSetErrorCallbackCB() { glfwSetErrorCallback((GLFWerrorfun)goErrorCB); }

View File

@ -2,9 +2,14 @@
package glfw
//#define GLFW_INCLUDE_NONE
//#include "glfw/include/GLFW/glfw3.h"
//void glfwSetErrorCallbackCB();
// #define GLFW_INCLUDE_NONE
// #include "glfw/include/GLFW/glfw3.h"
//
// void goErrorCB(int code, char* desc);
//
// static void glfwSetErrorCallbackCB() {
// glfwSetErrorCallback((GLFWerrorfun)goErrorCB);
// }
import "C"
import (

View File

@ -1,33 +0,0 @@
#include "_cgo_export.h"
void glfwSetKeyCallbackCB(GLFWwindow *window) {
glfwSetKeyCallback(window, (GLFWkeyfun)goKeyCB);
}
void glfwSetCharCallbackCB(GLFWwindow *window) {
glfwSetCharCallback(window, (GLFWcharfun)goCharCB);
}
void glfwSetCharModsCallbackCB(GLFWwindow *window) {
glfwSetCharModsCallback(window, (GLFWcharmodsfun)goCharModsCB);
}
void glfwSetMouseButtonCallbackCB(GLFWwindow *window) {
glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)goMouseButtonCB);
}
void glfwSetCursorPosCallbackCB(GLFWwindow *window) {
glfwSetCursorPosCallback(window, (GLFWcursorposfun)goCursorPosCB);
}
void glfwSetCursorEnterCallbackCB(GLFWwindow *window) {
glfwSetCursorEnterCallback(window, (GLFWcursorenterfun)goCursorEnterCB);
}
void glfwSetScrollCallbackCB(GLFWwindow *window) {
glfwSetScrollCallback(window, (GLFWscrollfun)goScrollCB);
}
void glfwSetDropCallbackCB(GLFWwindow *window) {
glfwSetDropCallback(window, (GLFWdropfun)goDropCB);
}

View File

@ -2,17 +2,50 @@
package glfw
//#include <stdlib.h>
//#define GLFW_INCLUDE_NONE
//#include "glfw/include/GLFW/glfw3.h"
//void glfwSetKeyCallbackCB(GLFWwindow *window);
//void glfwSetCharCallbackCB(GLFWwindow *window);
//void glfwSetCharModsCallbackCB(GLFWwindow *window);
//void glfwSetMouseButtonCallbackCB(GLFWwindow *window);
//void glfwSetCursorPosCallbackCB(GLFWwindow *window);
//void glfwSetCursorEnterCallbackCB(GLFWwindow *window);
//void glfwSetScrollCallbackCB(GLFWwindow *window);
//void glfwSetDropCallbackCB(GLFWwindow *window);
// #include <stdlib.h>
// #define GLFW_INCLUDE_NONE
// #include "glfw/include/GLFW/glfw3.h"
//
// void goKeyCB(void* window, int key, int scancode, int action, int mods);
// void goCharCB(void* window, unsigned int character);
// void goCharModsCB(void* window, unsigned int character, int mods);
// void goMouseButtonCB(void* window, int button, int action, int mods);
// void goCursorPosCB(void* window, double xpos, double ypos);
// void goCursorEnterCB(void* window, int entered);
// void goScrollCB(void* window, double xoff, double yoff);
// void goDropCB(void* window, int count, char** names);
//
// static void glfwSetKeyCallbackCB(GLFWwindow *window) {
// glfwSetKeyCallback(window, (GLFWkeyfun)goKeyCB);
// }
//
// static void glfwSetCharCallbackCB(GLFWwindow *window) {
// glfwSetCharCallback(window, (GLFWcharfun)goCharCB);
// }
//
// static void glfwSetCharModsCallbackCB(GLFWwindow *window) {
// glfwSetCharModsCallback(window, (GLFWcharmodsfun)goCharModsCB);
// }
//
// static void glfwSetMouseButtonCallbackCB(GLFWwindow *window) {
// glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)goMouseButtonCB);
// }
//
// static void glfwSetCursorPosCallbackCB(GLFWwindow *window) {
// glfwSetCursorPosCallback(window, (GLFWcursorposfun)goCursorPosCB);
// }
//
// static void glfwSetCursorEnterCallbackCB(GLFWwindow *window) {
// glfwSetCursorEnterCallback(window, (GLFWcursorenterfun)goCursorEnterCB);
// }
//
// static void glfwSetScrollCallbackCB(GLFWwindow *window) {
// glfwSetScrollCallback(window, (GLFWscrollfun)goScrollCB);
// }
//
// static void glfwSetDropCallbackCB(GLFWwindow *window) {
// glfwSetDropCallback(window, (GLFWdropfun)goDropCB);
// }
import "C"
import (

View File

@ -1,19 +0,0 @@
#include "_cgo_export.h"
GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) {
return monitors[index];
}
GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) {
return vidmodes[index];
}
void glfwSetMonitorCallbackCB() {
glfwSetMonitorCallback((GLFWmonitorfun)goMonitorCB);
}
unsigned int GetGammaAtIndex(unsigned short *color, int i) { return color[i]; }
void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) {
color[i] = value;
}

View File

@ -2,13 +2,30 @@
package glfw
//#define GLFW_INCLUDE_NONE
//#include "glfw/include/GLFW/glfw3.h"
//GLFWmonitor* GetMonitorAtIndex(GLFWmonitor **monitors, int index);
//GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index);
//void glfwSetMonitorCallbackCB();
//unsigned int GetGammaAtIndex(unsigned short *color, int i);
//void SetGammaAtIndex(unsigned short *color, int i, unsigned short value);
// #define GLFW_INCLUDE_NONE
// #include "glfw/include/GLFW/glfw3.h"
//
// void goMonitorCB(void* monitor, int event);
//
// static GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) {
// return monitors[index];
// }
//
// static GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) {
// return vidmodes[index];
// }
//
// static void glfwSetMonitorCallbackCB() {
// glfwSetMonitorCallback((GLFWmonitorfun)goMonitorCB);
// }
//
// static unsigned int GetGammaAtIndex(unsigned short *color, int i) {
// return color[i];
// }
//
// static void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) {
// color[i] = value;
// }
import "C"
import (

View File

@ -1,40 +0,0 @@
#include "_cgo_export.h"
void glfwSetWindowPosCallbackCB(GLFWwindow *window) {
glfwSetWindowPosCallback(window, (GLFWwindowposfun)goWindowPosCB);
}
void glfwSetWindowSizeCallbackCB(GLFWwindow *window) {
glfwSetWindowSizeCallback(window, (GLFWwindowsizefun)goWindowSizeCB);
}
void glfwSetWindowCloseCallbackCB(GLFWwindow *window) {
glfwSetWindowCloseCallback(window, (GLFWwindowclosefun)goWindowCloseCB);
}
void glfwSetWindowRefreshCallbackCB(GLFWwindow *window) {
glfwSetWindowRefreshCallback(window, (GLFWwindowrefreshfun)goWindowRefreshCB);
}
void glfwSetWindowFocusCallbackCB(GLFWwindow *window) {
glfwSetWindowFocusCallback(window, (GLFWwindowfocusfun)goWindowFocusCB);
}
void glfwSetWindowIconifyCallbackCB(GLFWwindow *window) {
glfwSetWindowIconifyCallback(window, (GLFWwindowiconifyfun)goWindowIconifyCB);
}
void glfwSetFramebufferSizeCallbackCB(GLFWwindow *window) {
glfwSetFramebufferSizeCallback(window,
(GLFWframebuffersizefun)goFramebufferSizeCB);
}
void glfwSetWindowMaximizeCallbackCB(GLFWwindow *window) {
glfwSetWindowMaximizeCallback(window,
(GLFWwindowmaximizefun)goWindowMaximizeCB);
}
void glfwSetWindowContentScaleCallbackCB(GLFWwindow *window) {
glfwSetWindowContentScaleCallback(
window, (GLFWwindowcontentscalefun)goWindowContentScaleCB);
}

View File

@ -2,18 +2,55 @@
package glfw
//#include <stdlib.h>
//#define GLFW_INCLUDE_NONE
//#include "glfw/include/GLFW/glfw3.h"
//void glfwSetWindowPosCallbackCB(GLFWwindow *window);
//void glfwSetWindowSizeCallbackCB(GLFWwindow *window);
//void glfwSetFramebufferSizeCallbackCB(GLFWwindow *window);
//void glfwSetWindowCloseCallbackCB(GLFWwindow *window);
//void glfwSetWindowRefreshCallbackCB(GLFWwindow *window);
//void glfwSetWindowFocusCallbackCB(GLFWwindow *window);
//void glfwSetWindowIconifyCallbackCB(GLFWwindow *window);
//void glfwSetWindowMaximizeCallbackCB(GLFWwindow *window);
//void glfwSetWindowContentScaleCallbackCB(GLFWwindow *window);
// #include <stdlib.h>
// #define GLFW_INCLUDE_NONE
// #include "glfw/include/GLFW/glfw3.h"
//
// void goWindowPosCB(void* window, int xpos, int ypos);
// void goWindowSizeCB(void* window, int width, int height);
// void goWindowCloseCB(void* window);
// void goWindowRefreshCB(void* window);
// void goWindowFocusCB(void* window, int focused);
// void goWindowIconifyCB(void* window, int iconified);
// void goFramebufferSizeCB(void* window, int width, int height);
// void goWindowMaximizeCB(void* window, int maximized);
// void goWindowContentScaleCB(void* window, float x, float y);
//
// static void glfwSetWindowPosCallbackCB(GLFWwindow *window) {
// glfwSetWindowPosCallback(window, (GLFWwindowposfun)goWindowPosCB);
// }
//
// static void glfwSetWindowSizeCallbackCB(GLFWwindow *window) {
// glfwSetWindowSizeCallback(window, (GLFWwindowsizefun)goWindowSizeCB);
// }
//
// static void glfwSetWindowCloseCallbackCB(GLFWwindow *window) {
// glfwSetWindowCloseCallback(window, (GLFWwindowclosefun)goWindowCloseCB);
// }
//
// static void glfwSetWindowRefreshCallbackCB(GLFWwindow *window) {
// glfwSetWindowRefreshCallback(window, (GLFWwindowrefreshfun)goWindowRefreshCB);
// }
//
// static void glfwSetWindowFocusCallbackCB(GLFWwindow *window) {
// glfwSetWindowFocusCallback(window, (GLFWwindowfocusfun)goWindowFocusCB);
// }
//
// static void glfwSetWindowIconifyCallbackCB(GLFWwindow *window) {
// glfwSetWindowIconifyCallback(window, (GLFWwindowiconifyfun)goWindowIconifyCB);
// }
//
// static void glfwSetFramebufferSizeCallbackCB(GLFWwindow *window) {
// glfwSetFramebufferSizeCallback(window, (GLFWframebuffersizefun)goFramebufferSizeCB);
// }
//
// static void glfwSetWindowMaximizeCallbackCB(GLFWwindow *window) {
// glfwSetWindowMaximizeCallback(window, (GLFWwindowmaximizefun)goWindowMaximizeCB);
// }
//
// static void glfwSetWindowContentScaleCallbackCB(GLFWwindow *window) {
// glfwSetWindowContentScaleCallback(window, (GLFWwindowcontentscalefun)goWindowContentScaleCB);
// }
import "C"
import (