| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1566,7 +1566,6 @@ void test_gui__scrollbars( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								gui_push_parent(context, scrollbox_layout); | 
					 | 
					 | 
					 | 
								gui_push_parent(context, scrollbox_layout); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								{ | 
					 | 
					 | 
					 | 
								{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									static GUI_Node_Reference scrollregion_layout = {0}; | 
					 | 
					 | 
					 | 
									static GUI_Node_Reference scrollregion_layout = {0}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									static GUI_Node_Reference scrollbar_layout = {0}; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									static GUI_Size  scrollregion_size[2] = { | 
					 | 
					 | 
					 | 
									static GUI_Size  scrollregion_size[2] = { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										{GUI_SIZERULE_PERCENTOFPARENT,  90, 100}, | 
					 | 
					 | 
					 | 
										{GUI_SIZERULE_PERCENTOFPARENT,  90, 100}, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										{GUI_SIZERULE_PERCENTOFPARENT, 100, 100}}; | 
					 | 
					 | 
					 | 
										{GUI_SIZERULE_PERCENTOFPARENT, 100, 100}}; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1613,6 +1612,7 @@ void test_gui__scrollbars( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									} gui_pop_subtree(context); | 
					 | 
					 | 
					 | 
									} gui_pop_subtree(context); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#endif | 
					 | 
					 | 
					 | 
					#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#if 0 | 
					 | 
					 | 
					 | 
					#if 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
									static GUI_Node_Reference scrollbar_layout = {0}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									scrollbar_layout = gui_layout( | 
					 | 
					 | 
					 | 
									scrollbar_layout = gui_layout( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										context, scrollbar_layout, GUI_LAYOUT_VERTICAL, | 
					 | 
					 | 
					 | 
										context, scrollbar_layout, GUI_LAYOUT_VERTICAL, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										&outer_style, scrollbar_size); | 
					 | 
					 | 
					 | 
										&outer_style, scrollbar_size); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -2121,13 +2121,8 @@ void fill_pixel_buffer( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void draw_pixel_buffer( | 
					 | 
					 | 
					 | 
					void draw_window( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						unsigned int width, | 
					 | 
					 | 
					 | 
						X11_Window *xwindow) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						unsigned int height, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						Display *game_display, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						Window game_window, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						XImage *game_image, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						GC x_graphics_context) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/*
 | 
					 | 
					 | 
					 | 
						/*
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						int XPutImage(Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int | 
					 | 
					 | 
					 | 
						int XPutImage(Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -2135,13 +2130,13 @@ void draw_pixel_buffer( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						*/ | 
					 | 
					 | 
					 | 
						*/ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						int error = XPutImage( | 
					 | 
					 | 
					 | 
						int error = XPutImage( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							game_display, | 
					 | 
					 | 
					 | 
							xwindow->display, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							game_window, | 
					 | 
					 | 
					 | 
							xwindow->window, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							x_graphics_context, | 
					 | 
					 | 
					 | 
							xwindow->graphics_context, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							game_image, | 
					 | 
					 | 
					 | 
							xwindow->screen_image, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							0, 0, | 
					 | 
					 | 
					 | 
							0, 0, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							0, 0, | 
					 | 
					 | 
					 | 
							0, 0, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							width, height); | 
					 | 
					 | 
					 | 
							xwindow->width, xwindow->height); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						assert(error == 0); | 
					 | 
					 | 
					 | 
						assert(error == 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3114,7 +3109,7 @@ int init_x11( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						XImage *game_image = XCreateImage( | 
					 | 
					 | 
					 | 
						XImage *screen_image = XCreateImage( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->display, | 
					 | 
					 | 
					 | 
							xwindow->display, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->visual, | 
					 | 
					 | 
					 | 
							xwindow->visual, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							XDefaultDepth(xwindow->display, xwindow->screen), | 
					 | 
					 | 
					 | 
							XDefaultDepth(xwindow->display, xwindow->screen), | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -3128,35 +3123,14 @@ int init_x11( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							8, // NOTE(Zelaven): No clue
 | 
					 | 
					 | 
					 | 
							8, // NOTE(Zelaven): No clue
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							// NOTE(Zelaven): This is how many bytes there are in a row of pixels.
 | 
					 | 
					 | 
					 | 
							// NOTE(Zelaven): This is how many bytes there are in a row of pixels.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->width * sizeof(uint32_t)); | 
					 | 
					 | 
					 | 
							xwindow->width * sizeof(uint32_t)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						assert(game_image != NULL); | 
					 | 
					 | 
					 | 
						assert(screen_image != NULL); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						fill_pixel_buffer( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							pixels, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->width, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->height, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							0, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						draw_rect( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							pixels, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->width, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow->height, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							20, 40, 25, 50, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							0xFFFF00); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						GUI_Draw_Command my_draw_command = { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.rectangle = {60, 60, 100, 90}, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.color = 0xFF00FF, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						xwindow->pixel_buffer = (Pixel_Buffer){ | 
					 | 
					 | 
					 | 
						xwindow->pixel_buffer = (Pixel_Buffer){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.pixels = (GUI_Color*)pixels, | 
					 | 
					 | 
					 | 
							.pixels = (GUI_Color*)pixels, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.width = xwindow->width, | 
					 | 
					 | 
					 | 
							.width = xwindow->width, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.height = xwindow->height, | 
					 | 
					 | 
					 | 
							.height = xwindow->height, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}; | 
					 | 
					 | 
					 | 
						}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						draw_rect2( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							&xwindow->pixel_buffer, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							&my_draw_command); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						xwindow->screen_image = game_image; | 
					 | 
					 | 
					 | 
						xwindow->screen_image = screen_image; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						return EXIT_SUCCESS; | 
					 | 
					 | 
					 | 
						return EXIT_SUCCESS; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3406,6 +3380,32 @@ void gui_draw_text( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#endif | 
					 | 
					 | 
					 | 
					#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					void gui_draw_image_direct( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						Pixel_Buffer *pixel_buffer, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						Pixel_Buffer *image, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						int off_x, int off_y) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						if(image == NULL) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						int w = image->width; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						int h = image->height; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						for(int j=0; j < h; ++j) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							for(int i=0; i < w; ++i) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								int image_x = i; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								int image_y = j; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								int image_index = image_y * w + image_x; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								GUI_Color pixel = image->pixels[image_index]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								SET_PIXEL(pixel_buffer, off_x+i, off_y+j, pixel); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void gui_draw_image( | 
					 | 
					 | 
					 | 
					void gui_draw_image( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						Pixel_Buffer *pixel_buffer, | 
					 | 
					 | 
					 | 
						Pixel_Buffer *pixel_buffer, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						GUI_Draw_Command *draw_command) | 
					 | 
					 | 
					 | 
						GUI_Draw_Command *draw_command) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3589,16 +3589,24 @@ void gui_layout_and_draw_subtree( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void gui_layout_and_draw(GUI_Context *context) | 
					 | 
					 | 
					 | 
					void gui_layout_and_draw(GUI_Context *context) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						// TODO(Zelaven): Handle all layers.
 | 
					 | 
					 | 
					 | 
						// TODO(Zelaven): Make the layers in the context iteratable.
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						GUI_Layer *layers[] = { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							&context->background_layer, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							&context->top_layer, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for( | 
					 | 
					 | 
					 | 
						for( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							GUI_Subtree *current = (GUI_Subtree*)context->background_layer.subtree_rdic.root; | 
					 | 
					 | 
					 | 
							size_t i = 0; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							current != NULL; | 
					 | 
					 | 
					 | 
							i < ARRAYLENGTH(layers); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							current = NULL)//current->next)
 | 
					 | 
					 | 
					 | 
							i++) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						{ | 
					 | 
					 | 
					 | 
						{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							GUI_Layer *layer = layers[i]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							GUI_Subtree *subtree_root = (GUI_Subtree*)layer->subtree_rdic.root; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if(subtree_root != NULL) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								gui_layout_and_draw_subtree( | 
					 | 
					 | 
					 | 
								gui_layout_and_draw_subtree( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									context, | 
					 | 
					 | 
					 | 
									context, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								current, | 
					 | 
					 | 
					 | 
									subtree_root, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								context->background_layer.pixel_buffer); | 
					 | 
					 | 
					 | 
									layer->pixel_buffer); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3691,34 +3699,6 @@ int main(void) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.x0 = 0, .y0 = 0, | 
					 | 
					 | 
					 | 
							.x0 = 0, .y0 = 0, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							.x1 = xwindow.width, .y1 = xwindow.height, | 
					 | 
					 | 
					 | 
							.x1 = xwindow.width, .y1 = xwindow.height, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}; | 
					 | 
					 | 
					 | 
						}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						//gui(&context, screen_rectangle);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						//gui_layout_nodes(&context);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#if 0 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						gui_generate_draw_commands( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							context.root, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							&draw_command_arena, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							&context.num_draw_commands); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						GUI_Draw_Command *draw_commands = (GUI_Draw_Command*)(draw_command_arena.memory); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for(int i = 0; i < context.num_draw_commands; i++) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							draw_rect2( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								&pixel_buffer, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								&draw_commands[i]); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for(int i = 4; i < 100; i += 5) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							pixel_buffer.pixels[i*xwindow.width + 10] = 0x0000FFFF; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						draw_pixel_buffer( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow.width, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow.height, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow.display, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow.window, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow.screen_image, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							xwindow.graphics_context); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#endif | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						//getc(stdin);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						bool running = true; | 
					 | 
					 | 
					 | 
						bool running = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						while(running) | 
					 | 
					 | 
					 | 
						while(running) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3935,37 +3915,9 @@ int main(void) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									0, 0, 512, 100); | 
					 | 
					 | 
					 | 
									0, 0, 512, 100); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								//SET_PIXEL(&xwindow.pixel_buffer, 100, 100, 0x00ffffff);
 | 
					 | 
					 | 
					 | 
								//SET_PIXEL(&xwindow.pixel_buffer, 100, 100, 0x00ffffff);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								#endif | 
					 | 
					 | 
					 | 
								#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								draw_pixel_buffer( | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xwindow.width, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xwindow.height, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xwindow.display, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xwindow.window, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xwindow.screen_image, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xwindow.graphics_context); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								#if 1 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								// NOTE(Zelaven): What does this _really_ do and why would you want it?
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								//XClearWindow(xwindow.display, xwindow.window);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								/*
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								GUI_Draw_Command *draw_command = | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									(GUI_Draw_Command*)(draw_command_arena.memory); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								for(int i = 0; i < context.num_draw_commands; i++) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									//xstuff_filled_rect(&xwindow, draw_command+i);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									xstuff_draw_rect( | 
					 | 
					 | 
					 | 
								draw_window(&xwindow); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										&xwindow, | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										draw_command+i); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								} | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								*/ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								//xstuff_blit_window(
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								//	&xwindow);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								XFlush(xwindow.display); | 
					 | 
					 | 
					 | 
								XFlush(xwindow.display); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								#endif | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |