mod(renderer): store absolut screen size for view change to report current screen size accordingly
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m21s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m21s
This commit is contained in:
@@ -131,6 +131,8 @@ pub fn main() !void {
|
|||||||
switch (e) {
|
switch (e) {
|
||||||
.tui => {
|
.tui => {
|
||||||
view = tui_view;
|
view = tui_view;
|
||||||
|
// NOTE: report potentially new screen size
|
||||||
|
view.handle(.{ .resize = renderer.size });
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,13 +19,16 @@ pub fn Direct(comptime fullscreen: bool) type {
|
|||||||
_ = log;
|
_ = log;
|
||||||
_ = fullscreen;
|
_ = fullscreen;
|
||||||
return struct {
|
return struct {
|
||||||
|
size: Size,
|
||||||
|
|
||||||
pub fn resize(this: *@This(), size: Size) void {
|
pub fn resize(this: *@This(), size: Size) void {
|
||||||
_ = this;
|
this.size = size;
|
||||||
_ = size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(this: *@This(), size: Size) !void {
|
pub fn clear(this: *@This(), size: Size) !void {
|
||||||
_ = this;
|
_ = this;
|
||||||
|
// NOTE: clear on the entire screen may introduce too much overhead and could instead clear the entire screen instead.
|
||||||
|
// - it could also then try to optimize for further *clear* calls, that result in pretty much a nop? -> how to identify those clear calls?
|
||||||
// TODO: this should instead by dynamic and correct of size (terminal could be too large currently)
|
// TODO: this should instead by dynamic and correct of size (terminal could be too large currently)
|
||||||
std.debug.assert(1028 > size.cols);
|
std.debug.assert(1028 > size.cols);
|
||||||
var buf: [1028]u8 = undefined;
|
var buf: [1028]u8 = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user