mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Pong now shows the score on its UI.
This commit is contained in:
parent
d494dc2d53
commit
ebedeeae89
1 changed files with 10 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <libmaxsi/io.h>
|
||||
#include <libmaxsi/thread.h>
|
||||
#include <libmaxsi/keyboard.h>
|
||||
#include <libmaxsi/string.h>
|
||||
#include <libmaxsi/sortix-vga.h>
|
||||
#include <libmaxsi/sortix-keyboard.h>
|
||||
#include <libmaxsi/sortix-sound.h>
|
||||
|
@ -131,6 +132,15 @@ void Goal(nat player)
|
|||
void UpdateUI()
|
||||
{
|
||||
for ( int x = 0; x < width; x++ ) { frame->text[x] = ' ' | (COLOR8_LIGHT_GREY << 12) | (COLOR8_RED << 8); }
|
||||
|
||||
char num[12];
|
||||
int len;
|
||||
|
||||
len = String::ConvertUInt32(p1score, num);
|
||||
for ( int i = 0; i < len; i++ ) { frame->text[i] = ( frame->text[i] & 0xFF00 ) | num[i]; }
|
||||
|
||||
len = String::ConvertUInt32(p2score, num);
|
||||
for ( int i = 0; i < len; i++ ) { frame->text[width - len + i] = ( frame->text[width - len + i] & 0xFF00 ) | num[i]; }
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
|
Loading…
Add table
Reference in a new issue