void CL_RenderBatch3D::flush(CL_GraphicContext &gc)
{
	if (position > 0)
	{
		gc.set_modelview(CL_Mat4f::identity());
		gc.set_program_object(cl_program_sprite);

		if (use_glyph_program)
		{
			CL_BlendMode old_blend_mode = gc.get_blend_mode();
			CL_BlendMode blend_mode;
			blend_mode.set_blend_color(constant_color);
			blend_mode.set_blend_function(cl_blend_constant_color, cl_blend_one_minus_src_color, cl_blend_zero, cl_blend_one);
			gc.set_blend_mode(blend_mode);

			for (int i = 0; i < num_current_textures; i++)
				gc.set_texture(i, current_textures[i]);
			CL_PrimitivesArray prim_array(gc);
			prim_array.set_attributes(0, &vertices[0].position, sizeof(SpriteVertex));
			prim_array.set_attributes(1, &vertices[0].color, sizeof(SpriteVertex));
			prim_array.set_attributes(2, &vertices[0].texcoord, sizeof(SpriteVertex));
			prim_array.set_attributes(3, &vertices[0].texindex, sizeof(SpriteVertex));
			gc.draw_primitives(cl_triangles, position, prim_array);
			for (int i = 0; i < num_current_textures; i++)
				gc.reset_texture(i);

			gc.set_blend_mode(old_blend_mode);
		}
		else
		{
			for (int i = 0; i < num_current_textures; i++)
				gc.set_texture(i, current_textures[i]);
			CL_PrimitivesArray prim_array(gc);
			prim_array.set_attributes(0, &vertices[0].position, sizeof(SpriteVertex));
			prim_array.set_attributes(1, &vertices[0].color, sizeof(SpriteVertex));
			prim_array.set_attributes(2, &vertices[0].texcoord, sizeof(SpriteVertex));
			prim_array.set_attributes(3, &vertices[0].texindex, sizeof(SpriteVertex));
			gc.draw_primitives(cl_triangles, position, prim_array);
			for (int i = 0; i < num_current_textures; i++)
				gc.reset_texture(i);
		}

		gc.reset_program_object();
		gc.set_modelview(modelview);
		position = 0;
		for (int i = 0; i < num_current_textures; i++)
			current_textures[i] = CL_Texture();
		num_current_textures = 0;
	}
}
Example #2
0
void Options::on_render(CL_GraphicContext &gc, const CL_Rect &update_rect)
{
	CL_BlendMode blendmode;
	blendmode.enable_blending(false);
	gc.set_blend_mode(blendmode);
	CL_Draw::fill(gc, update_rect, CL_Colorf(0.4f, 0.4f, 0.6f, 0.0f));
	gc.reset_blend_mode();
}
Example #3
0
	static int main(const std::vector<CL_String> &args)
	{
		try
		{
			CL_SetupCore setup_core; 
			CL_SetupDisplay setup_disp;
			CL_SetupGL setup_gl;

			CL_DisplayWindow window("Viewport Grid Test", 640, 480, false, true);
			CL_GraphicContext gc = window.get_gc();
			
			CL_BlendMode blend_mode1;
			blend_mode1.enable_blending(true);
			gc.set_blend_mode(blend_mode1);

			gc.set_map_mode(cl_map_2d_upper_left);

			while(!window.get_ic().get_keyboard().get_keycode(CL_KEY_ESCAPE))
			{
				gc.clear(CL_Colorf::white);
				CL_Rect viewport = window.get_viewport();
				for (int y = viewport.top; y < viewport.bottom; y+=2)
				{
					CL_Draw::line(gc, viewport.left, y, viewport.right, y, CL_Colorf::black);
				}
				for (int x = viewport.left; x < viewport.right; x+=2)
				{
					CL_Draw::line(gc, x, viewport.top, x, viewport.bottom, CL_Colorf::black);
				}

				window.flip(1);
				CL_KeepAlive::process();

				CL_System::sleep(10);
			}

			return 0;
		}
		catch(CL_Exception error)
		{
			CL_ConsoleWindow console("Console");
			CL_Console::write_line("Exception caught:");
			CL_Console::write_line(error.message);
			console.display_close_message();

			return -1;
		}

		return 0;
	}
Example #4
0
	static int main(const std::vector<CL_String> &args)
	{
		CL_SetupCore setup_core; 
		CL_SetupDisplay setup_disp;
		CL_SetupGL setup_gl;

		CL_ConsoleWindow console("Console");

		try
		{
			CL_DisplayWindow window("über sprite test", 1024, 1024);
			CL_GraphicContext gc = window.get_gc();
			
			CL_BlendMode blend_mode1;
			blend_mode1.enable_blending(true);
			gc.set_blend_mode(blend_mode1);

			gc.set_map_mode(cl_map_2d_upper_left);

			CL_Sprite background(gc, "Images/background.png");
			CL_Sprite test1_facit(gc, "Images/test1_facit.png");

			CL_Sprite testsprite1(gc, "Images/testsprite1.png");

//			CL_PixelBuffer buffer = CL_ImageProviderFactory::load("Images/pacman.pcx");
//			int texture_width = buffer.get_width();
//			int texture_height = buffer.get_height();
//			CL_Texture texture(gc, texture_width, texture_height);
//			texture.set_image(buffer);
//			CL_SpriteDescription desc_pacman;
//			desc_pacman.add_gridclipped_frames(texture, 126, 93, 26, 30, 12, 2, 2, 2);
//			CL_Sprite spr_pacman(desc_pacman, gc);

			bool quit = false;

//			CL_SpriteRenderBatch batch(gc);

			while((!quit) && (!window.get_ic().get_keyboard().get_keycode(CL_KEY_ESCAPE)))
			{
				if(window.get_ic().get_keyboard().get_keycode(CL_KEY_SPACE))
				{
					test1_facit.draw(gc, 0, 0);
				}
				else
				{
					background.draw(gc, 0, 0);

					// Normal
					testsprite1.draw(gc, 56, 91);
//					testsprite1.draw(batch, 56, 91 + 128);
					testsprite1.draw(
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(56, 91 + 256, 56 + testsprite1.get_width(), 91 + 256 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(56, 91 + 384, 56 + testsprite1.get_width(), 91 + 384 + testsprite1.get_height()));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(56, 91 + 512, 56 + testsprite1.get_width(), 91 + 512 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(56, 91 + 640, 56 + testsprite1.get_width(), 91 + 640 + testsprite1.get_height()));
*/
					// Scale - Note: Src/Dest functions doesn't care about scale-settings
					testsprite1.set_scale(2.0, 2.0);
					testsprite1.draw(gc, 128 + 56, 91);
//					testsprite1.draw(batch, 128 + 56, 91 + 128);
					testsprite1.draw(	
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(128 + 56, 91 + 256, 128 + 56 + testsprite1.get_width() * 2, 91 + 256 + testsprite1.get_height() * 2));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(128 + 56, 91 + 384, 128 + 56 + testsprite1.get_width() * 2, 91 + 384 + testsprite1.get_height() * 2));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(128 + 56, 91 + 512, 128 + 56 + testsprite1.get_width() * 2, 91 + 512 + testsprite1.get_height() * 2));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(128 + 56, 91 + 640, 128 + 56 + testsprite1.get_width() * 2, 91 + 640 + testsprite1.get_height() * 2));
*/					testsprite1.set_scale(1.0, 1.0);

					// Rotate
					testsprite1.set_angle(CL_Angle(45.0, cl_degrees));
					testsprite1.draw(gc, 256 + 56, 91);
//					testsprite1.draw(batch, 256 + 56, 91 + 128);
					testsprite1.draw(	
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(256 + 56, 91 + 256, 256 + 56 + testsprite1.get_width(), 91 + 256 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(256 + 56, 91 + 384, 256 + 56 + testsprite1.get_width(), 91 + 384 + testsprite1.get_height()));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(256 + 56, 91 + 512, 256 + 56 + testsprite1.get_width(), 91 + 512 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(256 + 56, 91 + 640, 256 + 56 + testsprite1.get_width(), 91 + 640 + testsprite1.get_height()));
*/					testsprite1.set_angle(CL_Angle(0.0f, cl_degrees));

					// Scale / Rotate - default hotspot
					testsprite1.set_angle(CL_Angle(45.0f, cl_degrees));
					testsprite1.set_scale(2.0, 2.0);
					testsprite1.draw(gc, 384 + 56, 91);
//					testsprite1.draw(batch, 384 + 56, 91 + 128);
					testsprite1.draw(	
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(384 + 56, 91 + 256, 384 + 56 + testsprite1.get_width() * 2, 91 + 256 + testsprite1.get_height() * 2));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(384 + 56, 91 + 384, 384 + 56 + testsprite1.get_width() * 2, 91 + 384 + testsprite1.get_height() * 2));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(384 + 56, 91 + 512, 384 + 56 + testsprite1.get_width() * 2, 91 + 512 + testsprite1.get_height() * 2));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(384 + 56, 91 + 640, 384 + 56 + testsprite1.get_width() * 2, 91 + 640 + testsprite1.get_height() * 2));
*/					testsprite1.set_angle(CL_Angle(0.0f, cl_degrees));
					testsprite1.set_scale(1.0, 1.0);

					// Scale / Rotate - hotspot(0, 0)
					testsprite1.set_rotation_hotspot(origin_top_left, 0, 0);
					testsprite1.set_angle(CL_Angle(45.0f, cl_degrees));
					testsprite1.set_scale(2.0, 2.0);
					testsprite1.draw(gc, 512 + 56, 91);
//					testsprite1.draw(batch, 512 + 56, 91 + 128);
					testsprite1.draw(	
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(512 + 56, 91 + 256, 512 + 56 + testsprite1.get_width() * 2, 91 + 256 + testsprite1.get_height() * 2));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(512 + 56, 91 + 384, 512 + 56 + testsprite1.get_width() * 2, 91 + 384 + testsprite1.get_height() * 2));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(512 + 56, 91 + 512, 512 + 56 + testsprite1.get_width() * 2, 91 + 512 + testsprite1.get_height() * 2));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(512 + 56, 91 + 640, 512 + 56 + testsprite1.get_width() * 2, 91 + 640 + testsprite1.get_height() * 2));
*/					testsprite1.set_angle(CL_Angle(0.0f, cl_degrees));
					testsprite1.set_scale(1.0, 1.0);
					testsprite1.set_rotation_hotspot(origin_center, 0, 0);

					// Blend - TODO

					// Alignment - TODO
					testsprite1.set_alignment(origin_bottom_right, 0, 0);
					testsprite1.draw(gc, 768 + 56, 91);
//					testsprite1.draw(batch, 768 + 56, 91 + 128);
					testsprite1.draw(
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(768 + 56, 91 + 256, 768 + 56 + testsprite1.get_width(), 91 + 256 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(768 + 56, 91 + 384, 768 + 56 + testsprite1.get_width(), 91 + 384 + testsprite1.get_height()));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(768 + 56, 91 + 512, 768 + 56 + testsprite1.get_width(), 91 + 512 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(768 + 56, 91 + 640, 768 + 56 + testsprite1.get_width(), 91 + 640 + testsprite1.get_height()));
*/					testsprite1.set_color(CL_Color::white);
					testsprite1.set_alignment(origin_top_left, 0, 0);

					// Color
					testsprite1.set_color(CL_Color::yellow);
					testsprite1.draw(gc, 896 + 56, 91);
//					testsprite1.draw(batch, 896 + 56, 91 + 128);
					testsprite1.draw(
						gc, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(896 + 56, 91 + 256, 896 + 56 + testsprite1.get_width(), 91 + 256 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(0,0,testsprite1.get_width(),testsprite1.get_height()),
						CL_Rectf(896 + 56, 91 + 384, 896 + 56 + testsprite1.get_width(), 91 + 384 + testsprite1.get_height()));
*/					testsprite1.draw(
						gc, 
						CL_Rectf(896 + 56, 91 + 512, 896 + 56 + testsprite1.get_width(), 91 + 512 + testsprite1.get_height()));
/*					testsprite1.draw(
						batch, 
						CL_Rectf(896 + 56, 91 + 640, 896 + 56 + testsprite1.get_width(), 91 + 640 + testsprite1.get_height()));
*/					testsprite1.set_color(CL_Color::white);

//					batch.flush();
				}

				/*				CL_Draw::fill(gc, 
					0, 0, 
					640, 480, 
					CL_Color::green);

				CL_Draw::line(gc, 10,0,100,100, CL_Color::yellow);

				spr_pacman.set_frame(0);
				spr_pacman.draw(gc, 0, 0);

				CL_Draw::line(gc, 0,0,100,100, CL_Color::yellow);

				spr_pacman.set_frame(1);
				spr_pacman.draw(gc, 50, 0);

				spr_pacman.set_frame(2);
				spr_pacman.draw(gc, 100, 0);
*/
				window.flip(1);
				CL_KeepAlive::process();

				CL_System::sleep(10);
			}

			return 0;
		}
		catch(CL_Exception error)
		{
			CL_Console::write_line("Exception caught:");
			CL_Console::write_line(error.message);
			console.display_close_message();

			return -1;
		}

		return 0;
	}
Example #5
0
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	CL_OpenGLWindowDescription win_desc;
	//win_desc.set_version(3, 2, false);
	win_desc.set_allow_resize(true);
	win_desc.set_title("Point Sprite Example");
	win_desc.set_size(CL_Size( 800, 480 ), false);

	CL_DisplayWindow window(win_desc);
	CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close);
	CL_Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &App::on_input_up);

	CL_String theme;
	if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
		theme = "../../../Resources/GUIThemeAero";
	else if (CL_FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css"))
		theme = "../../../Resources/GUIThemeBasic";
	else
		throw CL_Exception("No themes found");

	CL_GUIWindowManagerTexture wm(window);
	CL_GUIManager gui(wm, theme);
	
	CL_GraphicContext gc = window.get_gc();

	// Deleted automatically by the GUI
	Options *options = new Options(gui, CL_Rect(0, 0, gc.get_size()));

	CL_Image image_grid(gc, "../Blend/Resources/grid.png");
	CL_Texture texture_particle(gc, "Resources/particle.png");
	float grid_width = (float) image_grid.get_width();
	float grid_height = (float) image_grid.get_height();

	grid_space = (float) (image_grid.get_width());

	setup_particles();

	CL_ShaderObject vertex_shader(gc, cl_shadertype_vertex, text_shader_vertex);
	if(!vertex_shader.compile())
	{
		throw CL_Exception(cl_format("Unable to compile vertex shader object: %1", vertex_shader.get_info_log()));
	}

	CL_ShaderObject fragment_shader(gc, cl_shadertype_fragment, text_shader_fragment);
	if(!fragment_shader.compile())
	{
		throw CL_Exception(cl_format("Unable to compile fragment shader object: %1", fragment_shader.get_info_log()));
	}

	CL_ProgramObject program_object(gc);
	program_object.attach(vertex_shader);
	program_object.attach(fragment_shader);
	program_object.bind_attribute_location(0, "InPosition");
	program_object.bind_attribute_location(1, "InColor");
	if (!program_object.link())
	{
		throw CL_Exception(cl_format("Unable to link program object: %1", program_object.get_info_log()));
	}

	options->request_repaint();

	unsigned int time_last = CL_System::get_time();

	while (!quit)
	{
		unsigned int time_now = CL_System::get_time();
		float time_diff = (float) (time_now - time_last);
		time_last = time_now;

		wm.process();
		wm.draw_windows(gc);

		int num_particles = options->num_particles;
		if (num_particles > max_particles)
			num_particles = max_particles;

		move_particles(time_diff, num_particles);

		const float grid_xpos = 10.0f;
		const float grid_ypos = 10.0f;

		// Draw the grid
		image_grid.draw(gc, grid_xpos, grid_ypos);

		if (num_particles > 0)
		{
			std::vector<CL_Vec2f> positions;
			std::vector<CL_Vec4f> colors;
			positions.resize(num_particles);
			colors.resize(num_particles);

			for (int cnt=0; cnt<num_particles; cnt++)
			{
				positions[cnt] = CL_Vec2f(grid_xpos + particles[cnt].xpos, grid_ypos + particles[cnt].ypos);
				switch (cnt % 3)
				{
					case 0:
						colors[cnt] = CL_Vec4f(1.0f, 0.0f, 0.0f, 1.0f);
						break;
					case 1:
						colors[cnt] = CL_Vec4f(0.0f, 1.0f, 0.0f, 1.0f);
						break;
					case 2:
						colors[cnt] = CL_Vec4f(0.0f, 0.0f, 1.0f, 1.0f);
						break;
				}
			};

			CL_BlendMode blend;
			blend.enable_blending(true);
			blend.set_blend_function(cl_blend_src_alpha, cl_blend_one, cl_blend_src_alpha, cl_blend_one);
			gc.set_blend_mode(blend);
			CL_Pen pen;
			pen.enable_point_sprite(true);
			pen.set_point_size(options->point_size);
			pen.set_point_sprite_origin(cl_point_sprite_origin_upper_left);
			gc.set_pen(pen);

			program_object.set_uniform1i("Texture0", 0);

			gc.set_texture(0, texture_particle);
			CL_PrimitivesArray prim_array(gc);
			prim_array.set_attributes(0, &positions[0]);
			prim_array.set_attributes(1, &colors[0]);
			gc.set_program_object(program_object);
			gc.draw_primitives(cl_points, num_particles, prim_array);
			gc.reset_program_object();
			gc.reset_texture(0);
			gc.reset_blend_mode();

			gc.reset_pen();
		}

		window.flip(1);

		CL_KeepAlive::process();
	}
	return 0;
}
Example #6
0
	int start(const std::vector<CL_String> &args)
	{
		CL_ConsoleWindow console("Console");

		try
		{
			CL_DisplayWindow window("Image test", 1024, 768);
			CL_GraphicContext gc = window.get_gc();

			// Connect the Window close event
			CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close);

			CL_BlendMode blend_mode1;
			blend_mode1.enable_blending(true);
			gc.set_blend_mode(blend_mode1);

			quit = false;

			CL_ResourceManager resources("resources.xml");

			CL_Texture texture(gc, "Images/square.png");

			CL_Image image_texture(gc, texture, CL_Rect(0, 0, texture.get_size()));
			CL_Image image_loaded(gc, "Images/square.png");
			CL_Image image_resources(gc, "entire_image", &resources);
			CL_Image image_copy(image_texture);
			CL_Image image_top_right(gc, "image_top_right", &resources);
			CL_Image image_bottom_right(gc, "image_bottom_right", &resources);
			CL_Image image_black(gc, "image_black", &resources);

			CL_Font small_font = CL_Font(gc, "Tahoma", 12);

			//CL_Console::write_line("Color: %1,%2,%3,%4", image_resources.get_color().r, image_resources.get_color().g, image_resources.get_color().b, image_resources.get_color().a);
			//CL_Console::write_line("Scale: %1,%2", image_resources.get_scale_x(), image_resources.get_scale_y());
			//CL_Console::write_line("Translation: %1,%2,%3", image_resources.get_alignment());

			while((!quit) && (!window.get_ic().get_keyboard().get_keycode(CL_KEY_ESCAPE)))
			{
				gc.clear(CL_Colorf(0.5f,0.5f,0.5f));

				small_font.draw_text(gc, 10, 40, "Image From Texture (10,60)");
				image_texture.draw(gc, 10, 60);

				small_font.draw_text(gc, 150, 40, "Image From Load (150,60)");
				image_loaded.draw(gc, 150, 60);

				small_font.draw_text(gc, 300, 40, "Image From Resources (300,60)");
				image_resources.draw(gc, 300, 60);

				small_font.draw_text(gc, 450, 40, "Image Copied (450,60)");
				image_copy.draw(gc, 450, 60);

				small_font.draw_text(gc, 10, 190, "Image - Top Right (10,200)");
				image_top_right.draw(gc, 10, 200);

				small_font.draw_text(gc, 150, 190, "Image - Top Right (150,200)");
				image_texture.draw(gc, CL_Rect(32, 0, CL_Size(32, 32)), CL_Rect(150, 200, CL_Size(32, 32)));

				small_font.draw_text(gc, 300, 190, "Image - Bottom Right (300,200)");
				image_bottom_right.draw(gc, 300, 200);

				small_font.draw_text(gc, 450, 190, "Image - Bottom Right (450,200)");
				image_texture.draw(gc, CL_Rect(32, 32, CL_Size(32, 32)), CL_Rect(450, 200, CL_Size(32, 32)));

				small_font.draw_text(gc, 10, 290, "700 Images (10,300)");
				for(int i=0;i<700;i++)
					image_texture.draw(gc, 10, 300);

				small_font.draw_text(gc, 150, 290, "br image (150,400) Size(128,256)");
				image_bottom_right.draw(gc, CL_Rect(150, 300, CL_Size(128, 256)));

				small_font.draw_text(gc, 300, 290, "Image - black");
				image_black.draw(gc, 300, 300);

				small_font.draw_text(gc, 300, 490, "Image - Scale (1.5, 2.5)");
				image_texture.set_scale(1.5f, 2.5f);
				image_texture.draw(gc, 300, 500);
				image_texture.set_scale(1.0f, 1.0f);

				small_font.draw_text(gc, 450, 460, "Image - Alignment (4 images with 8 pixel offset)");
				small_font.draw_text(gc, 450, 475, "(top left, top right, bottom left, bottom right)");
				small_font.draw_text(gc, 450, 490, "(Circle denotes the draw origin)");
				const int offset = 96;

				image_texture.set_alignment(origin_top_left, 8, 8);
				image_texture.draw(gc, 450+offset, 500+offset);
				image_texture.set_alignment(origin_top_right, -8, 8);
				image_texture.draw(gc, 450+offset, 500+offset);

				image_texture.set_alignment(origin_bottom_left, 8, -8);
				image_texture.draw(gc, 450+offset, 500+offset);
				image_texture.set_alignment(origin_bottom_right, -8, -8);
				image_texture.draw(gc, 450+offset, 500+offset);

				CL_Draw::circle(gc, 450+offset, 500+offset, 4, CL_Colorf(1.0f, 1.0f, 1.0f, 0.9f));

				small_font.draw_text(gc, 700, 460, "Image - Center Alignment (4 images with 8 pixel offset)");
				small_font.draw_text(gc, 700, 475, "(top center, right center, bottom center, left center)");
				small_font.draw_text(gc, 700, 490, "(Circle denotes the draw origin)");

				image_texture.set_alignment(origin_top_center, 0, 8);
				image_texture.draw(gc, 700+offset, 500+offset);
				image_texture.set_alignment(origin_bottom_center, 0, -8);
				image_texture.draw(gc, 700+offset, 500+offset);

				image_texture.set_alignment(origin_center_left, 8, 0);
				image_texture.draw(gc, 700+offset, 500+offset);
				image_texture.set_alignment(origin_center_right, -8, 0);
				image_texture.draw(gc, 700+offset, 500+offset);

				CL_Draw::circle(gc, 700+offset, 500+offset, 4, CL_Colorf(1.0f, 1.0f, 1.0f, 0.9f));

				small_font.draw_text(gc, 700, 160, "Image - Center Align (4 images with 64 pixel offset)");
				small_font.draw_text(gc, 700, 175, "Also Includes a centered image (Without offset)");
				small_font.draw_text(gc, 700, 190, "(Circle denotes the draw origin)");

				const int center_image_offset = 64;

				image_texture.set_alignment(origin_center, 0, 0);
				image_texture.draw(gc, 700+offset, 200+offset);

				image_texture.set_alignment(origin_center, 0, center_image_offset);
				image_texture.draw(gc, 700+offset, 200+offset);
				image_texture.set_alignment(origin_center, 0, -center_image_offset);
				image_texture.draw(gc, 700+offset, 200+offset);

				image_texture.set_alignment(origin_center, center_image_offset, 0);
				image_texture.draw(gc, 700+offset, 200+offset);
				image_texture.set_alignment(origin_center, -center_image_offset, 0);
				image_texture.draw(gc, 700+offset, 200+offset);

				CL_Draw::circle(gc, 700+offset, 200+offset, 4, CL_Colorf(1.0f, 1.0f, 1.0f, 0.9f));

				// Restore alignment
				image_texture.set_alignment(origin_top_left, 0, 0);

				dump_fps();

				window.flip(1);
				CL_KeepAlive::process();
			}

			return 0;
		}
		catch(CL_Exception error)
		{
			CL_Console::write_line("Exception caught:");
			CL_Console::write_line(error.message);
			console.display_close_message();

			return -1;
		}

		return 0;
	}