working on UI

This commit is contained in:
2021-09-05 09:49:23 +02:00
parent e55e4c64dd
commit 549ac4d3aa
2 changed files with 37 additions and 7 deletions

2
draw.h
View File

@@ -28,6 +28,6 @@ void draw_rect(const int x, const int y, const int w, const int h, const uint8_t
void draw_inset(const int x, const int y, const int w, const int h, const uint8_t color1, const uint8_t color2); void draw_inset(const int x, const int y, const int w, const int h, const uint8_t color1, const uint8_t color2);
void draw_outset(const int x, const int y, const int w, const int h, const uint8_t color1, const uint8_t color2); void draw_outset(const int x, const int y, const int w, const int h, const uint8_t color1, const uint8_t color2);
void draw_line(const int x1, const int y1, const int x2, const int y2, const uint8_t color); void draw_line(const int x1, const int y1, const int x2, const int y2, const uint8_t color);
void draw_dotted(const int x1, const int y1, const int x2, const int y2, const uint8_t color); void draw_dotted(const int x1, const int y, const int x2, const uint8_t color);
void draw_char(const char chr, const int x, const int y, const uint8_t color); void draw_char(const char chr, const int x, const int y, const uint8_t color);
void draw_string(const char* str, int x, const int y, const uint8_t color); void draw_string(const char* str, int x, const int y, const uint8_t color);

View File

@@ -60,20 +60,50 @@ int main(int argc, char* argv[]) {
draw_init(); draw_init();
draw_clear(color_dark_grey); draw_clear(color_dark_grey);
draw_fill(3, 14, 32, 97, color_black); draw_fill(3, 14, 138, 225, color_black);
draw_inset(2, 13, 34, 99, color_light_peach, color_dark_blue); draw_inset(2, 13, 35, 226, color_light_peach, color_dark_blue);
draw_inset(37, 13, 35, 226, color_light_peach, color_dark_blue);
draw_inset(72, 13, 35, 226, color_light_peach, color_dark_blue);
draw_inset(107, 13, 35, 226, color_light_peach, color_dark_blue);
draw_dotted(4, 71, 35, color_lavender);
int xp = 4, yp = 15;
for (int x=0; x<4; ++x) {
yp = 15;
for (int y=0; y<32; ++y) {
if (x==0 && y==0) {
draw_string("G#", xp, yp, color_white);
draw_char('1', 10+xp, yp, color_light_grey);
draw_char('5', 16+xp, yp, color_pink);
draw_char('2', 21+xp, yp, color_blue);
draw_char('3', 26+xp, yp, color_lavender);
} else {
draw_string("...", xp, yp, color_dark_blue);
draw_string("...", 16+xp, yp, color_dark_blue);
}
yp += 7;
if ((y%8)==7) {
draw_dotted(xp, yp, xp+31, color_lavender);
yp++;
}
}
xp += 35;
}
//draw_string("......", 4, 15, color_dark_blue);
//draw_string("......", 38, 15, color_dark_blue);
/*int last_x = 0, last_y = 120; /*int last_x = 0, last_y = 120;
for (int x=0; x<1102; ++x) { for (int x=0; x<1102; ++x) {
int y = 700 - (350+300*(float(beeps[x*10])/float(AUDIO_FORMAT_MAX_VALUE))); int y = 700 - (350+300*(float(beeps[x*10])/float(AUDIO_FORMAT_MAX_VALUE)));
SDL_RenderDrawLine(sdlRenderer, x, y, last_x, last_y); SDL_RenderDrawLine(sdlRenderer, x, y, last_x, last_y);
last_x = x; last_y = y; last_x = x; last_y = y;
}*/ }*/
draw_string("HOLA", 11, 11, color_black);
draw_string("HOLA", 10, 10, color_white); //draw_string("HOLA", 11, 11, color_black);
//draw_string("HOLA", 10, 10, color_white);
draw_present(); draw_present();
SDL_QueueAudio(sdlAudioDevice, &beeps[0], SOUND_SIZE_IN_BYTES*8); //SDL_QueueAudio(sdlAudioDevice, &beeps[0], SOUND_SIZE_IN_BYTES*8);
SDL_PauseAudioDevice(sdlAudioDevice, 0); //SDL_PauseAudioDevice(sdlAudioDevice, 0);
bool exit = false; bool exit = false;
SDL_Event sdlEvent; SDL_Event sdlEvent;