You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
3.9 KiB
C++
197 lines
3.9 KiB
C++
#include <lowlevellib.h>
|
|
|
|
|
|
int os_main(int argc, char **argv, char **envp )
|
|
{
|
|
llgfx_SetDisplayMode(320,240,16,0,0);
|
|
|
|
//llgfx_id back = llgfx_LoadGfx("background.png");
|
|
llgfx_id brik = llgfx_LoadGfx("brik.png");
|
|
|
|
llgfx_id logo = llgfx_LoadGfx("one01.png",0);
|
|
|
|
llgfx_SetColorKey(brik, WHITE ); // or 0xFFFFFF ;)
|
|
//its a animfile
|
|
llgfx_SetFrameCount(brik,LLGFX_FRAME_HEIGHT,200);
|
|
|
|
int cnt_frames = llgfx_GetFrameCount(brik);
|
|
|
|
s_font afont;
|
|
|
|
llgfx_LoadFont("myriad_pro_black.png",&afont);
|
|
llgfx_id font = afont.gfxid;
|
|
llgfx_DisableColorKey(font);
|
|
llgfx_SelectFont(&afont);
|
|
|
|
int cur_frame = 0;
|
|
float scalefaktor = 0.2f;
|
|
int blitflag = BLIT_DST_CENTERED|BLIT_STRETCH;
|
|
int x =0;
|
|
int oldkey = 0;
|
|
float effektfaktor = 0.8f;
|
|
int oldkeyc = 0;
|
|
|
|
while( osmain_endgame == false )
|
|
{
|
|
//llgfx_TILE_BLIT(0,back);
|
|
|
|
|
|
llgfx_sBLITFX blitfx;
|
|
blitfx.scale_x = scalefaktor;
|
|
blitfx.scale_y = scalefaktor;
|
|
blitfx.fixalpha = effektfaktor;
|
|
blitfx.color = GOLD;
|
|
|
|
scalefaktor += 0.05f;
|
|
llgfx_BLIT(0,brik,0,0,(s_rect*)cur_frame,blitflag,&blitfx);
|
|
|
|
blitfx.scale_x = scalefaktor / 2;
|
|
blitfx.scale_y = scalefaktor / 2;
|
|
llgfx_BLIT(0,logo,0,0,0,blitflag,&blitfx);
|
|
|
|
|
|
llgfx_SetTextPos(0,0);
|
|
llgfx_DisableColorKey(font);
|
|
|
|
switch(x)
|
|
{
|
|
default:
|
|
x=0;
|
|
case 0:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH;
|
|
llgfx_DrawText("BLIT_STRETCH");
|
|
break;
|
|
case 1:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXBLEND;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXBLEND");
|
|
break;
|
|
case 2:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXADD;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXADD");
|
|
break;
|
|
case 3:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXSUB;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXSUB");
|
|
break;
|
|
case 4:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXDIFF;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXDIFF");
|
|
break;
|
|
case 5:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXDARKEN;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXDARKEN");
|
|
break;
|
|
case 6:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_RASTER;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_RASTER");
|
|
break;
|
|
case 7:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_SCANLINES;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_SCANLINES");
|
|
break;
|
|
case 8:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXMUL;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXMUL");
|
|
break;
|
|
case 9:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXINVMUL;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXINVMUL");
|
|
break;
|
|
case 10:
|
|
blitflag = BLIT_DST_CENTERED|BLIT_STRETCH|BLIT_FXLIGHTEN;
|
|
llgfx_DrawText("BLIT_STRETCH|BLIT_FXLIGHTEN");
|
|
break;
|
|
}
|
|
|
|
llgfx_SetTextPos(0,240-afont.height);
|
|
llgfx_EnableColorKey(font);
|
|
char buf[256];
|
|
sprintf(buf,"[A]restart, [B]Blitfx, [X]Effekt: %01.1f",effektfaktor);
|
|
llgfx_DrawText(buf);
|
|
|
|
|
|
llgfx_FlipScreen(true);
|
|
llirq_Sleep(25);
|
|
|
|
cur_frame++;
|
|
if( cur_frame == cnt_frames )
|
|
cur_frame = cnt_frames -1;
|
|
|
|
if( llinput_Keys[LLINPUT_KEY_A] )
|
|
{
|
|
cur_frame = 0;
|
|
scalefaktor = 0;
|
|
}
|
|
|
|
if( llinput_Keys[LLINPUT_KEY_B] )
|
|
{
|
|
if( oldkey == 0 )
|
|
{
|
|
oldkey = 1;
|
|
x++;
|
|
}
|
|
}
|
|
else
|
|
oldkey = 0;
|
|
|
|
|
|
if( llinput_Keys[LLINPUT_KEY_X] )
|
|
{
|
|
if( oldkeyc == 0 )
|
|
{
|
|
oldkeyc = 1;
|
|
effektfaktor += 0.1f;
|
|
if( effektfaktor >= 1.1f )
|
|
effektfaktor = 0.0f;
|
|
}
|
|
}
|
|
else
|
|
oldkeyc = 0;
|
|
|
|
|
|
llinput_Update();
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
/*
|
|
void DrawSprites(float x);
|
|
float scalefaktor;
|
|
float x_pos;
|
|
|
|
#define SPEED (1.0f/100) // 100 Pixel per Second
|
|
|
|
void FrameLoop_MaxFPS_with_Timer()
|
|
{
|
|
while( osmain_endgame == false )
|
|
{
|
|
float delta = llirq_GetDeltaTime();
|
|
|
|
x_pos += SPEED * delta;
|
|
DrawSprites(x_pos);
|
|
|
|
|
|
llgfx_FlipScreen(true);
|
|
llinput_Update();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void FrameLoop_No_Timer()
|
|
{
|
|
while( osmain_endgame == false )
|
|
{
|
|
x_pos += 1;
|
|
DrawSprites(x_pos);
|
|
|
|
|
|
llgfx_FlipScreen(true);
|
|
llirq_Sleep(10); // 100fps
|
|
llinput_Update();
|
|
}
|
|
}
|
|
|
|
*/ |