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.

190 lines
4.2 KiB
C++

#include <lowlevellib.h>
int loadFont2(const char * filename, s_font &font)
{
return llgfx_LoadFont(filename,&font);
}
int loadFont(const char * filename, s_font &font)
{
return llgfx_LoadFont(filename,&font);
}
void drawstring(s_font &font, char *text){
SYS_ASSERT_PTR(text);
int startx = llgfx_text_xpos;
int c = 0;
s_rect bounding_rect;
ll2d::SetRectEmpty(bounding_rect);
ll2d::OffsetRect(bounding_rect,llgfx_text_xpos,llgfx_text_ypos);
while( 0 != ( c = *text++) )
{
if( c == '\n' || startx > llgfx_displaywidth )
{
llgfx_text_ypos += font.height;
if( llgfx_text_xpos > bounding_rect.x1 )
bounding_rect.x1 = llgfx_text_xpos;
llgfx_text_xpos = startx;
continue;
}
llgfx_sBLITFX blitfx;
blitfx.scale_x=2;
blitfx.scale_y=2;
blitfx.fixalpha = 0.7f;
blitfx.color=GOLD;
s_rect *srcrect = &font.crects[ c ];
if( srcrect->x2 != 0 ){
llgfx_BLIT( 0,
font.gfxid,
llgfx_text_xpos,
llgfx_text_ypos,
srcrect,
BLIT_FXMUL,
&blitfx
);
llgfx_text_xpos += ll2d::WIDTH(srcrect);
}
else
{
llgfx_text_xpos += font.width;
}
}
llgfx_text_ypos += font.height;
llgfx_text_xpos = startx;
}
int os_main(
int argc,
char **argv,
char **envp
)
{
if( llgfx_SetDisplayMode( 320, 240, 16, 0 ) ){
return -1;
}
//llgfx_id background = llgfx_LoadGfx("background.png",0);
llgfx_id background = llgfx_LoadGfx("background.tga",0);
//llgfx_id logo = llgfx_LoadGfx("one03.png",LLGFX_COLORKEY);
s_font font2;
//loadFont2("myriad_pro_black.png",font2);
llgfx_LoadFont("myriad_pro_black.png",&font2);
llgfx_id redpng = llgfx_LoadGfx("one01.png",LLGFX_COLORKEY);
llgfx_id one3 = llgfx_LoadGfx("one03.png",LLGFX_COLORKEY);
CFps fps;
fps.m_visible = true;
llgfx_SetFrameCount(redpng,LLGFX_FRAME_COUNT,2);
float blend = 1.0f;
while(osmain_endgame==false)
{
float difftime = llirq_GetDeltaTime();
blend = ll3d::Sin(ll3d::Mod(llirq_uptime,PI));
fps.Action(difftime);
llgfx_sBLITFX blitfx;
blitfx.fixalpha = blend;
blitfx.color = GREEN;
llgfx_TILE_BLIT(0,background,0,0,0,0,&blitfx);
//llgfx_ClearScreen(GREEN);
blitfx.fixalpha = 0.5;
blitfx.angle = blend*360;
blitfx.color = RED;
blitfx.scale_x = 8;
blitfx.scale_y = 8;
llgfx_DrawLine(0,0,120,320,120,GOLD);
llgfx_DrawLine(0,160,0,160,240,GOLD);
blitfx.angle = 33;
llgfx_SetColorKey(redpng,WHITE);
//llgfx_BLIT(0,redpng,0,0,0,BLIT_FXADD|BLIT_DST_CENTERED|BLIT_ROTATE,&blitfx);
int cnt = 1;
//llgfx_SetOrigin(redpng,100,10);
while(cnt--)
llgfx_BLIT(0,redpng,160,120,(s_rect*)0,BLIT_STRETCH|BLIT_FXCOLOR|BLIT_ROTATE|BLIT_SRC_ALPHA,&blitfx);
// llgfx_BLIT(0,redpng,0,0,0,BLIT_FXADD,&blitfx);
// llgfx_BLIT(0,redpng,0,0,0,BLIT_FXCOLOR,&blitfx);
// s_rect re;
// ll2d::SetRect(re,0,0,80,4);
//llgfx_id tmp = llgfx_ROTATE_BLIT(sysfont.gfxid,0,135,1,1);
//llgfx_id tmp = llgfx_ROTATE_BLIT(sysfont.gfxid,0,300,1,1);
// llgfx_id tmp = llgfx_ROTATE_BLIT(redpng,0,(int)(llirq_uptime)%360,1,1);
//llgfx_id tmp = llgfx_ROTATE_BLIT(redpng,0,44,1,1);
//llgfx_id tmp = llgfx_ROTATE_BLIT(background,0,(blend-0.5f)*90,1,1);
// llgfx_BLIT(0,tmp,160,120,0,BLIT_FXMUL|BLIT_DST_CENTERED,&blitfx);
// llgfx_ReleaseGfx(tmp);
//llgfx_TILE_BLIT(0,sysfont.gfxid);
llgfx_text_xpos = 0;
llgfx_text_ypos = 0;
//drawstring(font2,"Lowlevellib Demo 1.0\n");
//drawstring(font2,"made by APPRIV\n");
//drawstring(font2,"LEVEL ONE ENTERTAINMENT\n");
//drawstring(*llgfx_cur_font,"Europe Austria\n");
fps.Draw(0);
llgfx_SelectFont(&font2);
// llgfx_DrawText(0,"Lowlevellib Demo 1.0\ndrawstring(font2,\"LEVEL ONE ENTERTAINMENT\n",BLIT_SRCALPHA);
// llgfx_DrawText("Lowlevellib Demo 1.0\n", GOLD);
// llgfx_DrawText("Lowlevellib Demo 1.0\n", BLACK);
// llgfx_DrawText("Lowlevellib Demo 1.0\n", BLUE);
// llgfx_SelectFont(&font2);
// llgfx_DrawText(0,"Lowlevellib Demo 1.0\n");
llgfx_FlipScreen(1);
llirq_Sleep(10);
llinput_Update();
PtrInputEvent ev = llinput_GetEvent();
if(ev)
{
CDebug::WriteLn("ev.devicename =%s",ev->devicename);
CDebug::WriteLn("ev.eventname =%s",ev->eventname );
CDebug::WriteLn("ev.state =%x",ev->state );
CDebug::WriteLn("");
}
if( llinput_Keys[LLINPUT_KEY_B] )
blend = 1;
if( llinput_Keys[LLINPUT_KEY_A] )
osmain_endgame = true;
}
return 0;
}