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.

133 lines
2.5 KiB
C++

#include <lowlevellib.h>
static int loadFont2(const char * filename, s_font &font)
{
return llgfx_LoadFont(filename,&font);
}
static int loadFont(const char * filename, s_font &font)
{
memset(&font,0,sizeof(s_font));
llgfx_id sysfont = llgfx_LoadGfx(filename,LLGFX_COLORKEY);
SYS_ASSERT(sysfont);
font.gfxid = sysfont;
font.width = 10;
font.height = 10;
#define sys_font10 font.rects
#include "sys_font10.h"
return OK;
}
static 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
)
{
llgfx_SetDisplayMode( 320, 240, 16, 0 );
llgfx_id background = llgfx_LoadGfx("background2.png",0);
llgfx_id logo = llgfx_LoadGfx("one03.png",LLGFX_COLORKEY);
s_font sysfont;
loadFont("sys_font.png",sysfont);
s_font font2;
loadFont2("myriad_pro_black.png",font2);
llgfx_id redpng = llgfx_LoadGfx("red.png");
float blend = 1.0f;
while(osmain_endgame==false)
{
float difftime = llirq_GetDeltaTime();
blend = ll3d::Sin(ll3d::Mod(llirq_uptime,PI));
llgfx_sBLITFX blitfx;
blitfx.fixalpha = blend;
blitfx.color = GREEN;
llgfx_TILE_BLIT(0,background,0,0,0,0,&blitfx);
blitfx.fixalpha = 1.0f-blend;
llgfx_BLIT(0,font2.gfxid,0,0,0,BLIT_FXDIFF,&blitfx);
blitfx.fixalpha = 1;
llgfx_BLIT(0,logo,0,0,0,BLIT_FXINVMUL,&blitfx);
blitfx.fixalpha = 0.5;
blitfx.color = RED;
llgfx_BLIT(0,logo,0,120,0,BLIT_FXCOLOR,&blitfx);
llgfx_FlipScreen(1);
llirq_Sleep(10);
llinput_Update();
if( llinput_Keys[LLINPUT_KEY_B] )
blend = 1;
if( llinput_Keys[LLINPUT_KEY_A] )
osmain_endgame = true;
}
return 0;
}