comments and cleaning

This commit is contained in:
Jeeves 2025-05-28 07:07:58 -06:00
parent 18bff3cc00
commit 34f6d4d742
2 changed files with 7 additions and 9 deletions

3
.gitignore vendored
View file

@ -8,9 +8,10 @@ zig-out/
/build-*/
/docgen_tmp/
# Temporary project-specific dirs
# Temporary project-specific things
vsh/
dumped/
menu/
font/
reference/
screenshot.png

View file

@ -3,7 +3,7 @@ pub fn main() !void {
defer _ = gpa.deinit();
const allocator = gpa.allocator();
raylib.SetConfigFlags(raylib.FLAG_VSYNC_HINT | raylib.FLAG_WINDOW_RESIZABLE);
raylib.SetConfigFlags(raylib.FLAG_VSYNC_HINT); // | raylib.FLAG_WINDOW_RESIZABLE);
raylib.InitWindow(@intFromFloat(screen_width), @intFromFloat(screen_height), "ReX");
defer raylib.CloseWindow();
@ -14,8 +14,6 @@ pub fn main() !void {
global_font = raylib.LoadFontEx("font/SCE-PS3-RD-R-LATIN.TTF", 32, 0, 250);
raylib.SetTextureFilter(global_font.texture, raylib.TEXTURE_FILTER_TRILINEAR);
// const camera = createCamera();
var background = Background.init();
var column = Column.init(
allocator,
@ -39,6 +37,7 @@ pub fn main() !void {
scales.recalculate();
}
if (raylib.IsKeyPressed('Z')) item.setBig(!item.big);
if (raylib.IsKeyPressed('S')) raylib.TakeScreenshot("screenshot.png");
raylib.BeginDrawing();
defer raylib.EndDrawing();
@ -46,11 +45,6 @@ pub fn main() !void {
background.draw();
column.draw();
// {
// raylib.BeginMode3D(camera);
// defer raylib.EndMode3D();
// }
raylib.DrawFPS(1, 1);
const debug_text = try std.fmt.allocPrint(allocator, "screen size = {d}x{d}", .{ screen_width, screen_height });
@ -66,6 +60,7 @@ var screen_height: f32 = 272;
var scales: Scales = undefined;
/// Cached scaling and positioning values for dynamic window resizing.
pub const Scales = struct {
item_icon_scale: f32,
item_title_font_size: f32,
@ -76,6 +71,7 @@ pub const Scales = struct {
column_position_center: raylib.Vector2,
column_position_spacing: f32,
/// Recalculate scales after screen resize.
pub fn recalculate(self: *Scales) void {
self.item_icon_scale = screen_height * 0.72 / screen_height;
@ -272,6 +268,7 @@ pub const Background = struct {
};
};
/// Create ortho camera looking down at the XY plane, with a fovy of 1 for UV-like positioning.
fn createCamera() raylib.Camera3D {
var camera = raylib.Camera3D{};