master
ブランチ master
Snake / src / scene / title.cc
719 B、35行 生 Blame 履歴
1#include <snake/scene/title.hh>
2#include <snake/snake.hh>
3#include <raylib.h>
4
5#include "../ass/snake-title.hh"
6
7namespace snake::scene {
8 static Texture2D bg{};
9
10 bool TitleScreen::Init() {
11 Image img = LoadImageFromMemory(".png", snake_title_png, snake_title_png_len);
12 bg = LoadTextureFromImage(img);
13 UnloadImage(img);
14
15 return true;
16 }
17
18 bool TitleScreen::Update() {
19 if (IsKeyPressed(KEY_ENTER)) {
20 snake::PlaySFX(snake::Confirm, 1.f);
21 snake::Close();
22 snake::s = snake::GameMain;
23 snake::Init();
24 }
25
26 ClearBackground(BLACK);
27 DrawTexture(bg, 0, 0, WHITE);
28
29 return true;
30 }
31
32 void TitleScreen::Close() {
33 UnloadTexture(bg);
34 }
35} // namespace snake::scene