reduce number of type conversoins required for mouse move callback (and fix the other code which uses it too)
This commit is contained in:
@@ -157,7 +157,7 @@ typedef Pointer Objptr;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
MLLIB_PUBLIC(void mltonMouseMoveCallback (Int32 x0, Int32 x1);)
|
||||
MLLIB_PUBLIC(void mltonMouseMoveCallback (Real32 x0, Real32 x1);)
|
||||
MLLIB_PUBLIC(void mltonMouseClickCallback (Int32 x0, Int32 x1);)
|
||||
|
||||
#undef MLLIB_PRIVATE
|
||||
|
||||
@@ -7,7 +7,7 @@ int LEFT_MOUSE_BUTTON = GLFW_MOUSE_BUTTON_1;
|
||||
|
||||
// Calls function exported from SML
|
||||
void mouseMoveCallback(GLFWwindow *window, double xpos, double ypos) {
|
||||
mltonMouseMoveCallback((int)xpos, (int)ypos);
|
||||
mltonMouseMoveCallback((float)xpos, (float)ypos);
|
||||
}
|
||||
|
||||
void mouseClickCallback(GLFWwindow *window, int button, int action, int mods) {
|
||||
|
||||
@@ -4,7 +4,7 @@ struct
|
||||
|
||||
(* Export function to C. *)
|
||||
val exportMouseMoveCallback =
|
||||
_export "mltonMouseMoveCallback" public : (int * int -> unit) -> unit;
|
||||
_export "mltonMouseMoveCallback" public : (Real32.real * Real32.real -> unit) -> unit;
|
||||
|
||||
(* Import function to set callback for GLFW. *)
|
||||
val setMouseMoveCallback = _import "setMouseMoveCallback" public reentrant : window -> unit;
|
||||
|
||||
Reference in New Issue
Block a user