mirror of https://github.com/mlaux/gb6.git
sixel graphics for test purposes
This commit is contained in:
parent
ec9226e144
commit
ab630f2e38
|
@ -13,6 +13,7 @@ add_executable(gb6
|
|||
../src/lcd.c
|
||||
../src/rom.c
|
||||
emulator.c
|
||||
lcd_sixel.c
|
||||
)
|
||||
|
||||
target_link_libraries(gb6
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../src/lcd.h"
|
||||
|
||||
void lcd_draw(struct lcd *lcd)
|
||||
{
|
||||
int x, y, yy;
|
||||
|
||||
puts("\033[2J\033[H"); // clear screen and move cursor to 0, 0
|
||||
puts("\033Pq"); // enter sixel graphics mode
|
||||
for (y = 0; y < LCD_HEIGHT; y += 6) {
|
||||
for (x = 0; x < LCD_WIDTH; x++) {
|
||||
int val = 63;
|
||||
for (yy = 0; yy < 6; yy++) {
|
||||
val += !lcd->pixels[(y + yy) * LCD_WIDTH + x] << yy;
|
||||
}
|
||||
putchar(val);
|
||||
}
|
||||
putchar('-');
|
||||
}
|
||||
// puts("#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0");
|
||||
// puts("#1~~@@vv@@~~@@~~$");
|
||||
// puts("#2??}}GG}}??}}??-");
|
||||
// puts("#1!14@");
|
||||
puts("\033\\"); // leave graphics mode
|
||||
}
|
||||
|
||||
int test_main(int argc, char *argv[])
|
||||
{
|
||||
struct lcd lcd;
|
||||
lcd_new(&lcd);
|
||||
lcd_draw(&lcd);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue