progress adding ability to change colour of triangle

This commit is contained in:
2024-12-30 03:41:11 +00:00
parent b41cb87b41
commit 5dde0517cc
6 changed files with 30 additions and 1 deletions

BIN
dotscape

Binary file not shown.

View File

@@ -6,7 +6,11 @@ int PRESS = GLFW_PRESS;
int RELEASE = GLFW_RELEASE;
int LEFT_MOUSE_BUTTON = GLFW_MOUSE_BUTTON_1;
int KEY_R = GLFW_KEY_R;
int KEY_G = GLFW_KEY_G;
int KEY_B = GLFW_KEY_B;
int KEY_T = GLFW_KEY_T;
int KEY_Y = GLFW_KEY_Y;
int KEY_Z = GLFW_KEY_Z;

View File

@@ -31,8 +31,15 @@ struct
_export "mltonKeyCallback" public : (int * int * int * int -> unit) -> unit;
val setKeyCallback = _import "setKeyCallback" public reentrant : window -> unit;
val (KEY_R, _) =
_symbol "KEY_R" public : ( unit -> int ) * ( int -> unit );
val (KEY_G, _) =
_symbol "KEY_G" public : ( unit -> int ) * ( int -> unit );
val (KEY_B, _) =
_symbol "KEY_B" public : ( unit -> int ) * ( int -> unit );
val (KEY_T, _) =
_symbol "KEY_T" public : ( unit -> int ) * ( int -> unit );
val (KEY_Y, _) =
_symbol "KEY_Y" public : ( unit -> int ) * ( int -> unit );
val (KEY_Z, _) =

View File

@@ -412,7 +412,7 @@ struct
| RESIZE_WINDOW {width, height} => resizeWindow (model, width, height)
| UNDO_ACTION => undoAction model
| REDO_ACTION => redoAction model
| KEY_G => toggleGraph model
| KEY_T => toggleGraph model
| KEY_CTRL_S => getSaveTrianglesMsg model
| KEY_CTRL_L => getLoadTrianglesMsg model
| KEY_CTRL_E => getExportTrianglesMsg model

View File

@@ -37,10 +37,22 @@ struct
andalso mods = 0x0002
then
Mailbox.send (mailbox, REDO_ACTION)
else if
key = Input.KEY_R () andalso action <> Input.RELEASE () andalso mods = 0x0
then
Mailbox.send (mailbox, KEY_R)
else if
key = Input.KEY_G () andalso action <> Input.RELEASE () andalso mods = 0x0
then
Mailbox.send (mailbox, KEY_G)
else if
key = Input.KEY_B () andalso action <> Input.RELEASE () andalso mods = 0x0
then
Mailbox.send (mailbox, KEY_B)
else if
key = Input.KEY_T () andalso action <> Input.RELEASE () andalso mods = 0x0
then
Mailbox.send (mailbox, KEY_T)
else if
(* ctrl-s *)
key = Input.KEY_S () andalso action = Input.PRESS () andalso mods = 0x002

View File

@@ -7,7 +7,10 @@ sig
| RESIZE_WINDOW of {width: int, height: int}
| UNDO_ACTION
| REDO_ACTION
| KEY_R
| KEY_G
| KEY_B
| KEY_T
| KEY_CTRL_S
| KEY_CTRL_L
| KEY_CTRL_E
@@ -32,7 +35,10 @@ struct
| RESIZE_WINDOW of {width: int, height: int}
| UNDO_ACTION
| REDO_ACTION
| KEY_R
| KEY_G
| KEY_B
| KEY_T
| KEY_CTRL_S
| KEY_CTRL_L
| KEY_CTRL_E