diff --git a/dotscape b/dotscape index 3d1157d..ef87736 100755 Binary files a/dotscape and b/dotscape differ diff --git a/ffi/export.h b/ffi/export.h index c4487b8..a18c4d2 100644 --- a/ffi/export.h +++ b/ffi/export.h @@ -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 diff --git a/ffi/glfw-input.c b/ffi/glfw-input.c index bb3ba30..296bf10 100644 --- a/ffi/glfw-input.c +++ b/ffi/glfw-input.c @@ -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) { diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index 608fc64..87b7126 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -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; diff --git a/functional-core/app-update.sml b/functional-core/app-update.sml index 01fc568..66d3b19 100644 --- a/functional-core/app-update.sml +++ b/functional-core/app-update.sml @@ -90,7 +90,7 @@ struct *) fun getClickPos (mouseX, mouseY, r, g, b) = getHorizontalClickPos - (0, Real32.fromInt mouseX, Real32.fromInt mouseY, r, g, b) + (0, mouseX, mouseY, r, g, b) end fun getFirstTriangleStageVector (x1, y1, drawVec) = diff --git a/imperative-shell/event-loop.sml b/imperative-shell/event-loop.sml index bcbcffc..9da3932 100644 --- a/imperative-shell/event-loop.sml +++ b/imperative-shell/event-loop.sml @@ -15,7 +15,7 @@ struct end in fun update (inputMailbox, drawMailbox) = - loop (inputMailbox, drawMailbox, 0, 0, AppType.initial) + loop (inputMailbox, drawMailbox, 0.0, 0.0, AppType.initial) end fun draw diff --git a/message-types/input-msg.sml b/message-types/input-msg.sml index d15c69f..7b2ebac 100644 --- a/message-types/input-msg.sml +++ b/message-types/input-msg.sml @@ -1,7 +1,7 @@ signature INPUT_MESSAGE = sig datatype t = - MOUSE_MOVE of {x: int, y: int} + MOUSE_MOVE of {x: Real32.real, y: Real32.real} | MOUSE_LEFT_CLICK | MOUSE_LEFT_RELEASE end @@ -9,7 +9,7 @@ end structure InputMessage :> INPUT_MESSAGE = struct datatype t = - MOUSE_MOVE of {x: int, y: int} + MOUSE_MOVE of {x: Real32.real, y: Real32.real} | MOUSE_LEFT_CLICK | MOUSE_LEFT_RELEASE end