- Not a perfect map view, butit does work
- Removed changeRotations() in favor of init()
- Removed FreeBSD and Tiers from system requirements in README
- Fixed typo in README
This commit is contained in:
Tony Bark 2024-05-07 03:11:16 -04:00
parent 77eefcf2bc
commit 00255a6c17
3 changed files with 50 additions and 35 deletions

View file

@ -25,17 +25,16 @@ See [motivation.md](./docs/motivation.md) for motivation and vision.
- API Server - API Server
- [.NET](https://dotnet.microsoft.com/en-us/) 8.0+ - [.NET](https://dotnet.microsoft.com/en-us/) 8.0+
- [Mockoon](https://mockoon.com/) for mock APIs (Optional) - [Mockoon](https://mockoon.com/) for mock APIs (Optional)
- Libaries & Tools - Libraries & Tools
- TBA - TBA
### System Requirements ### System Requirements
| Platform | Version | Tier | | Platform | Version | Architectures |
| --- | --- | --- | | -------- | ------- | --------------- |
| Windows | 10+ | 1 | | Windows | 10+ | x86_64, aarch64 |
| Linux | 3.16+ | 1 | | Linux | 3.16+ | x86_64 |
| macOS | 11.0+ | 1 | | macOS | 11.0+ | x86_64, aarch64 |
| FreeBSD | 12.0+ | 2 |
## Getting Started ## Getting Started

View file

@ -80,9 +80,7 @@ pub fn build(b: *std.Build) void {
}); });
exe_unit_tests.linkLibC(); exe_unit_tests.linkLibC();
exe_unit_tests.addIncludePath(.{ .path = "./library/formats" }); exe_unit_tests.addIncludePath(.{ .path = "./library" });
exe_unit_tests.addIncludePath(.{ .path = "./library/libvitaboy" });
exe_unit_tests.addIncludePath(.{ .path = "./tools" });
exe_unit_tests.root_module.addImport("raylib", raylib); exe_unit_tests.root_module.addImport("raylib", raylib);
exe_unit_tests.root_module.addImport("raylib-math", raylib_math); exe_unit_tests.root_module.addImport("raylib-math", raylib_math);

View file

@ -14,9 +14,6 @@ const GameScreen = enum {
const Rotations = enum { const Rotations = enum {
left, left,
right, right,
pub fn changeRotions(self: Rotations) Rotations {
return self;
}
pub fn init(self: Rotations) Rotations { pub fn init(self: Rotations) Rotations {
return self; return self;
@ -34,9 +31,7 @@ pub fn main() anyerror!void {
var current_screen: GameScreen = .login; var current_screen: GameScreen = .login;
var frame_counter: i32 = 0; var frame_counter: i32 = 0;
// var zoom: f32 = 10; var lot_camera = rl.Camera3D{
var camera = rl.Camera3D{
.position = rl.Vector3.init(-90.0, 20.0, 90.0), .position = rl.Vector3.init(-90.0, 20.0, 90.0),
.target = rl.Vector3.init(0, 0.0, 0), .target = rl.Vector3.init(0, 0.0, 0),
.up = rl.Vector3.init(0, 1.0, 0), .up = rl.Vector3.init(0, 1.0, 0),
@ -44,10 +39,18 @@ pub fn main() anyerror!void {
.projection = rl.CameraProjection.camera_orthographic, .projection = rl.CameraProjection.camera_orthographic,
}; };
const floorLevel = rl.Vector3.init(0.0, 0.0, 0.0); var city_camera = rl.Camera3D{
const itemStatic = rl.Vector3.init(0.0, 2.0, 0.0); .position = rl.Vector3.init(18.0, 21.0, 18),
.target = rl.Vector3.init(0, 0, 0),
.up = rl.Vector3.init(0, 1.0, 0),
.fovy = 45,
.projection = rl.CameraProjection.camera_perspective,
};
var rotation_manger = Rotations.init(Rotations.right); const floorLevel = rl.Vector3.init(0.0, 0.0, 0.0);
const itemStatic = rl.Vector3.init(0.0, 1.0, 0.0);
var rotation_manager = Rotations.init(Rotations.left);
rl.setTargetFPS(60); rl.setTargetFPS(60);
@ -55,10 +58,18 @@ pub fn main() anyerror!void {
const splash = rl.Texture.init("resources/tsosplash.png"); const splash = rl.Texture.init("resources/tsosplash.png");
const table3 = rl.Texture.init("resources/items/dorms/table_3.png"); const table3 = rl.Texture.init("resources/items/dorms/table_3.png");
const table4 = rl.Texture.init("resources/items/dorms/table_4.png"); const table4 = rl.Texture.init("resources/items/dorms/table_4.png");
const city = rl.loadImage("resources/cities/city_0100/elevation.png");
// const city_texture = rl.Texture.init("resources/cities/city_0100/vertexcolor.png");
defer rl.unloadTexture(splash); defer rl.unloadTexture(splash);
defer rl.unloadTexture(logo); defer rl.unloadTexture(logo);
defer rl.unloadTexture(table4); defer rl.unloadTexture(table4);
defer rl.unloadTexture(table3); defer rl.unloadTexture(table3);
defer rl.unloadImage(city);
const mesh = rl.genMeshHeightmap(city, rl.Vector3.init(16, 8, 16));
const model = rl.loadModelFromMesh(mesh);
// model.materials[0].maps[rl.MATERIAL_MAP_DIFFUSE].texture = city_texture;
while (!rl.windowShouldClose()) { while (!rl.windowShouldClose()) {
@ -79,30 +90,30 @@ pub fn main() anyerror!void {
const zoom_increment = 5; const zoom_increment = 5;
if (rl.isKeyPressed(rl.KeyboardKey.key_s)) { if (rl.isKeyPressed(rl.KeyboardKey.key_s)) {
if (camera.fovy == 10) { if (lot_camera.fovy == 10) {
camera.fovy += zoom_increment; lot_camera.fovy += zoom_increment;
} }
dbg.print("Zoom level: {any}\n", .{ dbg.print("Zoom level: {any}\n", .{
camera.fovy, lot_camera.fovy,
}); });
} else if (rl.isKeyPressed(rl.KeyboardKey.key_w)) { } else if (rl.isKeyPressed(rl.KeyboardKey.key_w)) {
if (camera.fovy == 15) { if (lot_camera.fovy == 15) {
camera.fovy -= zoom_increment; lot_camera.fovy -= zoom_increment;
} }
dbg.print("Zoom level: {any}\n", .{ dbg.print("Zoom level: {any}\n", .{
camera.fovy, lot_camera.fovy,
}); });
} }
if (rl.isKeyPressed(rl.KeyboardKey.key_a)) { if (rl.isKeyPressed(rl.KeyboardKey.key_a)) {
camera.position = rl.Vector3.init(-90.0, 20.0, 90.0); lot_camera.position = rl.Vector3.init(-90.0, 20.0, 90.0);
rotation_manger = Rotations.changeRotions(Rotations.left); rotation_manager = Rotations.init(Rotations.left);
dbg.print("Rotate right\n", .{}); dbg.print("Rotate right\n", .{});
} else if (rl.isKeyPressed(rl.KeyboardKey.key_d)) { } else if (rl.isKeyPressed(rl.KeyboardKey.key_d)) {
camera.position = rl.Vector3.init(90.0, 20.0, 90.0); lot_camera.position = rl.Vector3.init(90.0, 20.0, 90.0);
rotation_manger = Rotations.changeRotions(Rotations.right); rotation_manager = Rotations.init(Rotations.right);
dbg.print("Rotate left\n", .{}); dbg.print("Rotate left\n", .{});
} }
@ -127,18 +138,25 @@ pub fn main() anyerror!void {
}, },
// Skip this for now // Skip this for now
.cas => {}, .cas => {},
.map => {}, .map => {
rl.clearBackground(rl.Color.sky_blue);
city_camera.begin();
defer city_camera.end();
rl.drawModel(model, floorLevel, 1.0, rl.Color.green);
},
// Low view (i.e. world) // Low view (i.e. world)
.lot => { .lot => {
rl.clearBackground(rl.Color.sky_blue); rl.clearBackground(rl.Color.sky_blue);
camera.begin(); lot_camera.begin();
defer camera.end(); defer lot_camera.end();
rl.drawPlane(floorLevel, rl.Vector2.init(64, 64), rl.Color.dark_green); rl.drawPlane(floorLevel, rl.Vector2.init(64, 64), rl.Color.dark_green);
switch (rotation_manger) { switch (rotation_manager) {
.right => rl.drawBillboard(camera, table4, itemStatic, 2.0, rl.Color.white), .right => rl.drawBillboard(lot_camera, table4, itemStatic, 2.0, rl.Color.white),
.left => rl.drawBillboard(camera, table3, itemStatic, 2.0, rl.Color.white), .left => rl.drawBillboard(lot_camera, table3, itemStatic, 2.0, rl.Color.white),
} }
// rl.drawGrid(64, 1.0); // rl.drawGrid(64, 1.0);