Make SDL examples compile

This commit is contained in:
Erik Kunze 2017-11-21 09:40:06 +01:00
parent ef5b2619f3
commit 1c22ed9ff7
5 changed files with 18 additions and 9 deletions

10
sys/sdl/Makefile Normal file
View File

@ -0,0 +1,10 @@
TOPTARGETS := all clean
NOWANTS=common/. text_kerning/.
SUBDIRS := $(filter-out $(NOWANTS), $(wildcard */.))
$(TOPTARGETS): $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
.PHONY: $(TOPTARGETS) $(SUBDIRS)

View File

@ -406,7 +406,7 @@ uint8_t obj_list_GetEmpty(void)
for( i = 0; i < OBJ_LIST_MAX; i++ )
if ( obj_list[i].tile == 0 )
return i;
return 255;
return 255;
}
/*=================================================*/

View File

@ -1,5 +1,5 @@
#include "u8x8.h"
#include "u8g2.h"
const uint8_t bdf_font[762] U8X8_FONT_SECTION("bdf_font") = {
@ -92,8 +92,8 @@ int main(void)
u8g2_SendBuffer(&u8g2);
u8x8_Set8x8Font(u8g2_GetU8x8(&u8g2), bdf_font);
u8x8_Draw8x8String(u8g2_GetU8x8(&u8g2), 0, 0, "Hello World!");
u8x8_SetFont(u8g2_GetU8x8(&u8g2), bdf_font);
u8x8_DrawString(u8g2_GetU8x8(&u8g2), 0, 0, "Hello World!");

View File

@ -1,13 +1,14 @@
#include "u8g2.h"
#include <stdio.h>
#include <string.h>
/* not finished */
u8g2_t u8g2;
#define MAX_CHARS 30;
#define MAX_CHARS 30
u8g2_uint_t char_offset[MAX_CHARS+1]; // one more to store the end of the string
u8g2_uint_t curr_index;
@ -25,13 +26,13 @@ void init_text(const char *s)
for( i = 0; i < str_len; i++ )
{
char_offset[i+1] = char_offset[i];
char_offset[i+1] += u8g2_GetGlyphWidth(u8g2, s[i]); // assume s[i] is the glyph encoding --> no UTF8 support
char_offset[i+1] += u8g2_GetGlyphWidth(&u8g2, s[i]); // assume s[i] is the glyph encoding --> no UTF8 support
}
curr_index = 0;
curr_offset = 0;
}
void set_offset(u8g2_uint8_t offset)
void set_offset(u8g2_uint_t offset)
{
for(;;)
{

View File

@ -29,7 +29,6 @@ int main(void)
{
int x, y;
int k;
int i;
u8g2_SetupBuffer_SDL_128x64_4(&u8g2, &u8g2_cb_r0);
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
@ -44,7 +43,6 @@ int main(void)
{
u8g2_FirstPage(&u8g2);
i = 0;
do
{
draw(x,y);