#include "../bob64/app.h" #include "../bob64/gfx.h" #include "../bob64/widgets.h" #define DEMO_WIDTH 640u #define DEMO_HEIGHT 400u static u32 pixels[DEMO_WIDTH*DEMO_HEIGHT]; static const BOB64_RECT close_button={552,8,72,22}; static BOB64_BUTTON_STATE close_state; static void draw_demo(BOB64_GFX *graphics) { u32 width=graphics->Width,height=graphics->Height; s32 margin=(s32)(width/40u); s32 header_height=(s32)(height/7u); s32 panel_y=(s32)(height/3u); u32 panel_width=(width-(u32)(margin*5))/4u; u32 panel_height=height/4u; bob64_gfx_fill_rect(graphics,0,0,width,height,0x101a2au); bob64_gfx_fill_rect(graphics,margin,margin,width-(u32)(margin*2), height-(u32)(margin*2),0x1b2b40u); bob64_gfx_fill_rect(graphics,margin,margin,width-(u32)(margin*2), (u32)header_height,0x345d89u); bob64_gfx_text(graphics,margin*2,margin*2,"BOB64 GRAPHICS DEMO", 0x00ffffffu,3); (void)bob64_button_draw(graphics,&close_button,"CLOSE",&close_state); bob64_gfx_line(graphics,margin,header_height+margin*2, (s32)width-margin,header_height+margin*2,0x00f0c879u); bob64_gfx_text(graphics,margin*2,panel_y-margin*2, "LINES RECTANGLES AND COLORS",0x00d7e5f5u,2); const u32 colors[]={0x00e85d75u,0x00edaa42u,0x004fc3a1u,0x005e8ee8u}; for(u32 i=0;i<4;i++) { s32 x=margin+(s32)(i*(panel_width+(u32)margin)); s32 y=panel_y; bob64_gfx_fill_rect(graphics,x,y,panel_width,panel_height,colors[i]); bob64_gfx_fill_rect(graphics,x+8,y+8,panel_width-16, panel_height-16,0x00223248u); bob64_gfx_line(graphics,x+14,y+panel_height-18, x+(s32)panel_width-14,y+18,colors[i]); bob64_gfx_line(graphics,x+14,y+18, x+(s32)panel_width-14,y+panel_height-18,colors[i]); } bob64_gfx_fill_rect(graphics,margin,panel_y+(s32)panel_height+margin, width-(u32)(margin*2),3,0x006d849fu); bob64_gfx_text(graphics,margin*2, (s32)height-margin*6,"CLICK CLOSE OR PRESS X / ESCAPE", 0x00ffffffu,2); } s64 bob64_app_main(const BOB64_APP_STARTUP *startup) { BOB64_GFX graphics; BOB64_EVENT event; u32 screen_width,screen_height; u64 window=0; s64 result=-1; if(!startup||startup->AbiVersion!=BOB64_APP_ABI_VERSION|| bob64_app_query_abi()!=BOB64_SYSCALL_ABI_VERSION|| bob64_app_get_display(&screen_width,&screen_height)|| screen_width