X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin4_src%2FUI%2Fmain.c;h=c831558dc40961a32753e8f6288a55f9735fe34a;hb=5f8480455a9e2172b15dfc7fb96480a68506c30d;hp=54eae0ff1f2f521b3143bf839f81a116f1b62b0b;hpb=f3bdde1ff0ec3cf20c1371a50eb37a0907fe00c5;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin4_src/UI/main.c b/Usermode/Applications/axwin4_src/UI/main.c index 54eae0ff..c831558d 100644 --- a/Usermode/Applications/axwin4_src/UI/main.c +++ b/Usermode/Applications/axwin4_src/UI/main.c @@ -7,37 +7,63 @@ */ #include #include +#include "include/common.h" +#include "include/taskbar.h" + +// === PROTOTYPES === +tAxWin4_Window *CreateBGWin(int w, int h); + +// === GLOABLS === +unsigned int giScreenWidth = 640; +unsigned int giScreenHeight = 480; // === CODE === int main(int argc, const char *argv[]) { assert( AxWin4_Connect("ipcpipe:///Devices/ipcpipe/axwin4") ); - tAxWin4_Window *bgwin = AxWin4_CreateWindow("background"); + AxWin4_GetScreenDimensions(0, &giScreenWidth, &giScreenHeight); - unsigned int w, h; - AxWin4_GetScreenDimensions(0, &w, &h); - - AxWin4_MoveWindow(bgwin, 0,0); - AxWin4_ResizeWindow(bgwin, w,h); - AxWin4_SetWindowFlags(bgwin, AXWIN4_WNDFLAG_NODECORATE|AXWIN4_WNDFLAG_KEEPBELOW); - AxWin4_ShowWindow(bgwin, true); - - - uint32_t *buf = AxWin4_GetWindowBuffer(bgwin); - _SysDebug("buf = %p", buf); - // Load image - uint32_t *image = malloc(w*h*4); - for(size_t i = 0; i < w*h; i ++ ) - image[i] = i*(0x1000000/w*h); + tAxWin4_Window *bgwin = CreateBGWin(giScreenWidth, giScreenHeight); + Taskbar_Create(); - //AxWin4_DrawBitmap(bgwin, 0, 0, w, h, (void*)image); - _SysDebug("Beginning queue"); - while( AxWin4_WaitEventQueue(0) ) ; _SysDebug("Clean exit"); return 0; } + +tAxWin4_Window *CreateBGWin(int w, int h) +{ + tAxWin4_Window *bgwin = AxWin4_CreateWindow("background"); + AxWin4_MoveWindow(bgwin, 0,0); + AxWin4_ResizeWindow(bgwin, w,h); + AxWin4_SetWindowFlags(bgwin, AXWIN4_WNDFLAG_NODECORATE|AXWIN4_WNDFLAG_KEEPBELOW); + + // Load background image + uint32_t *buf = AxWin4_GetWindowBuffer(bgwin); + if( buf ) + { + for( size_t y = 0; y < h; y ++ ) + { + for(size_t x = 0; x < w; x ++ ) + { + uint8_t r = y * 256 / h; + uint8_t g = 0; + uint8_t b = x * 256 / w; + buf[y*w+x] = (r << 16) | (g << 8) | b; + } + } + } + else + { + //AxWin4_FillRect(bgwin, 0, 0, w, h, 0x0000CC); + } + //AxWin4_DamageRect(bgwin, 0, 0, w, h); + AxWin4_ShowWindow(bgwin, true); + + return bgwin; +} +