Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
298 | serge | 1 | #include |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | #include"libmgfx.h" |
||
6 | |||
7 | #define SPLASH_FILE "splash.jpg" |
||
8 | |||
9 | static int splash_thread_pid; |
||
10 | static char * splash_thread_stk; |
||
11 | static mgfx_image_t * splash=NULL; |
||
12 | static int xres,yres,bpp,bpscan; |
||
13 | |||
14 | void I_EndSplash(void); |
||
15 | |||
16 | static void repaint_splash_wnd(void) |
||
17 | { |
||
18 | __menuet__window_redraw(1); |
||
19 | __menuet__define_window( |
||
20 | (xres-splash->width)>>1, |
||
21 | (yres-splash->height)>>1, |
||
22 | splash->width, |
||
23 | splash->height+20, |
||
24 | 0x01000000, |
||
25 | 0x00000000, |
||
26 | 0x00000000); |
||
27 | paint_image(0,0,splash); |
||
28 | __menuet__window_redraw(2); |
||
29 | } |
||
30 | |||
31 | static int __tmp=0; |
||
32 | |||
33 | static void splash_thread(void) |
||
34 | { |
||
35 | __menuet__dga_get_caps(&xres,&yres,&bpp,&bpscan); |
||
36 | repaint_splash_wnd(); |
||
37 | for(;;) |
||
38 | { |
||
39 | __menuet__delay100(5); |
||
40 | __menuet__bar(0,splash->height+1,splash->width,20,0); |
||
41 | __menuet__bar(0,splash->height+1,__tmp,20,0x404040); |
||
42 | __tmp+=4; |
||
43 | if(__tmp>=splash->width) __tmp=0; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | void I_BeginSplash(void) |
||
48 | { |
||
49 | init_mgfx_library(); |
||
50 | if(load_image(SPLASH_FILE,&splash)!=_PIC_OK) |
||
51 | { |
||
52 | splash=NULL; |
||
53 | __libclog_printf("Unable to open %s for splash screen !!!\n",SPLASH_FILE); |
||
54 | return; |
||
55 | } |
||
56 | splash_thread_stk=__menuet__exec_thread(splash_thread,4096,&splash_thread_pid); |
||
57 | if(splash_thread_pid<1) |
||
58 | { |
||
59 | __libclog_printf("Unable to create splash screen thread\n"); |
||
60 | // I_EndSplash(); |
||
61 | return; |
||
62 | } |
||
63 | __libclog_printf("Splash screen created\n"); |
||
64 | } |
||
65 | |||
66 | void I_EndSplash(void) |
||
67 | { |
||
68 | int i; |
||
69 | if(!splash) return; |
||
70 | if(splash_thread_pid>1) |
||
71 | __asm__ __volatile__("int $0x40"::"a"(18),"b"(2),"c"(splash_thread_pid)); |
||
72 | free_image(splash); |
||
73 | free(splash); |
||
74 | splash=NULL; |
||
75 | free(splash_thread_stk); |
||
76 | }1) |