Przeglądaj źródła

Updates, halting for now, doing xurses...

master
Ognjen Milan Robovic 7 miesięcy temu
rodzic
commit
fac5110f79
2 zmienionych plików z 16 dodań i 10 usunięć
  1. +1
    -1
      example/base.c
  2. +15
    -9
      xlesses.c

+ 1
- 1
example/base.c Wyświetl plik

@@ -46,7 +46,7 @@ int main (void) {
for (offset = 0; buffer [offset] != '\0'; 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);
}


+ 15
- 9
xlesses.c Wyświetl plik

@@ -70,7 +70,8 @@ void blesses_initialize (void) {

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));

log_out ();
@@ -94,10 +95,14 @@ void blesses_synchronize (void) {
int j = 0;

xcb_generic_event_t * generic_event = NULL;
/*
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];
}
*/
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);

@@ -132,7 +137,8 @@ void blesses_synchronize (void) {
generic_event = deallocate (generic_event);

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));
}

@@ -142,9 +148,9 @@ void blesses_synchronize (void) {
void blesses_render_background_colour (int colour) {
int x, y;

for (y = 0; y != blesses_window_height / 2; ++y) {
for (x = 0; x != blesses_window_width / 2; ++x) {
blesses_sub_framebuffer [y * (blesses_window_width / 2) + x] = 0XFF000000 | colour;
for (y = 0; y != blesses_window_height/* / 2*/; ++y) {
for (x = 0; x != blesses_window_width/* / 2*/; ++x) {
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;

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 ((x <= -1) || (x >= blesses_window_width/* / 2*/ - BLESSES_FONT_WIDTH)) 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_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 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 ();


Ładowanie…
Anuluj
Zapisz