A-Z character set and text function

This commit is contained in:
stevenhowes
2021-03-28 16:47:54 +01:00
parent 85d5424f9e
commit f9ea0f0a46
4 changed files with 45 additions and 1 deletions
Binary file not shown.
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -179,7 +179,7 @@ void intro()
sound_composition_start(clock());
draw_sprite("spacebar",(DISPLAY_X/2)-106,50);
draw_sprite("spacebar",(DISPLAY_X/2)-106,50);
while(sound_composition_incomplete())
{
+44
View File
@@ -131,6 +131,50 @@ void draw_sprite(char* spritename,int x, int y)
_kernel_swi(OS_SpriteOp,&inreg,&outreg);
}
void draw_spritetext(char* text, int x, int y)
{
int currentx;
int currenty;
int i;
char str[2] = "\0";
currentx = x;
currenty = y;
for(i = 0; i < strlen(text); i++)
{
str[0] = text[i];
if((text[i] != ' ') && (text[i] != '\n'))
draw_sprite(str,currentx,currenty);
switch (text[i])
{
case 't':
case 'i':
case 'y':
currentx += 6 + 2;
break;
case 'm':
currentx += 14 + 2;
break;
case 'q':
case 'w':
currentx += 10 + 2;
break;
case ' ':
currentx += 4 + 2;
break;
default:
currentx += 8 + 2;
}
if(text[i] == '\n')
{
currentx = x;
currenty -= 32;
}
}
}
void draw_text(char* text, int x, int y, int fonthandle)
{
inreg.r[0] = fonthandle;