This commit is contained in:
Dusk 2022-12-01 10:28:59 +01:00
parent a248749538
commit 52f35807d3
4 changed files with 13 additions and 3 deletions

@ -1 +1 @@
Subproject commit 32608da70ca057ec09438dbf6549834dcfbeb52c Subproject commit 9fc2524bbf2e1172a5cb218eca37dc99930a31db

@ -1 +1 @@
Subproject commit e9da7f084055eb3fab0454ef4d5db0a103ff96df Subproject commit dff2959b5fff0aa7697fdf1a2843a15210aab695

View File

@ -18,7 +18,7 @@ grid_pos_y: i32,
pub fn init(renderer: *Renderer) Self { pub fn init(renderer: *Renderer) Self {
var wsize = renderer.getOutputSize(); var wsize = renderer.getOutputSize();
const grid_cell_size = @divFloor(@minimum(wsize.width, wsize.height), 32); const grid_cell_size = @divFloor(@min(wsize.width, wsize.height), 32);
const grid_pos_x = @divFloor(wsize.width, 2) - (grid_cell_size * @divFloor(Grid.ncolumns, 2)); const grid_pos_x = @divFloor(wsize.width, 2) - (grid_cell_size * @divFloor(Grid.ncolumns, 2));
const grid_pos_y = @divFloor(wsize.height, 2) - (grid_cell_size * @divFloor(Grid.nrows + Grid.buffer, 2)); const grid_pos_y = @divFloor(wsize.height, 2) - (grid_cell_size * @divFloor(Grid.nrows + Grid.buffer, 2));
return Self{ return Self{

View File

@ -20,6 +20,12 @@ vbo_index: usize = 0,
const max_objects: usize = 16384; const max_objects: usize = 16384;
fn glGetProcAddress(p: []const u8, proc: [:0]const u8) ?*const anyopaque {
_ = p;
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 });
@ -42,6 +48,10 @@ pub fn init() !Self {
std.debug.print("WARNING: Unable to configure the swap interval.\n", .{}); std.debug.print("WARNING: Unable to configure the swap interval.\n", .{});
}; };
const proc: []const u8 = undefined;
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;