Proper rendering of MainMenu

This commit is contained in:
Dusk 2023-09-22 12:16:29 +02:00
parent 2ed65aa6ae
commit bdf4e0b920
2 changed files with 20 additions and 25 deletions

View File

@ -68,8 +68,8 @@ pub fn render(self: Self, main_menu: MainMenu) void {
if (tab_i == 1) { if (tab_i == 1) {
// Shadow // Shadow
//self.renderer.setColor(0, 0, 0, 30); self.renderer.setColor(.{ 0, 0, 0, 30 });
//self.renderer.fillRectangleEx(x + 10, y + 10, width, height, skew); self.renderer.fillRectangleEx(x + 10, y + 10, width, height, skew);
} }
self.renderMenu(x, y, curr_tab, curr_tab.sel, alpha, true); self.renderMenu(x, y, curr_tab, curr_tab.sel, alpha, true);
@ -90,8 +90,8 @@ pub fn render(self: Self, main_menu: MainMenu) void {
} }
// Tab header // Tab header
//self.renderer.setColor(curr_tab.color[0], curr_tab.color[1], curr_tab.color[2], alpha); self.renderer.setColor(.{ curr_tab.color[0], curr_tab.color[1], curr_tab.color[2], alpha });
//self.renderer.fillRectangleEx(x - 25, 10, width + 50, height + 50, skew); self.renderer.fillRectangleEx(x - 25, 10, width + 50, height + 50, skew);
} }
// TODO: Set the Color depending on the Main Menu color // TODO: Set the Color depending on the Main Menu color
@ -101,33 +101,28 @@ pub fn render(self: Self, main_menu: MainMenu) void {
} }
fn renderMenu(self: Self, x: i32, y: i32, tab: MenuTab, sel: usize, a: u8, selected: bool) void { fn renderMenu(self: Self, x: i32, y: i32, tab: MenuTab, sel: usize, a: u8, selected: bool) void {
_ = self;
_ = x;
_ = y;
_ = tab;
_ = sel;
_ = a;
// White background // White background
//self.renderer.setColor(255, 255, 255, a); self.renderer.setColor(.{ 255, 255, 255, a });
//self.renderer.fillRectangleEx(x, y, width, height, skew); self.renderer.fillRectangleEx(x, y, width, height, skew);
//_ = sel; //_ = sel;
if (selected) { if (selected) {
// Set color if selected // Set color if selected
//self.renderer.setColor(tab.color[0], tab.color[1], tab.color[2], a); self.renderer.setColor(.{ tab.color[0], tab.color[1], tab.color[2], a });
} else { } else {
// Set black color, not selected // Set black color, not selected
//self.renderer.setColor(0, 0, 0, a); self.renderer.setColor(.{ 0, 0, 0, a });
} }
//const margin = 20; const margin = 20;
//self.renderer.setColorF(1, 1, 1, 1); self.renderer.drawText(
tab.contents[sel].name,
x + margin,
y + margin,
height - margin * 2,
);
//var text = Renderer.Texture.fromText(tab.contents[sel].name, height - margin * 2); //self.renderer.fillRectangleEx(x + margin, y + margin, width - margin * 2 - 12, height - margin * 2, skew);
//self.renderer.renderTexture(text, x + margin, y + margin); self.renderer.fillRectangleEx(x + width - 6, y, 6, height, skew);
self.renderer.fillRectangleEx(x + width - 12, y, 3, height, skew);
//self.renderer.fillRectangleEx(x + margin, y + margin, width - margin * 2, height - margin * 2, skew);
//self.renderer.fillRectangleEx(x + width - 6, y, 6, height, skew);
//self.renderer.fillRectangleEx(x + width - 12, y, 3, height, skew);
} }

View File

@ -21,7 +21,7 @@ const max_objects: usize = 16384;
const quadSize: usize = 9 * 6; const quadSize: usize = 9 * 6;
pub fn init() !Self { pub fn init() !Self {
rl.initWindow(640, 480, "USG", 60); rl.initWindow(1280, 720, "USG", 60);
var renderer = Self{}; var renderer = Self{};
@ -34,7 +34,7 @@ pub fn render(self: *Self) void {
rl.endDrawing(); rl.endDrawing();
rl.beginDrawing(); rl.beginDrawing();
rl.clearBackground(.{232, 216, 166, 255}); rl.clearBackground(.{ 232, 216, 166, 255 });
//self.setColor(.{0,0,0,255}); //self.setColor(.{0,0,0,255});
self.fillRectangle(10, 10, 100, 100); self.fillRectangle(10, 10, 100, 100);