Implement transparency and borders
This commit is contained in:
parent
95c340b915
commit
fb09ef0b6e
|
@ -70,6 +70,9 @@ pub fn init() !Self {
|
||||||
|
|
||||||
gl.clearColor(0.91, 0.97, 1.00, 1.00);
|
gl.clearColor(0.91, 0.97, 1.00, 1.00);
|
||||||
|
|
||||||
|
gl.enable(.blend);
|
||||||
|
gl.blendFunc(.src_alpha, .one_minus_src_alpha);
|
||||||
|
|
||||||
return Self{
|
return Self{
|
||||||
.window = window,
|
.window = window,
|
||||||
.context = ctx,
|
.context = ctx,
|
||||||
|
@ -101,11 +104,10 @@ pub fn setColor(self: *Self, r: u8, g: i32, b: i32, a: i32) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn drawRectangle(self: *Self, x: i32, y: i32, w: i32, h: i32) void {
|
pub fn drawRectangle(self: *Self, x: i32, y: i32, w: i32, h: i32) void {
|
||||||
_ = self;
|
self.fillRectangle(x, y, 1, h);
|
||||||
_ = x;
|
self.fillRectangle(x, y, w, 1);
|
||||||
_ = y;
|
self.fillRectangle(w+x, y, 1, h);
|
||||||
_ = w;
|
self.fillRectangle(x, h+y, w, 1);
|
||||||
_ = h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fillRectangle(self: *Self, x: i32, y: i32, w: i32, h: i32) void {
|
pub fn fillRectangle(self: *Self, x: i32, y: i32, w: i32, h: i32) void {
|
||||||
|
|
|
@ -26,11 +26,6 @@ pub fn main() !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer.setColor(255, 127, 0, 255);
|
|
||||||
renderer.drawRectangle(20, 20, 20, 20);
|
|
||||||
|
|
||||||
renderer.render();
|
|
||||||
|
|
||||||
_ = game.tick();
|
_ = game.tick();
|
||||||
|
|
||||||
//current_state = switch (current_state) {
|
//current_state = switch (current_state) {
|
||||||
|
@ -38,5 +33,6 @@ pub fn main() !void {
|
||||||
//.game => game.tick(),
|
//.game => game.tick(),
|
||||||
//};
|
//};
|
||||||
|
|
||||||
|
renderer.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue