begin refactoring to use square pixels instead of triangles, focusing on functional core first
This commit is contained in:
@@ -1,55 +1,4 @@
|
||||
signature APP_TYPE =
|
||||
sig
|
||||
datatype app_mode = NORMAL_MODE | BROWSE_MODE
|
||||
|
||||
datatype file_browser_item = IS_FILE of string | IS_FOLDER of string
|
||||
|
||||
datatype triangle_stage =
|
||||
NO_TRIANGLE
|
||||
| FIRST of {x1: Real32.real, y1: Real32.real}
|
||||
| SECOND of
|
||||
{x1: Real32.real, x2: Real32.real, y1: Real32.real, y2: Real32.real}
|
||||
|
||||
type triangle =
|
||||
{ x1: Real32.real
|
||||
, x2: Real32.real
|
||||
, x3: Real32.real
|
||||
, y1: Real32.real
|
||||
, y2: Real32.real
|
||||
, y3: Real32.real
|
||||
, r: Real32.real
|
||||
, g: Real32.real
|
||||
, b: Real32.real
|
||||
}
|
||||
|
||||
type app_type =
|
||||
{ mode: app_mode
|
||||
, triangles: triangle list
|
||||
, triangleStage: triangle_stage
|
||||
, windowWidth: int
|
||||
, windowHeight: int
|
||||
, numClickPointsX: int
|
||||
, numClickPointsY: int
|
||||
, xClickPoints: Real32.real vector
|
||||
, yClickPoints: Real32.real vector
|
||||
, undo: (Real32.real * Real32.real) list
|
||||
, redo: (Real32.real * Real32.real) list
|
||||
, showGraph: bool
|
||||
, mouseX: Real32.real
|
||||
, mouseY: Real32.real
|
||||
, arrowX: int
|
||||
, arrowY: int
|
||||
, openFilePath: string
|
||||
, fileBrowser: file_browser_item vector
|
||||
, fileBrowserIdx: int
|
||||
, r: Real32.real
|
||||
, g: Real32.real
|
||||
, b: Real32.real
|
||||
, num: int
|
||||
}
|
||||
end
|
||||
|
||||
structure AppType :> APP_TYPE =
|
||||
structure AppType =
|
||||
struct
|
||||
datatype app_mode = NORMAL_MODE | BROWSE_MODE
|
||||
|
||||
|
||||
@@ -1,73 +1,4 @@
|
||||
signature APP_WITH =
|
||||
sig
|
||||
val graphVisibility: AppType.app_type * bool -> AppType.app_type
|
||||
|
||||
val mode: AppType.app_type * AppType.app_mode -> AppType.app_type
|
||||
|
||||
val windowResize: AppType.app_type * int * int -> AppType.app_type
|
||||
|
||||
val mousePosition: AppType.app_type * Real32.real * Real32.real
|
||||
-> AppType.app_type
|
||||
|
||||
val fileBrowserAndPath:
|
||||
AppType.app_type * AppType.file_browser_item vector * string
|
||||
-> AppType.app_type
|
||||
|
||||
val fileBrowserIdx: AppType.app_type * int -> AppType.app_type
|
||||
|
||||
val arrowX: AppType.app_type * int -> AppType.app_type
|
||||
val arrowY: AppType.app_type * int -> AppType.app_type
|
||||
|
||||
val undo:
|
||||
AppType.app_type
|
||||
* AppType.triangle_stage
|
||||
* AppType.triangle list
|
||||
* (Real32.real * Real32.real)
|
||||
-> AppType.app_type
|
||||
|
||||
val redo:
|
||||
AppType.app_type
|
||||
* AppType.triangle_stage
|
||||
* AppType.triangle list
|
||||
* (Real32.real * Real32.real)
|
||||
-> AppType.app_type
|
||||
|
||||
(*
|
||||
* add functions clear the redo stack,
|
||||
* as they are meant to be called after a click action,
|
||||
* and also add new click position to undo stack.
|
||||
*)
|
||||
val addTriangleStage:
|
||||
AppType.app_type
|
||||
* AppType.triangle_stage
|
||||
* (Real32.real * Real32.real)
|
||||
* int
|
||||
* int
|
||||
-> AppType.app_type
|
||||
|
||||
val addTriangle:
|
||||
AppType.app_type
|
||||
* Real32.real
|
||||
* Real32.real
|
||||
* Real32.real
|
||||
* Real32.real
|
||||
* Real32.real
|
||||
* Real32.real
|
||||
* (Real32.real * Real32.real)
|
||||
* int
|
||||
* int
|
||||
-> AppType.app_type
|
||||
|
||||
val useTrianglesAndSetNormalMode: AppType.app_type * AppType.triangle list
|
||||
-> AppType.app_type
|
||||
|
||||
val num: AppType.app_type * int -> AppType.app_type
|
||||
val r: AppType.app_type -> AppType.app_type
|
||||
val g: AppType.app_type -> AppType.app_type
|
||||
val b: AppType.app_type -> AppType.app_type
|
||||
end
|
||||
|
||||
structure AppWith :> APP_WITH =
|
||||
structure AppWith =
|
||||
struct
|
||||
open AppType
|
||||
|
||||
|
||||
Reference in New Issue
Block a user