95 lines
2.0 KiB
Odin
95 lines
2.0 KiB
Odin
package main
|
||
|
||
import rl "vendor:raylib"
|
||
import rlgl "vendor:raylib/rlgl"
|
||
import "core:slice"
|
||
import "core:fmt"
|
||
|
||
import "core:math/ease"
|
||
|
||
Vec2 :: [2]f32
|
||
Vec2i :: [2]i32
|
||
|
||
WINDOW : Vec2i
|
||
WINDOWF : Vec2
|
||
|
||
FontTitle : rl.Font
|
||
FontUI: rl.Font
|
||
|
||
WindowShouldExit := false
|
||
|
||
main :: proc() {
|
||
rl.SetConfigFlags(rl.ConfigFlags{.FULLSCREEN_MODE, .VSYNC_HINT, })
|
||
monitor := rl.GetCurrentMonitor()
|
||
rl.InitWindow(0, 0, "SinePong")
|
||
rl.SetTargetFPS(9999)
|
||
|
||
|
||
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)
|
||
|
||
WINDOW.x = rl.GetScreenWidth()
|
||
WINDOW.y = rl.GetScreenHeight()
|
||
WINDOWF = Vec2{f32(WINDOW.x), f32(WINDOW.y)}
|
||
|
||
stack_init()
|
||
|
||
defer {
|
||
for state, i in state_stack {
|
||
state->free()
|
||
}
|
||
}
|
||
|
||
game := game_init()
|
||
menu := menu_init()
|
||
append(&state_stack, menu)
|
||
|
||
for (!WindowShouldExit) {
|
||
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()
|
||
tweens_process(delta)
|
||
|
||
current_state->update(delta)
|
||
{
|
||
rl.BeginDrawing()
|
||
defer rl.EndDrawing()
|
||
rl.ClearBackground(rl.Color{40, 10, 90, 255})
|
||
current_state->draw()
|
||
rlgl.PopMatrix()
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
|
||
TODO:
|
||
[ ] Уничтожение биты от попадания кирпича
|
||
[ ] Проверка завершения уровня
|
||
[ ] Генерация уровней
|
||
[ ] (Опционально) редактор уровней с сохранением в файл
|
||
[x] Меню
|
||
[ ] Гейм овер
|
||
[ ] Бонусы
|
||
[ ] Визуальное оформление
|
||
[ ] Интерфейс игры
|
||
[ ] Звуки
|
||
|
||
*/
|