74 lines
1.4 KiB
Odin
74 lines
1.4 KiB
Odin
package main
|
||
|
||
import rl "vendor:raylib"
|
||
import "core:slice"
|
||
import "core:fmt"
|
||
|
||
Vec2 :: [2]f32
|
||
Vec2i :: [2]i32
|
||
|
||
WINDOW : Vec2i
|
||
WINDOWF : Vec2
|
||
|
||
|
||
main :: proc() {
|
||
rl.SetConfigFlags(rl.ConfigFlags{.FULLSCREEN_MODE, .VSYNC_HINT, .WINDOW_MAXIMIZED, .WINDOW_UNDECORATED})
|
||
monitor := rl.GetCurrentMonitor()
|
||
rl.InitWindow(0, 0, "SinePong")
|
||
rl.SetTargetFPS(9999)
|
||
|
||
WINDOW.x = rl.GetScreenWidth()
|
||
WINDOW.y = rl.GetScreenHeight()
|
||
WINDOWF = Vec2{f32(WINDOW.x), f32(WINDOW.y)}
|
||
|
||
stack_init()
|
||
|
||
defer {
|
||
for s, i in state_stack {
|
||
free(s)
|
||
}
|
||
}
|
||
|
||
game := game_init()
|
||
append(&state_stack, game)
|
||
|
||
for (!rl.WindowShouldClose()) {
|
||
if rl.IsWindowResized() {
|
||
WINDOW.x = rl.GetScreenWidth()
|
||
WINDOW.y = rl.GetScreenHeight()
|
||
WINDOWF = Vec2{f32(WINDOW.x), f32(WINDOW.y)}
|
||
}
|
||
|
||
current_state := state_stack[len(state_stack)-1]
|
||
|
||
delta := rl.GetFrameTime()
|
||
|
||
current_state->update(delta)
|
||
|
||
{
|
||
rl.BeginDrawing()
|
||
defer rl.EndDrawing()
|
||
current_state->draw()
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
/*
|
||
|
||
TODO:
|
||
[ ] Уничтожение биты от попадания кирпича
|
||
[ ] Проверка завершения уровня
|
||
[ ] Генерация уровней
|
||
[ ] (Опционально) редактор уровней с сохранением в файл
|
||
[ ] Меню
|
||
[ ] Гейм овер
|
||
[ ] Бонусы
|
||
[ ] Визуальное оформление
|
||
[ ] Интерфейс игры
|
||
[ ] Звуки
|
||
|
||
*/
|