Change fade rects color. Implement float setColor
This commit is contained in:
parent
51404cd706
commit
7265089f7c
|
@ -99,7 +99,8 @@ pub fn render(self: Self, main_menu: MainMenu) void {
|
||||||
self.renderer.fillRectangleEx(x - 25, 10, width + 50, height + 50, skew);
|
self.renderer.fillRectangleEx(x - 25, 10, width + 50, height + 50, skew);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.renderer.setColor(0, 0, 0, 127);
|
// TODO: Set the Color depending on the Main Menu color
|
||||||
|
self.renderer.setColorF(0.91, 0.85, 0.65, 0.50);
|
||||||
self.renderer.fillRectangleEx(-150, 0, @divTrunc(wsize.width, 3), wsize.height, skew);
|
self.renderer.fillRectangleEx(-150, 0, @divTrunc(wsize.width, 3), wsize.height, skew);
|
||||||
self.renderer.fillRectangleEx(@intCast(i32, screen_width) - 300, 0, @divTrunc(wsize.width, 3), wsize.height, skew);
|
self.renderer.fillRectangleEx(@intCast(i32, screen_width) - 300, 0, @divTrunc(wsize.width, 3), wsize.height, skew);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ fn glGetProcAddress(p: []const u8, proc: [:0]const u8) ?*const anyopaque {
|
||||||
return sdl.c.SDL_GL_GetProcAddress(@ptrCast([*c]const u8, proc));
|
return sdl.c.SDL_GL_GetProcAddress(@ptrCast([*c]const u8, proc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn init() !Self {
|
pub fn init() !Self {
|
||||||
try sdl.init(.{ .video = true, .audio = true, .events = true });
|
try sdl.init(.{ .video = true, .audio = true, .events = true });
|
||||||
|
|
||||||
|
@ -51,7 +50,6 @@ pub fn init() !Self {
|
||||||
const proc: []const u8 = undefined;
|
const proc: []const u8 = undefined;
|
||||||
try gl.loadExtensions(proc, glGetProcAddress);
|
try gl.loadExtensions(proc, glGetProcAddress);
|
||||||
|
|
||||||
|
|
||||||
// Shader stuff
|
// Shader stuff
|
||||||
var mvp_loc: u32 = undefined;
|
var mvp_loc: u32 = undefined;
|
||||||
//var color_loc: u32 = undefined;
|
//var color_loc: u32 = undefined;
|
||||||
|
@ -127,7 +125,6 @@ pub fn render(self: *Self) void {
|
||||||
// Clear the vbo, this really shouldn't be necessary as the index is set to zero,
|
// Clear the vbo, this really shouldn't be necessary as the index is set to zero,
|
||||||
// but otherwise it leads to bugs
|
// but otherwise it leads to bugs
|
||||||
self.vbo = .{0.0} ** max_objects;
|
self.vbo = .{0.0} ** max_objects;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *Self) void {
|
pub fn deinit(self: *Self) void {
|
||||||
|
@ -137,7 +134,11 @@ pub fn deinit(self: *Self) void {
|
||||||
sdl.gl.deleteContext(self.context);
|
sdl.gl.deleteContext(self.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setColor(self: *Self, r: u8, g: i32, b: i32, a: i32) void {
|
pub fn setColorF(self: *Self, r: f32, g: f32, b: f32, a: f32) void {
|
||||||
|
self.*.color = .{ r, g, b, a };
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn setColor(self: *Self, r: i32, g: i32, b: i32, a: i32) void {
|
||||||
self.*.color = .{
|
self.*.color = .{
|
||||||
@intToFloat(f32, r) / 255.0,
|
@intToFloat(f32, r) / 255.0,
|
||||||
@intToFloat(f32, g) / 255.0,
|
@intToFloat(f32, g) / 255.0,
|
||||||
|
|
Loading…
Reference in New Issue