Updates, halting for now, doing xurses...

This commit is contained in:
Ognjen Milan Robovic 2023-10-04 14:26:51 -04:00
parent c0d756a07c
commit fac5110f79
2 changed files with 16 additions and 10 deletions

View File

@ -46,7 +46,7 @@ int main (void) {
for (offset = 0; buffer [offset] != '\0'; offset += length) { for (offset = 0; buffer [offset] != '\0'; offset += length) {
select = syntax_select (& buffer [offset], & length); select = syntax_select (& buffer [offset], & length);
if (y >= 50 * BLESSES_FONT_WIDTH) break; if (y >= 100 * BLESSES_FONT_WIDTH) break;
blesses_render_string_limit (& buffer [offset], length, & x, & y, syntax_colour [select], 0X111111); blesses_render_string_limit (& buffer [offset], length, & x, & y, syntax_colour [select], 0X111111);
} }

View File

@ -70,7 +70,8 @@ void blesses_initialize (void) {
xcb_flush (blesses_connection); xcb_flush (blesses_connection);
blesses_sub_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_sub_framebuffer) / 4); /*blesses_sub_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_sub_framebuffer) / 4);*/
blesses_sub_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_sub_framebuffer));
blesses_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_framebuffer)); blesses_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_framebuffer));
log_out (); log_out ();
@ -94,10 +95,14 @@ void blesses_synchronize (void) {
int j = 0; int j = 0;
xcb_generic_event_t * generic_event = NULL; xcb_generic_event_t * generic_event = NULL;
/*
for (i = 0; i != blesses_window_width * blesses_window_height; i++) { for (i = 0; i != blesses_window_width * blesses_window_height; i++) {
blesses_framebuffer [i] = blesses_sub_framebuffer [((i / blesses_window_width) / 2) * (blesses_window_width / 2) + (i % blesses_window_width) / 2]; blesses_framebuffer [i] = blesses_sub_framebuffer [((i / blesses_window_width) / 2) * (blesses_window_width / 2) + (i % blesses_window_width) / 2];
} }
*/
for (i = 0; i != blesses_window_width * blesses_window_height; i++) {
blesses_framebuffer [i] = blesses_sub_framebuffer [i];
}
blesses_sub_framebuffer = deallocate (blesses_sub_framebuffer); blesses_sub_framebuffer = deallocate (blesses_sub_framebuffer);
@ -132,7 +137,8 @@ void blesses_synchronize (void) {
generic_event = deallocate (generic_event); generic_event = deallocate (generic_event);
if ((blesses_sub_framebuffer == NULL) && (blesses_framebuffer == NULL)) { if ((blesses_sub_framebuffer == NULL) && (blesses_framebuffer == NULL)) {
blesses_sub_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_sub_framebuffer) / 4); /*blesses_sub_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_sub_framebuffer) / 4);*/
blesses_sub_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_sub_framebuffer));
blesses_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_framebuffer)); blesses_framebuffer = allocate (blesses_window_width * blesses_window_height * (int) sizeof (* blesses_framebuffer));
} }
@ -142,9 +148,9 @@ void blesses_synchronize (void) {
void blesses_render_background_colour (int colour) { void blesses_render_background_colour (int colour) {
int x, y; int x, y;
for (y = 0; y != blesses_window_height / 2; ++y) { for (y = 0; y != blesses_window_height/* / 2*/; ++y) {
for (x = 0; x != blesses_window_width / 2; ++x) { for (x = 0; x != blesses_window_width/* / 2*/; ++x) {
blesses_sub_framebuffer [y * (blesses_window_width / 2) + x] = 0XFF000000 | colour; blesses_sub_framebuffer [y * (blesses_window_width/* / 2*/) + x] = 0XFF000000 | colour;
} }
} }
} }
@ -167,8 +173,8 @@ void blesses_render_character (char character, int x, int y, int foreground, int
int offset; int offset;
if ((x <= -1) || (x >= blesses_window_width / 2 - BLESSES_FONT_WIDTH)) return; if ((x <= -1) || (x >= blesses_window_width/* / 2*/ - BLESSES_FONT_WIDTH)) return;
if ((y <= -1) || (y >= blesses_window_height / 2 - BLESSES_FONT_HEIGHT)) return; if ((y <= -1) || (y >= blesses_window_height/* / 2*/ - BLESSES_FONT_HEIGHT)) return;
log_in (LOG_WARNING, blesses_sub_framebuffer == NULL, "blesses : render_character : Sub framebuffer was not allocated."); log_in (LOG_WARNING, blesses_sub_framebuffer == NULL, "blesses : render_character : Sub framebuffer was not allocated.");
log_in (LOG_WARNING, blesses_framebuffer == NULL, "blesses : render_character : Framebuffer was not allocated."); log_in (LOG_WARNING, blesses_framebuffer == NULL, "blesses : render_character : Framebuffer was not allocated.");
@ -182,7 +188,7 @@ void blesses_render_character (char character, int x, int y, int foreground, int
int u = offset / BLESSES_FONT_WIDTH + y; int u = offset / BLESSES_FONT_WIDTH + y;
int v = offset % BLESSES_FONT_WIDTH + x; int v = offset % BLESSES_FONT_WIDTH + x;
blesses_sub_framebuffer [u * (blesses_window_width / 2) + v] = ((font_code [(int) (character - ' ')] >> offset) % 2) ? foreground : background; blesses_sub_framebuffer [u * (blesses_window_width/* / 2*/) + v] = ((font_code [(int) (character - ' ')] >> offset) % 2) ? foreground : background;
} }
log_out (); log_out ();