function draw_ticking_text()
{
str = "Gradually appearing text...";
i = 0;
thread_create( function() use( i ){ for(;;){ i++; yield( 0.2 ); } } );
for(;;)
{
tx = string_part( str, 0, i % str.length );
SS_DrawTextLine( tx, Font, 20, 20, color(1,1,1) );
yield();
}
}
function initialize()
{
global W = 1024, H = 576;
global Window = SS_CreateWindow( "SGS-SDL Game Framework", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1024, 576, SDL_WINDOW_OPENGLMAYBE );
Window.initRenderer( SS_RENDERER_DONTCARE, SS_RENDERER_VSYNC );
global Font = SS_CreateFont( "fonts/lato-regular.ttf", 12 );
thread_create( draw_ticking_text );
}
global prevTime = ftime();
function update()
{
SS_Clear( color(0.25,0.3,0.4) );
SS_SetCameraUI( 0, W, 0, H );
curTime = ftime();
deltaTime = curTime - prevTime;
global prevTime = curTime;
if( deltaTime > 1/15 )
deltaTime = 1/15;
process_threads( deltaTime );
SS_Present();
}
function on_event( e )
{
if( e.type == SDL_QUIT )
global sys_exit = true;
}
Comments