55
66void thread0 ();
77void thread1 ();
8+ void thread2 ();
89
910static OSIF_WindowFrameBufferInfo createWindow (const char * const title )
1011{
@@ -26,8 +27,9 @@ static OSIF_WindowFrameBufferInfo createWindow (const char* const title)
2627void proc_main ()
2728{
2829 os_window_flush_graphics ();
29- os_thread_create (& thread0 , false);
3030 os_thread_create (& thread1 , false);
31+ os_thread_create (& thread2 , false);
32+ os_thread_create (& thread0 , false);
3133
3234 while (1 ) {
3335 if (os_process_is_yield_requested ()) {
@@ -38,48 +40,68 @@ void proc_main()
3840
3941void thread0 ()
4042{
41- #if GRAPHICS_BPP == 8
42- UINT color = 0x1 ;
43- const UINT WHITE = 0xF ;
44- #elif GRAPHICS_BPP == 32 || GRAPHICS_BPP == 24
45- UINT color = 0x0000FF ;
46- const UINT WHITE = 0xFFFFFFF ;
47- #endif
43+ UINT color = 0x5F9FFF ;
4844 INT x = 0 ;
4945 INT width = 20 ;
50- OSIF_WindowFrameBufferInfo fbi = createWindow ("gui0 - Window 1" );
46+ OSIF_WindowFrameBufferInfo fbi = createWindow ("gui0 - Window 3" );
47+ graphics_rect (& fbi , 0 , 0 , fbi .width_px , fbi .height_px , 0x0 );
5148 while (1 ) {
5249 if ((UINT )(x + width ) >= fbi .width_px ) {
5350 x = 0 ;
54- graphics_rect (& fbi , 0 , 0 , fbi .width_px , fbi .height_px , WHITE );
51+ graphics_rect (& fbi , 0 , 0 , fbi .width_px , fbi .height_px , 0x0 );
5552 }
5653 graphics_rect (& fbi , (UINT )x , 0 , (UINT )width , fbi .height_px , color );
5754 x += width + 3 ;
58- delay ( 10 );
55+
5956 os_window_flush_graphics ();
57+ delay (500 );
6058 }
6159}
6260
6361void thread1 ()
6462{
65- #if GRAPHICS_BPP == 8
66- UINT color = 0x4 ;
67- const UINT WHITE = 0xF ;
68- #elif GRAPHICS_BPP == 32 || GRAPHICS_BPP == 24
69- UINT color = 0xFF0000 ;
70- const UINT WHITE = 0xFFFFFFF ;
71- #endif
72- INT y = 0 ;
73- INT height = 10 ;
74- OSIF_WindowFrameBufferInfo fbi = createWindow ("gui0 - Window 2" );
63+ OSIF_WindowFrameBufferInfo fbi = createWindow ("gui0 - Window 1" );
64+ int modby = 1 ;
65+ int incby = 1 ;
7566 while (1 ) {
76- if ((UINT )(y + height ) >= fbi .height_px ) {
77- y = 0 ;
78- graphics_rect (& fbi , 0 , 0 , fbi .width_px , fbi .height_px , WHITE );
67+ if (modby == 10 ) {
68+ incby = -1 ;
69+ } else if (modby == 1 ) {
70+ incby = 1 ;
71+ }
72+ modby += incby ;
73+
74+ for (unsigned int x = 0 ; x < fbi .width_px ; x ++ ) {
75+ for (unsigned int y = 0 ; y < fbi .height_px ; y ++ ) {
76+ UINT color = (20 * (UINT )modby & 255 ) << 16 ;
77+ graphics_putpixel (& fbi , x , y , color );
78+ }
7979 }
80- graphics_rect (& fbi , 0 , (UINT )y , fbi .width_px , (UINT )height , color );
81- y += height + 3 ;
80+ os_window_flush_graphics ();
8281 delay (100 );
82+ }
83+ }
84+
85+ void thread2 ()
86+ {
87+ OSIF_WindowFrameBufferInfo fbi = createWindow ("gui0 - Window 2" );
88+ int modby = 1 ;
89+ int incby = 1 ;
90+ while (1 ) {
91+ if (modby == 10 ) {
92+ incby = -1 ;
93+ } else if (modby == 1 ) {
94+ incby = 1 ;
95+ }
96+ modby += incby ;
97+
98+ for (unsigned int x = 0 ; x < fbi .width_px ; x ++ ) {
99+ for (unsigned int y = 0 ; y < fbi .height_px ; y ++ ) {
100+ UINT color = ((x + y ) * (UINT )modby & 255 ) << 8 ;
101+ graphics_putpixel (& fbi , x , y , color );
102+ }
103+ }
83104 os_window_flush_graphics ();
105+ delay (80 );
84106 }
85107}
0 commit comments