begin function for drawing title screen
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
structure Constants =
|
structure Constants =
|
||||||
struct
|
struct
|
||||||
val fontSpace = 13
|
val fontSpace = 26
|
||||||
val fontSize: Real32.real = 30.0
|
val fontSize: Real32.real = 60.0
|
||||||
|
|
||||||
val worldWidth = 1920
|
val worldWidth = 1920
|
||||||
val worldHeight = 1080
|
val worldHeight = 1080
|
||||||
|
|||||||
23
fcore/title/title-vec.sml
Normal file
23
fcore/title/title-vec.sml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
structure TitleVec =
|
||||||
|
struct
|
||||||
|
val fontSpace = Constants.fontSpace
|
||||||
|
val fontSize = Constants.fontSize
|
||||||
|
|
||||||
|
fun getTextVec (x, y, windowWidth, windowHeight, pos, str, acc) =
|
||||||
|
if pos = String.size str then
|
||||||
|
Vector.concat acc
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val chr = String.sub (str, pos)
|
||||||
|
val chrFun = Vector.sub (CozetteAscii.asciiTable, Char.ord chr)
|
||||||
|
val hd = chrFun
|
||||||
|
(x, y, fontSize, fontSize, windowWidth, windowHeight, 0.0, 0.0, 0.0)
|
||||||
|
val acc = hd :: acc
|
||||||
|
in
|
||||||
|
getTextVec
|
||||||
|
(x + fontSpace, y, windowWidth, windowHeight, pos + 1, str, acc)
|
||||||
|
end
|
||||||
|
|
||||||
|
fun getDrawVec (title: TitleType.title_type, width, height) =
|
||||||
|
getTextVec (555, 55, width, height, 0, "hello world", [])
|
||||||
|
end
|
||||||
4
oms.mlb
4
oms.mlb
@@ -1,8 +1,6 @@
|
|||||||
$(SML_LIB)/basis/basis.mlb
|
$(SML_LIB)/basis/basis.mlb
|
||||||
|
|
||||||
(* fcore *)
|
(* fcore *)
|
||||||
vendored/cozette-sml/fonts/cozette-ascii.mlb
|
|
||||||
|
|
||||||
fcore/constants.sml
|
fcore/constants.sml
|
||||||
fcore/level/collision.sml
|
fcore/level/collision.sml
|
||||||
|
|
||||||
@@ -18,6 +16,7 @@ fcore/bin-vec.sml
|
|||||||
ann
|
ann
|
||||||
"allowVectorExps true"
|
"allowVectorExps true"
|
||||||
in
|
in
|
||||||
|
vendored/cozette-sml/fonts/cozette-ascii.mlb
|
||||||
fcore/block.sml
|
fcore/block.sml
|
||||||
fcore/level/player/player-sprite.sml
|
fcore/level/player/player-sprite.sml
|
||||||
fcore/field.sml
|
fcore/field.sml
|
||||||
@@ -56,6 +55,7 @@ fcore/level/level-update.sml
|
|||||||
|
|
||||||
fcore/title/title-type.sml
|
fcore/title/title-type.sml
|
||||||
fcore/title/title-update.sml
|
fcore/title/title-update.sml
|
||||||
|
fcore/title/title-vec.sml
|
||||||
|
|
||||||
fcore/game-type.sml
|
fcore/game-type.sml
|
||||||
fcore/game-update.sml
|
fcore/game-update.sml
|
||||||
|
|||||||
@@ -250,13 +250,24 @@ struct
|
|||||||
shellState
|
shellState
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun drawTitle (shellState: t, title) =
|
||||||
|
let
|
||||||
|
val width = InputState.getWidth ()
|
||||||
|
val height = InputState.getHeight ()
|
||||||
|
val vec = TitleVec.getDrawVec (title, width, height)
|
||||||
|
val shellState = uploadPlayer (shellState, vec)
|
||||||
|
val () = helpDrawLevel shellState
|
||||||
|
in
|
||||||
|
shellState
|
||||||
|
end
|
||||||
|
|
||||||
fun drawMode (shellState: t, game: GameType.game_type) =
|
fun drawMode (shellState: t, game: GameType.game_type) =
|
||||||
let
|
let
|
||||||
open GameType
|
open GameType
|
||||||
in
|
in
|
||||||
case #mode game of
|
case #mode game of
|
||||||
LEVEL level => drawLevel (shellState, level)
|
LEVEL level => drawLevel (shellState, level)
|
||||||
| TITLE title => shellState
|
| TITLE title => drawTitle (shellState, title)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun helpLoop (shellState as {window, ...}: t, game) =
|
fun helpLoop (shellState as {window, ...}: t, game) =
|
||||||
|
|||||||
Reference in New Issue
Block a user