mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-28 10:14:58 -04:00
Switched to Raylib
- Added Raylib due to being simple and similar to XNA's APIs - Remove ifdef cplusplus from filehandler - Added VSCode, GH Actions and FetchTSO
This commit is contained in:
parent
d83abea13c
commit
02827893df
9 changed files with 976 additions and 100 deletions
53
src/main.zig
53
src/main.zig
|
@ -1,25 +1,44 @@
|
|||
const std = @import("std");
|
||||
const rl = @import("raylib");
|
||||
|
||||
pub fn main() !void {
|
||||
const screenWidth = 800;
|
||||
const screenHeight = 450;
|
||||
|
||||
// Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
|
||||
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
|
||||
rl.initWindow(screenWidth, screenHeight, "Basic Window");
|
||||
defer rl.closeWindow();
|
||||
|
||||
// stdout is for the actual output of your application, for example if you
|
||||
// are implementing gzip, then only the compressed bytes should be sent to
|
||||
// stdout, not any debugging messages.
|
||||
const stdout_file = std.io.getStdOut().writer();
|
||||
var bw = std.io.bufferedWriter(stdout_file);
|
||||
const stdout = bw.writer();
|
||||
// var ballPos = rl.Vector2.init(screenWidth / 2, screenHeight / 2);
|
||||
|
||||
try stdout.print("Run `zig build test` to run the tests.\n", .{});
|
||||
rl.setTargetFPS(60);
|
||||
|
||||
try bw.flush(); // don't forget to flush!
|
||||
}
|
||||
|
||||
test "simple test" {
|
||||
var list = std.ArrayList(i32).init(std.testing.allocator);
|
||||
defer list.deinit(); // try commenting this out and see if zig detects the memory leak!
|
||||
try list.append(42);
|
||||
try std.testing.expectEqual(@as(i32, 42), list.pop());
|
||||
while (!rl.windowShouldClose()) {
|
||||
|
||||
// Update
|
||||
// if (rl.isKeyDown(rl.KeyboardKey.key_right)) {
|
||||
// ballPos.x += 2.0;
|
||||
// }
|
||||
|
||||
// if (rl.isKeyDown(rl.KeyboardKey.key_left)) {
|
||||
// ballPos.x -= 2.0;
|
||||
// }
|
||||
|
||||
// if (rl.isKeyDown(rl.KeyboardKey.key_up)) {
|
||||
// ballPos.y -= 2.0;
|
||||
// }
|
||||
|
||||
// if (rl.isKeyDown(rl.KeyboardKey.key_down)) {
|
||||
// ballPos.y -= 2.0;
|
||||
// }
|
||||
|
||||
// Draw
|
||||
rl.beginDrawing();
|
||||
defer rl.endDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.dark_gray);
|
||||
|
||||
rl.drawText("Hello, zTSO!", 190, 200, 20, rl.Color.sky_blue);
|
||||
|
||||
// rl.drawCircle(ballPos, 50, rl.Color.maroon);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const std = @import("std");
|
||||
// const iff = @cImport({
|
||||
// @cInclude("./filehandler.h");
|
||||
// });
|
||||
const iff = @cImport({
|
||||
@cInclude("./iff/iff.h");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue