63 lines
1.5 KiB
Odin
63 lines
1.5 KiB
Odin
package main
|
||
|
||
import rl "vendor:raylib"
|
||
import "core:math/ease"
|
||
|
||
|
||
Howtoplay :: struct {
|
||
using state: GameState,
|
||
}
|
||
|
||
howtoplay_init :: proc(prev: ^GameState = nil) -> ^GameState {
|
||
state := new(Howtoplay)
|
||
state.variant = state
|
||
state.update = howtoplay_update
|
||
state.draw = howtoplay_draw
|
||
state.free = howtoplay_free
|
||
state.previous = prev
|
||
|
||
return state
|
||
}
|
||
|
||
howtoplay_update :: proc(state: ^GameState, delta: f32) {
|
||
howtoplay := transmute(^Howtoplay)state
|
||
if rl.IsKeyPressed(rl.KeyboardKey.ESCAPE) {
|
||
stack_pop()
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
howtoplay_draw :: proc(state: ^GameState) {
|
||
howtoplay := transmute(^Howtoplay)state
|
||
|
||
TitleFontSize :: 96
|
||
TitleSpacing :: 3
|
||
TitleText :: "ARKADODGE"
|
||
TitleSize := rl.MeasureTextEx(FontTitle, TitleText, TitleFontSize, TitleSpacing)
|
||
rl.DrawTextPro(FontTitle, "ARKADODGE", {WINDOWF.x - 50, 50}, {TitleSize.x, 0}, 0, 96, 3, rl.WHITE)
|
||
|
||
Text :: [?]cstring{
|
||
"Используй Пробел для запуска шара",
|
||
"Стрелки для перемещения биты",
|
||
"Не дай шарику упасть вниз!",
|
||
"",
|
||
"Также блоки, падающие на биту, уменьшают её здоровье!"
|
||
}
|
||
|
||
for t, y in Text {
|
||
rl.DrawTextPro(FontUI, t, {10, 100 + f32(y) * 38}, {0, 0}, 0, 32, 1, rl.WHITE)
|
||
}
|
||
|
||
for c, t in brick_names {
|
||
y := cast(i32)t
|
||
rl.DrawRectangleV({WINDOWF.x / 2, 100 + f32(y) * 40}, {30, 20}, brick_colors[t])
|
||
rl.DrawTextPro(FontUI, c, {WINDOWF.x / 2 + 40, 100 + f32(y) * 40}, {0, 14}, 0, 32, 2, rl.WHITE)
|
||
}
|
||
}
|
||
|
||
howtoplay_free :: proc(state: ^GameState) {
|
||
free(state)
|
||
}
|