mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-04-30 08:21:47 -04:00
Splash screen
Reticulating splines...
This commit is contained in:
parent
8fec258215
commit
027aa6ce73
2 changed files with 24 additions and 30 deletions
BIN
resources/tsosplash.png
Normal file
BIN
resources/tsosplash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 426 KiB |
54
src/main.zig
54
src/main.zig
|
@ -1,52 +1,46 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const rl = @import("raylib");
|
const rl = @import("raylib");
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() anyerror!void {
|
||||||
const screenWidth = 800;
|
const screenWidth = 800;
|
||||||
const screenHeight = 450;
|
const screenHeight = 600;
|
||||||
|
|
||||||
rl.initWindow(screenWidth, screenHeight, "Basic Window");
|
// var timePlayed: f32 = 0.0;
|
||||||
|
|
||||||
|
rl.initWindow(screenWidth, screenHeight, "My Simulation");
|
||||||
defer rl.closeWindow();
|
defer rl.closeWindow();
|
||||||
|
|
||||||
var ballPos = rl.Vector2.init(screenWidth / 2, screenHeight / 2);
|
|
||||||
|
|
||||||
rl.setTargetFPS(60);
|
rl.setTargetFPS(60);
|
||||||
|
|
||||||
|
// Media must be loaded after window init
|
||||||
|
// rl.initAudioDevice();
|
||||||
|
// const music = rl.loadMusicStream("resources/LeeRosevere-ThreeThingsYouNeedtoKnowAboutToday.mp3");
|
||||||
|
// defer rl.closeAudioDevice();
|
||||||
|
|
||||||
|
const splash: rl.Texture = rl.Texture.init("resources/tsosplash.png");
|
||||||
|
defer rl.unloadTexture(splash);
|
||||||
|
|
||||||
while (!rl.windowShouldClose()) {
|
while (!rl.windowShouldClose()) {
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
if (rl.isKeyDown(rl.KeyboardKey.key_right) or
|
|
||||||
rl.isKeyDown(rl.KeyboardKey.key_d))
|
|
||||||
{
|
|
||||||
ballPos.x += 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rl.isKeyDown(rl.KeyboardKey.key_left) or
|
// Load music
|
||||||
rl.isKeyDown(rl.KeyboardKey.key_a))
|
// ------------------
|
||||||
{
|
// rl.updateMusicStream(music);
|
||||||
ballPos.x -= 2.0;
|
// rl.playMusicStream(music);
|
||||||
}
|
|
||||||
|
|
||||||
if (rl.isKeyDown(rl.KeyboardKey.key_up) or
|
// timePlayed = rl.getMusicTimePlayed(music) / rl.getMusicTimeLength(music);
|
||||||
rl.isKeyDown(rl.KeyboardKey.key_w))
|
// if (timePlayed > 1.0) timePlayed = 1.0;
|
||||||
{
|
// ------------------
|
||||||
ballPos.y -= 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rl.isKeyDown(rl.KeyboardKey.key_down) or
|
|
||||||
rl.isKeyDown(rl.KeyboardKey.key_s))
|
|
||||||
{
|
|
||||||
ballPos.y += 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
rl.beginDrawing();
|
rl.beginDrawing();
|
||||||
defer rl.endDrawing();
|
defer rl.endDrawing();
|
||||||
|
|
||||||
rl.clearBackground(rl.Color.dark_gray);
|
// Splash screen
|
||||||
|
rl.drawTexture(splash, 0, 0, rl.Color.white);
|
||||||
|
|
||||||
rl.drawText("Hello, zTSO!", 190, 200, 20, rl.Color.sky_blue);
|
// Loading text
|
||||||
|
rl.drawText("Reticulating splines...", 20, screenHeight - 30, 20, rl.Color.white);
|
||||||
rl.drawCircleV(ballPos, 50, rl.Color.maroon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue