Usermode/AxWin4 - Controls working, starting on text
[tpg/acess2.git] / Usermode / Applications / axwin4_src / UI / main.c
1 /*
2  * AxWin4 GUI - UI Core
3  * - By John Hodge (thePowersGang)
4  *
5  * main.c
6  * - Program core
7  */
8 #include <axwin4/axwin.h>
9 #include <assert.h>
10 #include "include/common.h"
11 #include "include/taskbar.h"
12
13 // === PROTOTYPES ===
14 tAxWin4_Window *CreateBGWin(int w, int h);
15
16 // === GLOABLS ===
17 unsigned int    giScreenWidth = 640;
18 unsigned int    giScreenHeight = 480;
19
20 // === CODE ===
21 int main(int argc, const char *argv[])
22 {
23         assert( AxWin4_Connect("ipcpipe:///Devices/ipcpipe/axwin4") );
24         
25         AxWin4_GetScreenDimensions(0, &giScreenWidth, &giScreenHeight);
26         
27         tAxWin4_Window *bgwin = CreateBGWin(giScreenWidth, giScreenHeight);
28         Taskbar_Create();
29         
30         _SysDebug("Beginning queue");
31         while( AxWin4_WaitEventQueue(0) )
32                 ;
33         _SysDebug("Clean exit");
34         
35         return 0;
36 }
37
38 tAxWin4_Window *CreateBGWin(int w, int h)
39 {
40         tAxWin4_Window  *bgwin = AxWin4_CreateWindow("background");
41         AxWin4_MoveWindow(bgwin, 0,0);
42         AxWin4_ResizeWindow(bgwin, w,h);
43         AxWin4_SetWindowFlags(bgwin, AXWIN4_WNDFLAG_NODECORATE|AXWIN4_WNDFLAG_KEEPBELOW);
44         
45         // Load background image
46         uint32_t *buf = AxWin4_GetWindowBuffer(bgwin);
47         for( size_t y = 0; y < h; y ++ )
48         {
49                 for(size_t x = 0; x < w; x ++ )
50                 {
51                         uint8_t r = y * 256 / h;
52                         uint8_t g = 0;
53                         uint8_t b = x * 256 / w;
54                         buf[y*w+x] = (r << 16) | (g << 8) | b;
55                 }
56         }
57         //AxWin4_DamageRect(bgwin, 0, 0, w, h);
58         AxWin4_ShowWindow(bgwin, true);
59         
60         return bgwin;
61 }
62

UCC git Repository :: git.ucc.asn.au