Commit 9024bd26 authored by Larry Koubiak's avatar Larry Koubiak
Browse files

added author track info and number of voices

parent 5b8ad1dc
Pipeline #95291 failed with stages
in 1 minute and 23 seconds
......@@ -91,7 +91,6 @@ static void draw_ui(void)
unsigned short lc = 0;
char *message = malloc(100);
//lines
draw_box(framebuffer,gme_white,ob);
draw_line(framebuffer,gme_gray,ob.x0,ob.y0,ib.x0,ib.y0); //top-left corner
draw_line(framebuffer,gme_gray,ob.x1,ob.y0,ib.x1,ib.y0); //top-right corner
......@@ -111,14 +110,15 @@ static void draw_ui(void)
draw_line(framebuffer,lc,ob.x0+1+offset,ob.y1-offset,ob.x1-1-offset,ob.y1-offset); //top
}
}
draw_string(framebuffer,gme_white,get_num_voices(message),30, 30,get_track_elapsed_frames());
//text
maxlen = draw_text_centered(get_game_name(message),gme_red,centery-20,maxlen);
maxlen = draw_text_centered(get_track_count(message),gme_yellow,centery-10,maxlen);
maxlen = draw_text_centered(get_song_name(message),gme_blue,centery,maxlen);
maxlen = draw_text_centered(get_track_position(message),gme_white,centery+10,maxlen);
maxlen = draw_text_centered(get_author(message),gme_green,centery+10,maxlen);
maxlen = draw_text_centered(get_track_position(message),gme_white,centery+20,maxlen);
maxlen = MIN(maxlen,framebuffer->width-40);
box tb = {centerx-(maxlen/2),centery-22,centerx+(maxlen/2),centery+22};
box tb = {centerx-(maxlen/2)-2,centery-22,centerx+(maxlen/2)+2,centery+30};
draw_box(framebuffer,gme_violet,tb);
free(message);
}
......
......@@ -123,6 +123,18 @@ char *get_song_name(char *buf)
return buf;
}
char *get_author(char *buf)
{
sprintf(buf, "%s", track->author);
return buf;
}
char *get_num_voices(char *buf)
{
sprintf(buf, "Num voices: %i", gme_voice_count(emu));
return buf;
}
char *get_track_position(char *buf)
{
long seconds = track->track_length / 1000;
......
......@@ -24,6 +24,10 @@ char *get_track_count(char *buf);
char *get_song_name(char *buf);
char *get_author(char *buf);
char *get_num_voices(char *buf);
char *get_track_position(char *buf);
int get_track_elapsed_frames(void);
......
......@@ -184,6 +184,17 @@ bool get_track_data(Music_Emu* emu, int fileid, int trackid, char *filename,gme_
gtd->track_name = calloc(strlen(ti->song)+1,sizeof(char));
strcpy(gtd->track_name, ti->song);
}
//author
if(strcmp(ti->author,"") == 0)
{
gtd->author = calloc(2,sizeof(char));
sprintf(gtd->track_name, " ");
}
else
{
gtd->author = calloc(strlen(ti->author)+1,sizeof(char));
strcpy(gtd->author, ti->author);
}
gme_free_info(ti);
*dest_gtd = gtd;
return true;
......
......@@ -17,7 +17,8 @@ typedef struct {
int track_id;
int track_length;
char* game_name;
char* track_name;
char* track_name;
char *author;
} gme_track_data;
typedef struct {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment