Arkadodge/main.odin

95 lines
2.0 KiB
Odin
Raw Normal View History

2024-09-04 22:43:27 +03:00
package main
import rl "vendor:raylib"
2024-09-09 00:18:35 +03:00
import rlgl "vendor:raylib/rlgl"
2024-09-05 22:39:52 +03:00
import "core:slice"
2024-09-05 23:42:18 +03:00
import "core:fmt"
2024-09-04 22:43:27 +03:00
2024-09-09 00:18:35 +03:00
import "core:math/ease"
2024-09-04 22:43:27 +03:00
Vec2 :: [2]f32
Vec2i :: [2]i32
2024-09-05 23:42:18 +03:00
WINDOW : Vec2i
WINDOWF : Vec2
2024-09-05 22:39:52 +03:00
2024-09-09 00:18:35 +03:00
FontTitle : rl.Font
FontUI: rl.Font
WindowShouldExit := false
2024-09-04 22:43:27 +03:00
main :: proc() {
2024-09-09 23:41:16 +03:00
rl.SetConfigFlags(rl.ConfigFlags{.FULLSCREEN_MODE, .VSYNC_HINT, })
2024-09-05 22:39:52 +03:00
monitor := rl.GetCurrentMonitor()
2024-09-05 23:42:18 +03:00
rl.InitWindow(0, 0, "SinePong")
2024-09-05 22:39:52 +03:00
rl.SetTargetFPS(9999)
2024-09-09 00:18:35 +03:00
tween_init()
defer tween_clean()
FontUI = rl.LoadFontEx("assets/monogram-extended.ttf", 96, nil, 2048)
// FontUI = rl.LoadFont("assets/monogram-extended.ttf")
FontTitle = rl.LoadFontEx("assets/monogram-extended.ttf", 96*2, nil, 2048)
defer rl.UnloadFont(FontTitle)
defer rl.UnloadFont(FontUI)
rl.SetTextureFilter(FontUI.texture, rl.TextureFilter.POINT)
rl.SetTextureFilter(FontTitle.texture, rl.TextureFilter.POINT)
2024-09-05 23:42:18 +03:00
WINDOW.x = rl.GetScreenWidth()
WINDOW.y = rl.GetScreenHeight()
WINDOWF = Vec2{f32(WINDOW.x), f32(WINDOW.y)}
2024-09-05 22:39:52 +03:00
stack_init()
defer {
2024-09-09 00:18:35 +03:00
for state, i in state_stack {
state->free()
2024-09-05 22:39:52 +03:00
}
}
game := game_init()
2024-09-09 00:18:35 +03:00
menu := menu_init()
append(&state_stack, menu)
2024-09-05 22:39:52 +03:00
2024-09-09 00:18:35 +03:00
for (!WindowShouldExit) {
2024-09-05 22:39:52 +03:00
if rl.IsWindowResized() {
2024-09-05 23:42:18 +03:00
WINDOW.x = rl.GetScreenWidth()
WINDOW.y = rl.GetScreenHeight()
WINDOWF = Vec2{f32(WINDOW.x), f32(WINDOW.y)}
2024-09-05 22:39:52 +03:00
}
current_state := state_stack[len(state_stack)-1]
delta := rl.GetFrameTime()
2024-09-09 00:18:35 +03:00
tweens_process(delta)
2024-09-05 22:39:52 +03:00
current_state->update(delta)
{
rl.BeginDrawing()
defer rl.EndDrawing()
2024-09-09 00:18:35 +03:00
rl.ClearBackground(rl.Color{40, 10, 90, 255})
2024-09-05 22:39:52 +03:00
current_state->draw()
2024-09-09 00:18:35 +03:00
rlgl.PopMatrix()
2024-09-05 22:39:52 +03:00
}
}
2024-09-04 22:43:27 +03:00
}
2024-09-08 03:39:03 +03:00
2024-09-09 23:41:16 +03:00
2024-09-08 03:39:03 +03:00
/*
TODO:
[ ] Уничтожение биты от попадания кирпича
[ ] Проверка завершения уровня
[ ] Генерация уровней
[ ] (Опционально) редактор уровней с сохранением в файл
2024-09-09 23:41:16 +03:00
[x] Меню
2024-09-08 03:39:03 +03:00
[ ] Гейм овер
[ ] Бонусы
[ ] Визуальное оформление
[ ] Интерфейс игры
[ ] Звуки
*/