コード例 #1
0
ファイル: clangl.cpp プロジェクト: sim82/shooter2
	GUI(CL_DisplayWindow * wnd)
	{


		//resources_internal = CL_ResourceManager("../CommonCode/Resources/resources.xml");

		CL_GraphicContext gc = wnd->get_gc();
		fps_font = CL_Font(gc, "Tahoma", 24);







		//std::cout << gui_manager.impl.get() << "\n";
		gui_manager.set_window_manager(wm);

		// Use a texture group to store all the gui textures

		CL_TextureGroup texture_group(CL_Size(1024, 1024));
		wm.set_texture_group(texture_group);    // Note: This line is optional

		resources_gui = CL_ResourceManager(gui->get_resources_location());

		theme.set_resources(resources_gui);
		gui_manager.set_theme(theme);

		gui_manager.set_css_document(gui->get_theme_location());

		// Since this example rebuilds the gui when the theme changes, we have to manually delete the components
		// (We could have instead recreated the CL_GUIManager, so it's destructor deletes them)

		pushbutton.reset(new PushButton(gui->get_gui_manager(), gui->get_resources_internal()));
	}
コード例 #2
0
GameViewBattle::GameViewBattle(GameView *view, Client *client)
: CL_GUIComponent(view), view(view), client(client)
{
	set_type_name("battle");
	set_geometry(CL_Rect(view->get_width() - 400, 0, view->get_width(), 300));
	set_visible(false);

	func_render().set(this, &GameViewBattle::on_render);
	func_process_message().set(this, &GameViewBattle::on_message);

	timer_hide.func_expired().set(this, &GameViewBattle::on_timer_hide_expired);

	CL_Texture texture_dice(get_gc(), "Resources/dices.png", CL_VirtualDirectory());
	CL_SpriteDescription dice_description;
	dice_description.add_gridclipped_frames(texture_dice, 0, 0, 42, 45, 6, 1);
	sprite_dices = CL_Sprite(get_gc(), dice_description);

	font_large = CL_Font(get_gc(), "Accidental Presidency", -40);
	font_small = CL_Font(get_gc(), "Accidental Presidency", -30);
}
コード例 #3
0
CL_Font CL_GUIThemePart::get_font() const
{
	CL_GUIFontCache &font_cache = impl->component->get_gui_manager().impl->font_cache;
	CL_Font font = font_cache.get_font(get_element_name(), impl->states);
	if (!font.is_null())
		return font;

	CL_StringRef font_weight = get_property(impl->prop_font_weight);
	int weight = 0;
	if (font_weight == "normal")
		weight = 400;
	else if (font_weight == "bold" || font_weight == "bolder")
		weight = 700;
	else if (font_weight == "light" || font_weight == "lighter")
		weight = 300;
	else
		weight = CL_StringHelp::text_to_int(font_weight);

	int font_size = get_property_int(impl->prop_font_size);

	bool italic = (get_property(impl->prop_font_style) == "italic");
	bool underline = (get_property(impl->prop_text_decoration) == "underline");
	bool strikeout = false;

	CL_GUIComponent *component = impl->component;
	impl->font_loaded = true;

	const CL_String typeface_name = get_property(impl->prop_font_family);

	// Build the font details
	CL_FontDescription desc;
	desc.set_height(font_size);
	desc.set_weight(weight);
	desc.set_italic(italic);
	desc.set_underline(underline);
	desc.set_strikeout(strikeout);
	desc.set_typeface_name(typeface_name);

	font = font_cache.get_font(desc);	// Check to see if matching font description in the font cache
	if (!font.is_null())
		return font;

	CL_GUIManager manager = impl->component->get_gui_manager();
	font = manager.get_registered_font(desc);
	if (font.is_null())
	{
		CL_GraphicContext &gc = component->get_gc();
		font = CL_Font(gc, desc);
	}
	
	font_cache.set_font(font, desc, get_element_name(), impl->states);

	return font;
}
コード例 #4
0
ファイル: DebugTool.cpp プロジェクト: Cemenyave/scrollshooter
DebugTool::DebugTool():
	logStack(), 
	consoleFont(),
	consoleBottom(0),
	lineHeight(0),
	displayControl(),
	fps(0),
	display(false)
{
	Engine &ObjEngine = Engine::GetEngine();
	display = false;
	lineHeight = 14;
	consoleFont = CL_Font(ObjEngine.graphicContext, "consolas", lineHeight);
	consoleBottom = ObjEngine.windowHeight - 20;
	displayControl = ObjEngine.keyboard.sig_key_down().connect(this, &DebugTool::TildaListener);
}
コード例 #5
0
ファイル: DebugLayer.cpp プロジェクト: ryba616/ryba.racer
void DebugLayer::draw(CL_GraphicContext &p_gc) {

    if (m_font.is_null()) {
        m_font = CL_Font(p_gc, "Tahoma", 14);
        m_fontMetrics = m_font.get_font_metrics(p_gc);
    }

    int x = 5;
    int y = 15;
    const int margin = 0;

    for (std::map<CL_String, CL_String>::iterator itor = m_messages.begin(); itor != m_messages.end(); ++itor) {
        m_font.draw_text(p_gc, x, y, itor->first + ": " + itor->second, CL_Colorf::white);
        y += m_fontMetrics.get_height() + margin;
    }
}
コード例 #6
0
CL_Font &CL_CSSResourceCache::get_font(CL_GraphicContext &gc, const CL_CSSBoxProperties &properties)
{
	int font_size = (int)(properties.font_size.length.value+0.5f);
	CL_String font_name = properties.font_family.names[0].name;
	int font_weight = 400;
	switch (properties.font_weight.type)
	{
	case CL_CSSBoxFontWeight::type_100: font_weight = 100; break;
	case CL_CSSBoxFontWeight::type_200: font_weight = 200; break;
	case CL_CSSBoxFontWeight::type_300: font_weight = 300; break;
	case CL_CSSBoxFontWeight::type_400: font_weight = 400; break;
	case CL_CSSBoxFontWeight::type_500: font_weight = 500; break;
	case CL_CSSBoxFontWeight::type_600: font_weight = 600; break;
	case CL_CSSBoxFontWeight::type_700: font_weight = 700; break;
	case CL_CSSBoxFontWeight::type_800: font_weight = 800; break;
	case CL_CSSBoxFontWeight::type_900: font_weight = 900; break;
	case CL_CSSBoxFontWeight::type_normal: font_weight = 400; break;
	case CL_CSSBoxFontWeight::type_bold: font_weight = 700; break;
	case CL_CSSBoxFontWeight::type_bolder: font_weight = 900; break;
	case CL_CSSBoxFontWeight::type_lighter: font_weight = 300; break;
	}
	bool italic = false;
	switch (properties.font_style.type)
	{
	case CL_CSSBoxFontStyle::type_normal: italic = false; break;
	case CL_CSSBoxFontStyle::type_italic: italic = true; break;
	case CL_CSSBoxFontStyle::type_oblique: italic = true; break;
	}
	CL_String font_cache_name = cl_format("%1+++%2+%3", font_name, font_size, font_weight);
	if (italic) font_cache_name += "i";
	std::map<CL_String, CL_Font>::iterator it = font_cache.find(font_cache_name);
	if (it == font_cache.end())
	{
		CL_FontDescription font_desc;
		font_desc.set_typeface_name(font_name);
		font_desc.set_height(-font_size);
		font_desc.set_weight(font_weight);
		font_desc.set_italic(italic);
		font_cache[font_cache_name] = CL_Font(gc, font_desc);
		return font_cache[font_cache_name];
	}
	else
	{
		return it->second;
	}
}
コード例 #7
0
ファイル: GUI.cpp プロジェクト: animehunter/clanlib-2.3
GUI::GUI(App *app) : app(app)
{
	if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css"))
	{
		current_theme = new_theme = Theme::theme_aero;
	}
	else
	{
		current_theme = new_theme = Theme::theme_basic;
	}

	resources_internal = CL_ResourceManager("../CommonCode/Resources/resources.xml");

	CL_GraphicContext gc = app->get_window()->get_gc();
	fps_font = CL_Font(gc, "Tahoma", 24);

	balls.Init(gc);

	reset_manager();
}
コード例 #8
0
void CL_ResourceData_TextStyler::on_load()
{
    CL_Resource resource = get_resource();
    CL_ResourceManager manager = resource.get_manager();

    ts = CL_TextStyler();
    std::map<std::string, CL_Font>& fnt_map = ts.get_fonts();

    for (
        CL_DomNode cur_node = resource.get_element().get_first_child();
        !cur_node.is_null();
        cur_node = cur_node.get_next_sibling())
    {
        if (!cur_node.is_element()) continue;

        CL_DomElement cur_element = cur_node.to_element();
        if (
            cur_element.get_tag_name() == "font"
            && cur_element.has_attribute("name")
            && cur_element.has_attribute("font"))
        {
            if (manager.exists(cur_element.get_attribute("font")))
            {
                fnt_map[cur_element.get_attribute("name")] =
                    CL_Font(cur_element.get_attribute("font"), &manager);
            }
            else
            {
                throw CL_Error(std::string("CL_TextStyler: Unable to find sub-font named ") + cur_element.get_attribute("font"));
            }
        }
        else
        {
            throw CL_Error("CL_TextStyler: Unknown sub-element of a text_styler resource");
        }
    }
}
コード例 #9
0
ファイル: test.cpp プロジェクト: PaulFSherwood/cplusplus
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	quit = false;

	try
	{

		CL_OpenGLWindowDescription desc;

		desc.set_title("ClanLib AnimCursor Test");
		desc.set_size(CL_Size(800, 600), true);
		CL_DisplayWindow window(desc);

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

		// Connect a keyboard handler to on_key_up()
		CL_Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &App::on_input_up);

		// Get the graphic context
		CL_GraphicContext gc = window.get_gc();

		CL_Font font = CL_Font(gc, "Tahoma", 20);

		CL_PixelBuffer pacman("pacman.png");

		CL_SpriteDescription description;
		CL_Size size(22, 22);

		for (int frame_cnt=0; frame_cnt < 6; frame_cnt++)
		{
			CL_PixelBuffer frame(size.width, size.height, cl_rgba8);
			pacman.convert(frame, size, CL_Rect((frame_cnt * 28) + 4, 4, size));
			description.add_frame(frame);
			description.set_frame_delay(frame_cnt, 0.1);
		}

		CL_Point hotspot(0,0);
		CL_Cursor cursor(window, description, hotspot);
		window.set_cursor(cursor);

		// Run until someone presses escape
		while (!quit)
		{
			gc.clear(CL_Colorf(0.0f,0.0f,0.5f));

			font.draw_text(gc, 32, 32, "Observe the animated cursor");

			// Flip the display, showing on the screen what we have drawed
			// since last call to flip()
			window.flip(1);

			// This call processes user input and other events
			CL_KeepAlive::process();
		}
	}
	catch(CL_Exception& exception)
	{
		// Create a console window for text-output if not available
		CL_ConsoleWindow console("Console", 80, 200);

		CL_Console::write_line("Exception caught:");
		CL_Console::write_line(exception.message);

		// Display the stack trace (if available)
		std::vector<CL_String> stacktrace = exception.get_stack_trace();
		int size = stacktrace.size();
		if (size > 0)
		{
			CL_Console::write_line("Stack Trace:");
			for (int cnt=0; cnt < size; cnt++)
			{
				CL_Console::write_line(stacktrace[cnt]);
			}
		}

		console.display_close_message();

		return -1;
	}
	return 0;
}
コード例 #10
0
ファイル: menu.cpp プロジェクト: sp-alex-osou/TowerDefense
//Zeichnet das Menü
void Menu::draw()
{
	CL_Font fontSmall;
	CL_Font fontBig;
	CL_Rect rectangle;
	std::stringstream sstream;
	std::string outputString;
	CL_Quadf textureQuad;
	CL_Rectf textureRectangle;
	CL_GraphicContext graphicContext;
	int space = 30;
	CL_Size textSize;
	int xPosition;

	//Ist die Menübreite gesetzt, wird der Anfang in x-Richtung
	//berechnet, damit das Menü zentriert ist
	if(menuWidth == -1)
		xPosition = 0;
	else
		xPosition = (viewPort.get_width() - menuWidth) / 2;

	graphicContext = world->get_gc();

	//Schriften setzen
	fontSmall = CL_Font(graphicContext, "Comic Sans MS", 10);
	fontBig = CL_Font(graphicContext, "Comic Sans MS", 20);

	//Die unterschiedlichen Turmtypen durchgehen
	for(unsigned int i = 0; i < towerTypes.size(); i++)
	{
		//Ein Rechteck für den Rahmen eines Baufeldes definieren
		rectangle = CL_Rect(
			i*menuHeight + xPosition,
			viewPort.get_height() - menuHeight,
			(i+1)*menuHeight + xPosition,
			viewPort.get_height()-1);
		//Den Rahmen des Baufeldes zeichnen
		CL_Draw::box(graphicContext, rectangle, CL_Colorf::white);
		
		//Ein Rechteck für die Anzeige der Turmtextur innerhalb des Baufeldes definieren
		textureRectangle = CL_Rectf(
			i * menuHeight + ((menuHeight - menuTowerLength) / 2.0f) + xPosition,
			viewPort.get_height() - menuHeight + 5.0f,
			CL_Sizex<float>((float)menuTowerLength, (float)menuTowerLength));
		textureQuad = CL_Quadf(textureRectangle);
		//Turmtextur zeichnen
		CL_Draw::texture(graphicContext, towerTypes[i]->texture, textureRectangle);
		
		//Nummer (=Shortcut auf Tastatur) des Baufeldes in der linken oberen Ecke zeichnen
		sstream << (i+1);
		sstream >> outputString;
		sstream.clear();
		fontSmall.draw_text(graphicContext, rectangle.left + 5, rectangle.top + 10,
			outputString,CL_Colorf::white);

		//Kosten des Turmes unterhalb der Textur und zentriert im Baufeld ausgeben
		sstream << towerTypes[i]->price;
		sstream >> outputString;
		sstream.clear();
		textSize = fontSmall.get_text_size(graphicContext, outputString);
		fontSmall.draw_text(graphicContext, ((menuHeight - textSize.width) / 2) + i * menuHeight + xPosition,
			viewPort.get_height() - textSize.height/2, outputString, CL_Colorf::white);
	}
	
	//x-Position weitersetzen für nächsten Menüeintrag
	xPosition += towerTypes.size()*menuHeight + space;

	//Geldanzeige
	sstream << world->getMoney();
	sstream >> outputString;
	sstream.clear();
	textSize = fontBig.get_text_size(world->get_gc(), outputString);

	Menu::drawMenuItem(outputString, menuCoinsLength, coinsTexture, fontBig, menuHeight/2, xPosition);

	xPosition += menuCoinsLength + textSize.width + space;

	//Zeitanzeige
	sstream << world->getCountdown();
	sstream >> outputString;
	sstream.clear();
	outputString = "Next Wave:\n" + outputString;
	textSize = fontBig.get_text_size(graphicContext, outputString);

	Menu::drawMenuItem(outputString, menuTimeLength, clockTexture, fontBig, menuHeight/2 - 10, xPosition);

	xPosition += menuTimeLength + textSize.width + space;

	//Lebensanzeige
	sstream << world->getLifes();
	sstream >> outputString;
	sstream.clear();
	
	Menu::drawMenuItem(outputString, menuLifeLength, heartTexture, fontBig, menuHeight/2, xPosition);

	//Beim ersten Aufruf wird die Menübreite errechnet
	if(menuWidth == -1)
	{
		textSize = fontBig.get_text_size(graphicContext, outputString);
		menuWidth = xPosition + menuLifeLength + textSize.width;
	}
}
コード例 #11
0
void CL_ResourceData_Font::on_load()
{
    CL_Resource resource = get_resource();
    CL_ResourceManager manager = resource.get_manager();

    CL_DomElement system_element = resource.get_element().named_item("system").to_element();
    CL_DomElement bitmap_element = resource.get_element().named_item("bitmap").to_element();

    // First check if it's a system font
    if (!system_element.is_null())
    {
        if (!system_element.has_attribute("height"))
            throw CL_Error("System font resource " + resource.get_name() + " has no 'height' attribute.");

        const std::string font_name = system_element.get_attribute("font_name");
        const int height = CL_String::to_int(system_element.get_attribute("height"));
        int width = 0;

        bool bold = false;
        bool italic = false;
        bool underline = false;
        bool strikeout = false;

        if (system_element.has_attribute("width"))
            width = CL_String::to_int(system_element.get_attribute("width"));

        if (system_element.has_attribute("bold"))
            bold = (CL_String::to_int(system_element.get_attribute("bold")) != 0);

        if (system_element.has_attribute("italic"))
            italic = (CL_String::to_int(system_element.get_attribute("italic")) != 0);

        if (system_element.has_attribute("underline"))
            underline = (CL_String::to_int(system_element.get_attribute("underline")) != 0);

        if (system_element.has_attribute("strikeout"))
            strikeout = (CL_String::to_int(system_element.get_attribute("strikeout")) != 0);

        if (system_element.has_attribute("letters"))
        {
            font = CL_Font(
                       font_name,
                       system_element.get_attribute("letters"),
                       height,
                       width,
                       bold,
                       italic,
                       underline,
                       strikeout);
        }
        else
        {
            font = CL_Font(
                       font_name,
                       height,
                       width,
                       bold,
                       italic,
                       underline,
                       strikeout);
        }
    }
    else if (!bitmap_element.is_null())
    {
        if (!bitmap_element.has_attribute("glyphs"))
            throw CL_Error("Font resource " + resource.get_name() + " has no 'glyphs' attribute.");

        if (!bitmap_element.has_attribute("letters"))
            throw CL_Error("Font resource " + resource.get_name() + " has no 'letters' attribute.");

        //Set most values to CL_Font defaults, then we can override them with options if they exist
        const CL_Sprite spr_glyphs(bitmap_element.get_attribute("glyphs"), &manager);
        const std::string letters = bitmap_element.get_attribute("letters");
        int spacelen = -1;
        bool monospace = false;

        if (bitmap_element.has_attribute("spacelen"))
            spacelen = CL_String::to_int(bitmap_element.get_attribute("spacelen"));

        if (bitmap_element.has_attribute("monospace"))
            monospace = (CL_String::to_int(bitmap_element.get_attribute("monospace")) != 0);

        font = CL_Font(
                   spr_glyphs,
                   letters,
                   spacelen,
                   monospace);
    }
    else
    {
        throw CL_Error(CL_String::format("Font resource %1 did not have a <system> or <bitmap> child element!", resource.get_name()));
    }

    if (resource.get_element().has_attribute("width_offset"))
        font.set_width_offset(CL_String::to_int(resource.get_element().get_attribute("width_offset")));

    if (resource.get_element().has_attribute("height_offset"))
        font.set_height_offset(CL_String::to_int(resource.get_element().get_attribute("height_offset")));

    if (resource.get_element().has_attribute("delims"))
        font.set_delims(resource.get_element().get_attribute("delims"));
}
コード例 #12
0
void CL_ResourceData_Font::on_unload()
{
    font = CL_Font();
}
コード例 #13
0
ファイル: 2d.cpp プロジェクト: PaulFSherwood/cplusplus
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	quit = false;

	// Create a console window for text-output if not available
	CL_ConsoleWindow console("Console", 80, 200);

	try
	{
		// Set the window
		// This opens a 640 x 480 window, including the frame size
		// If you want more control over the window, pass CL_DisplayWindowDescription to CL_DisplayWindow
		// (This is useful to create a borderless window of a specific size)
		// If you require target specific control over the window, use the derived CL_OpenGLWindowDescription
		// (This contains the multisampling options)
#ifdef USE_SWRENDER
		CL_DisplayWindowDescription desc;
#else
		CL_OpenGLWindowDescription desc;
//		desc.set_multisampling(4);
#endif
		desc.set_title("ClanLib 2D Test");
		desc.set_size(CL_Size(800, 600), true);
		CL_DisplayWindow window(desc);

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

		// Connect a keyboard handler to on_key_up()
		CL_Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &App::on_input_up);

		// Get the graphic context
		CL_GraphicContext gc = window.get_gc();

		CL_Texture texture_image(gc, "tux.png");
		texture_image.set_wrap_mode(cl_wrap_repeat, cl_wrap_repeat, cl_wrap_repeat);
		texture_image.set_min_filter(cl_filter_linear);
		texture_image.set_mag_filter(cl_filter_linear);

		CL_ResourceManager resources("resources.xml");
		CL_Sprite sprite(gc, "test", &resources);
		//sprite.set_linear_filter(true);

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

		float test_base_angle = 0.0f;
		float test_angle = 0.0f;
		float test_angle_pitch = 0.0f;
		float test_angle_yaw = 0.0f;
		float test_scale = 1.0f;
		bool test_scale_dir = false;

		// Run until someone presses escape
		while (!quit)
		{
			gc.clear(CL_Colorf(0.0f,0.0f,0.2f));

			gc.set_map_mode(CL_MapMode(cl_map_2d_upper_left));

	// CL_Draw::point()
			for (int xcnt=0; xcnt<8; xcnt++)
			{
				for (int ycnt=0; ycnt<6; ycnt++)
				{
					CL_Draw::point(gc, xcnt*2, ycnt*2, CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));
				}
			}
			small_font.draw_text(gc, 32, 10, "8*6 Points (0 + 2x), (0 + 2y)");

	// CL_Draw::line()
			for (int xcnt=0; xcnt<4; xcnt++)
			{
				for (int ycnt=0; ycnt<3; ycnt++)
				{
					const int offset_y = 16;
					const int line_length = 6;
					const int spacing = 8;
					CL_Draw::line(gc, xcnt*spacing, (ycnt*spacing) + offset_y, line_length + (xcnt*spacing), (line_length + (ycnt*spacing)) + offset_y, CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));
				}
			}
			small_font.draw_text(gc, 48, 30, "4*3 Lines (0 + 8x), (32 + 8y), (6 + 8x), (38 + 8y)");

	// CL_Draw::box()
			for (int xcnt=0; xcnt<4; xcnt++)
			{
				for (int ycnt=0; ycnt<3; ycnt++)
				{
					const int offset_y = 48;
					const int line_length = 6;
					const int spacing = 8;
					CL_Draw::box(gc, xcnt*spacing, (ycnt*spacing) + offset_y, line_length + (xcnt*spacing), (line_length + (ycnt*spacing)) + offset_y, CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));
				}
			}
			small_font.draw_text(gc, 48, 66, "4*3 Box (0 + 8x), (32 + 8y), (6 + 8x), (38 + 8y)");

	// CL_Draw::fill()
			for (int xcnt=0; xcnt<4; xcnt++)
			{
				for (int ycnt=0; ycnt<3; ycnt++)
				{
					const int offset_y = 80;
					const int line_length = 6;
					const int spacing = 8;
					CL_Draw::fill(gc, xcnt*spacing, (ycnt*spacing) + offset_y, line_length + (xcnt*spacing), (line_length + (ycnt*spacing)) + offset_y, CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));
				}
			}
			small_font.draw_text(gc, 48, 90, "4*3 Fill (0 + 8x), (32 + 8y), (6 + 8x), (38 + 8y)");

	// CL_Draw::gradient_fill()
			CL_Gradient gradient;
			gradient.top_left = CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f);
			gradient.top_right = CL_Colorf(1.0f, 0.0f, 0.0f, 1.0f);
			gradient.bottom_left = CL_Colorf(0.0f, 0.0f, 1.0f, 1.0f);
			gradient.bottom_right = CL_Colorf(0.0f, 1.0f, 0.0f, 1.0f);
			for (int xcnt=0; xcnt<4; xcnt++)
			{
				for (int ycnt=0; ycnt<3; ycnt++)
				{
					const int offset_y = 110;
					const int line_length = 6;
					const int spacing = 8;
					CL_Draw::gradient_fill(gc, xcnt*spacing, (ycnt*spacing) + offset_y, line_length + (xcnt*spacing), (line_length + (ycnt*spacing)) + offset_y, gradient);
				}
			}
			small_font.draw_text(gc, 48, 115, "4*3 GradientFill (0 + 8x), (32 + 8y), (6 + 8x), (38 + 8y)");
			small_font.draw_text(gc, 48, 125, "top left = white. top right = red");
			small_font.draw_text(gc, 48, 135, "bottom left = blue. bottom right = green");

	// CL_Draw::circle()
			{
				const int offset_y = 140;
				int radius = 5;
				CL_Draw::circle(gc, radius, offset_y + radius, radius, CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));

				const int offset_x = 16;
				radius = 16;
				CL_Draw::circle(gc, offset_x + radius, offset_y + radius, radius, CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));
			}
			small_font.draw_text(gc, 54, 149, "Circle (5, 145) Radius = 5");
			small_font.draw_text(gc, 54, 159, "Circle (32, 156) Radius = 16");

	// CL_Draw::gradient_circle()
			{
				CL_Gradient gradient;
				gradient.top_left = CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f);
				gradient.top_right = CL_Colorf(0.0f, 0.0f, 0.0f, 1.0f);
				gradient.bottom_left = CL_Colorf(0.0f, 0.0f, 0.0f, 1.0f);
				gradient.bottom_right = CL_Colorf(1.0f, 0.0f, 0.0f, 1.0f);

				const int offset_y = 180;
				float radius = 17.0;
				float xpos = radius;
				float ypos = offset_y + radius;
				CL_Draw::gradient_circle(gc, CL_Pointf( xpos, ypos ), CL_Pointf(radius/2.0, 0.0f), radius, gradient);

				const int offset_x = 40;
				radius = 17.0;
				xpos = offset_x + radius;
				ypos = offset_y + radius;
				CL_Draw::gradient_circle(gc, CL_Pointf( xpos, ypos), CL_Pointf(0.0f, radius/2.0), radius, gradient);
			}

			small_font.draw_text(gc, 80, 189, "Gradient Circle (16, 196) Radius = 17. Gradient right");
			small_font.draw_text(gc, 80, 199, "Gradient Circle (56, 196) Radius = 17. Gradient up");
			small_font.draw_text(gc, 80, 209, "centre = white, outer = red");

	// CL_Draw::triangle()
			{
				const float offset_y = 220.0f;
				const float size = 12.0f;
				CL_Draw::triangle(gc, CL_Pointf(0.0f, offset_y), CL_Pointf(0.0f, offset_y + size), CL_Pointf(size, offset_y + size), CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));

				float offset_x = 16.0f;
				CL_Draw::triangle(gc, CL_Pointf(offset_x + 0.0f, offset_y + size), CL_Pointf(offset_x + size, offset_y + size), CL_Pointf(offset_x + 0.0f, offset_y), CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));

				offset_x = 32.0f;
				CL_Draw::triangle(gc, CL_Pointf(offset_x + size, offset_y + size), CL_Pointf(offset_x + 0.0f, offset_y), CL_Pointf(offset_x + 0.0f, offset_y + size), CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f));
			}
			small_font.draw_text(gc, 48, 229, "3 Triangles (12 pixel size) (Left vertical edge).");
			small_font.draw_text(gc, 48, 239, "Top Left: (0,220)  (16,220)  (32,220)");

	// CL_Draw::texture()
			gc.set_texture(0, texture_image);
			{
				float offset_x = 0.0f;
				float offset_y = 250.0f;
				CL_Rectf src_rect(offset_x, offset_y, CL_Sizef(31, 47));
				CL_Rectf texture_coords(0.0, 0.0, 1.0f, 1.0f);
				CL_Colorf color(1.0f, 1.0f, 1.0f, 1.0f);
				CL_Draw::texture(gc, src_rect, color, texture_coords);

				offset_x = 33.0f;
				src_rect = CL_Rectf(offset_x, offset_y, CL_Sizef(31, 47));
				texture_coords = CL_Rectf(0.25f, 0.25f, 0.75f, 0.75f);
				color = CL_Colorf(1.0f, 0.0f, 0.0f, 1.0f);
				CL_Draw::texture(gc, src_rect, color, texture_coords);
			}
			gc.reset_texture(0);
			small_font.draw_text(gc, 76, 260, "Texture (0, 250) size=(31,47)");
			small_font.draw_text(gc, 76, 275, "Texture (33, 250) size=(31,47) (red, magnify*2)");

	// CL_RoundedRect
			{
				CL_RoundedRect roundedrect(CL_Sizef(64.0f, 32.0f), 15.0f);

				float offset_x = 0.0f;
				float offset_y = 300.0f;
				CL_Origin origin = origin_top_left;
				roundedrect.draw(gc, CL_Pointf(offset_x, offset_y), CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f), origin);

				offset_y = 340.0f;
				roundedrect.fill(gc, CL_Pointf(offset_x, offset_y), CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f), origin);

				offset_y = 380.0f;
				CL_Gradient gradient;
				gradient.top_left = CL_Colorf(1.0f, 1.0f, 1.0f, 1.0f);
				gradient.top_right = CL_Colorf(1.0f, 0.0f, 0.0f, 1.0f);
				gradient.bottom_left = CL_Colorf(0.0f, 0.0f, 1.0f, 1.0f);
				gradient.bottom_right = CL_Colorf(0.0f, 1.0f, 0.0f, 1.0f);
				roundedrect.fill(gc, CL_Pointf(offset_x, offset_y), gradient, origin);

				offset_y = 420.0f;
				roundedrect.set_control_point_bl(CL_Pointf(0.4f, 0.8f));
				roundedrect.set_rounding_bottom_left(CL_Sizef(0.2f, 0.6f));

				roundedrect.set_control_point_tl(CL_Pointf(0.2f, 0.4f));
				roundedrect.set_rounding_top_left(CL_Sizef(0.4f, 0.2f));

				roundedrect.set_control_point_tr(CL_Pointf(0.6f, 0.2f));
				roundedrect.set_rounding_top_right(CL_Sizef(0.8f, 0.4f));
				roundedrect.set_control_point_br(CL_Pointf(0.6f, 0.8f));
				roundedrect.set_rounding_bottom_right(CL_Sizef(0.8f, 0.6f));

				roundedrect.fill(gc, CL_Pointf(offset_x, offset_y), gradient, origin);

			}
			small_font.draw_text(gc, 76, 310, "RoundedRect - draw (0, 300) size=(64,32)");
			small_font.draw_text(gc, 76, 325, "(RoundedRect - draw gradient - is not implemented)");
			small_font.draw_text(gc, 76, 350, "RoundedRect - fill (0, 340) size=(64,32)");
			small_font.draw_text(gc, 76, 390, "RoundedRect - fill gradient (0, 380) size=(64,32)");
			small_font.draw_text(gc, 76, 400, "top left = white. top right = red");
			small_font.draw_text(gc, 76, 410, "bottom left = blue. bottom right = green");
			small_font.draw_text(gc, 76, 430, "RoundedRect - fill gradient (0, 420) size=(64,32)");
			small_font.draw_text(gc, 76, 440, "Controling control / rounding points");

	// CL_Sprite
			{
				test_base_angle+=5.0f;
				if (test_base_angle >= 360.0f)
				{
					test_base_angle = 0.0f;
				}
#ifndef USE_SWRENDER
				clEnable(GL_MULTISAMPLE);
#endif
				sprite.set_base_angle(CL_Angle(test_base_angle, cl_degrees));
				sprite.draw(gc, 350, 20);
				sprite.set_base_angle(CL_Angle(0, cl_degrees));

#ifndef USE_SWRENDER
				clDisable(GL_MULTISAMPLE);
#endif
			}
			small_font.draw_text(gc, 370, 20, "Sprite - Base angle");
			small_font.draw_text(gc, 370, 35, "Multisampling enabled");

			{
				test_angle+=5.0f;
				if (test_angle >= 360.0f)
				{
					test_angle = 0.0f;
				}

				sprite.set_angle(CL_Angle(test_angle, cl_degrees));
				sprite.draw(gc, 350, 60);
				sprite.set_angle(CL_Angle(0, cl_degrees));
			}
			small_font.draw_text(gc, 370, 60, "Sprite - Angle");

			{
				test_angle_pitch+=5.0f;
				if (test_angle_pitch >= 360.0f)
				{
					test_angle_pitch = 0.0f;
				}

				sprite.set_angle_pitch(CL_Angle(test_angle_pitch, cl_degrees));
				sprite.draw(gc, 350, 100);
				sprite.set_angle_pitch(CL_Angle(0, cl_degrees));
			}
			small_font.draw_text(gc, 370, 100, "Sprite - Angle Pitch");

			{
				test_angle_yaw+=5.0f;
				if (test_angle_yaw >= 360.0f)
				{
					test_angle_yaw = 0.0f;
				}

				sprite.set_angle_yaw(CL_Angle(test_angle_yaw, cl_degrees));
				sprite.draw(gc, 350, 140);
				sprite.set_angle_yaw(CL_Angle(0, cl_degrees));
			}
			small_font.draw_text(gc, 370, 140, "Sprite - Angle Yaw");

			{
				if (test_scale_dir)
				{
					test_scale += 0.1f;
					if (test_scale >= 2.0f)
					{
						test_scale = 2.0f;
						test_scale_dir = false;
					}
				}else
				{
					test_scale -= 0.1f;
					if (test_scale <= -2.0f)
					{
						test_scale = -2.0f;
						test_scale_dir = true;
					}
				}

				sprite.set_scale(test_scale, 1.0f);
				sprite.draw(gc, 350, 180);
				sprite.set_scale(1.0f, test_scale);
				sprite.draw(gc, 390, 180);
				sprite.set_scale(1.0f, 1.0f);
			}
			small_font.draw_text(gc, 420, 180, "Sprite - Set Scale (x), (y)");

			// Flip the display, showing on the screen what we have drawed
			// since last call to flip()
			window.flip(1);

			// This call processes user input and other events
			CL_KeepAlive::process();
		}
		small_font = CL_Font();
	}
	catch(CL_Exception& exception)
	{
		CL_Console::write_line("Exception caught:");
		CL_Console::write_line(exception.message);

		// Display the stack trace (if available)
		std::vector<CL_String> stacktrace = exception.get_stack_trace();
		int size = stacktrace.size();
		if (size > 0)
		{
			CL_Console::write_line("Stack Trace:");
			for (int cnt=0; cnt < size; cnt++)
			{
				CL_Console::write_line(stacktrace[cnt]);
			}
		}

		console.display_close_message();

		return -1;
	}
	return 0;
}
コード例 #14
0
ファイル: app.cpp プロジェクト: animehunter/clanlib-2.3
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	// Setup the window
	CL_DisplayWindowDescription win_desc;
	win_desc.set_allow_resize(true);
	win_desc.set_title("Input Example");
	win_desc.set_size(CL_Size( 700, 700 ), false);
	window = CL_DisplayWindow(win_desc);

	// Connect the slots that we require
	CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close);
	CL_Slot slot_input_down = (window.get_ic().get_keyboard()).sig_key_down().connect(this, &App::on_input_down);
	CL_Slot slot_mouse_down = (window.get_ic().get_mouse()).sig_key_down().connect(this, &App::on_mouse_down);
	CL_Slot slot_mouse_dblclick = (window.get_ic().get_mouse()).sig_key_dblclk().connect(this, &App::on_mouse_down);

	std::vector<CL_Slot> slot_joystick;
	int max_joysticks = window.get_ic().get_joystick_count();
	for (int joystick_number=0; joystick_number < max_joysticks; joystick_number++)
	{
		CL_Slot current_joystick = window.get_ic().get_joystick(joystick_number).sig_key_down().connect(this, &App::on_joystick_down, joystick_number);
		slot_joystick.push_back(current_joystick);
	}

	CL_GraphicContext gc = window.get_gc();

	font = CL_Font(gc, "tahoma", 16);
	vector_font = CL_Font_Vector("../../Game/DiceWar/Resources/bitstream_vera_sans/VeraBd.ttf", 256);

	calculate_matrix(gc);

	while(!quit)
	{
		gc.set_map_mode(cl_map_2d_upper_left);

		CL_Draw::gradient_fill(gc, CL_Rect(0, 0, gc.get_width(), gc.get_height()/2), CL_Gradient(CL_Colorf(0.2f, 0.2f, 0.8f, 1.0f), CL_Colorf(0.0f, 0.0f, 0.2f, 1.0f)));
		CL_Draw::gradient_fill(gc, CL_Rect(0, gc.get_height()/2, gc.get_width(), gc.get_height()), CL_Gradient(CL_Colorf(0.0f, 0.0f, 0.2f, 1.0f), CL_Colorf(0.2f, 0.2f, 0.8f, 1.0f)));

		font.draw_text(gc, 8, 20, "Press any key, mouse button or joystick button to fire text. Use mouse to control direction.");

		int yoffset = gc.get_height() - 20;
		const int y_gap = 20;

		// Draw Keyboard Information
		draw_keyboard_state(gc, yoffset);
		yoffset -= y_gap;

		// Draw Mouse Information
		draw_mouse_state(gc, yoffset);
		yoffset -= y_gap;
	
		// Draw Joysticks Information
		for (int joystick_number=0; joystick_number < max_joysticks; joystick_number++)
		{
			draw_joystick_state(gc, joystick_number, yoffset);
			yoffset -= y_gap;
		}

		// Draw Tablet Information
		int max_tablets = window.get_ic().get_tablet_count();
		for (int tablet_number=0; tablet_number < max_tablets; tablet_number++)
		{
			draw_tablet_state(gc, tablet_number, yoffset);
			yoffset -= y_gap;
		}

		gc.set_map_mode(cl_user_projection);
		gc.set_projection(projection_matrix);
		gc.set_modelview(modelview_matrix);

		draw_text_shooter(gc);

		window.flip(1);

		CL_KeepAlive::process();
	}

	return 0;
}
コード例 #15
0
ファイル: app.cpp プロジェクト: PaulFSherwood/cplusplus
// The start of the Application
int App::start(const std::vector<CL_String> &args)
{
	// Setup the window
	CL_DisplayWindowDescription win_desc;
	win_desc.set_allow_resize(true);
	win_desc.set_title("3D GUI Example");
	win_desc.set_size(CL_Size( 700, 700 ), false);
	window = CL_DisplayWindow(win_desc);

	// Connect the slots that we require
	CL_Slot slot_quit = window.sig_window_close().connect(this, &App::on_window_close);
	CL_Slot slot_input_down = (window.get_ic().get_keyboard()).sig_key_down().connect(this, &App::on_input_down);

	CL_GraphicContext gc = window.get_gc();

	CL_Font font = CL_Font(gc, "tahoma", 16);

	// Initialise the GUI system
	GUI gui(this);

	// NOTE: The GUI component positions are still in 2D world, therefore
	// be careful not to overlap windows, else unpredicted results may occur!

	window1 = new Window1(gui, CL_Rect(0,0, CL_Size(256, 256)));

	slider_1_xrotation = new Slider(gui, CL_Rect(0, 512, CL_Size(200, 17)));
	slider_1_xrotation->object_matrix.translate_self(0.0f, 0.8f, 3.0f);
	slider_1_xrotation->object_matrix.multiply(CL_Mat4f::rotate(CL_Angle(10, cl_degrees), 0.0f, 0.0f, 1.0f));

	slider_1_yrotation = new Slider(gui, CL_Rect(256*1, 512, CL_Size(200, 17)));
	slider_1_yrotation->object_matrix.translate_self(0.0f, 0.7f, 3.0f);
	slider_1_yrotation->object_matrix.multiply(CL_Mat4f::rotate(CL_Angle(10, cl_degrees), 0.0f, 0.0f, 1.0f));

	slider_1_zrotation = new Slider(gui, CL_Rect(256*2, 512, CL_Size(200, 17)));
	slider_1_zrotation->object_matrix.translate_self(0.0f, 0.6f, 3.0f);
	slider_1_zrotation->object_matrix.multiply(CL_Mat4f::rotate(CL_Angle(10, cl_degrees), 0.0f, 0.0f, 1.0f));

	slider_1_xtranslation = new Slider(gui, CL_Rect(256*3, 512, CL_Size(200, 17)));
	slider_1_xtranslation->object_matrix.translate_self(0.0f, 0.5f, 3.0f);
	slider_1_xtranslation->object_matrix.multiply(CL_Mat4f::rotate(CL_Angle(10, cl_degrees), 0.0f, 0.0f, 1.0f));
	slider_1_xtranslation->component->set_position(500);

	slider_1_ytranslation = new Slider(gui, CL_Rect(256*4, 512, CL_Size(200, 17)));
	slider_1_ytranslation->object_matrix.translate_self(0.0f, 0.4f, 3.0f);
	slider_1_ytranslation->object_matrix.multiply(CL_Mat4f::rotate(CL_Angle(10, cl_degrees), 0.0f, 0.0f, 1.0f));
	slider_1_ytranslation->component->set_position(500);

	slider_1_ztranslation = new Slider(gui, CL_Rect(256*5, 512, CL_Size(200, 17)));
	slider_1_ztranslation->object_matrix.translate_self(0.0f, 0.3f, 3.0f);
	slider_1_ztranslation->object_matrix.multiply(CL_Mat4f::rotate(CL_Angle(10, cl_degrees), 0.0f, 0.0f, 1.0f));
	slider_1_ztranslation->component->set_position(500);

	while(!quit)
	{
		calculate_matrix();

		gc.set_modelview(CL_Mat4f::identity());
		gc.set_map_mode(CL_MapMode(cl_map_2d_upper_left));

		// Draw the gradient
		CL_Draw::gradient_fill(gc, CL_Rect(0, 0, gc.get_width(), gc.get_height()/2), CL_Gradient(CL_Colorf(0.2f, 0.2f, 0.8f, 1.0f), CL_Colorf(0.0f, 0.0f, 0.2f, 1.0f)));
		CL_Draw::gradient_fill(gc, CL_Rect(0, gc.get_height()/2, gc.get_width(), gc.get_height()), CL_Gradient(CL_Colorf(0.0f, 0.0f, 0.2f, 1.0f), CL_Colorf(0.2f, 0.2f, 0.8f, 1.0f)));

		font.draw_text(gc, 8, 20, "GUI3D");

		int xoffset = 160;
		int yoffset = 70;
		const int ygap = 35;
		font.draw_text(gc, xoffset, yoffset, "X Rotation");
		yoffset += ygap;
		font.draw_text(gc, xoffset, yoffset, "Y Rotation");
		yoffset += ygap;
		font.draw_text(gc, xoffset, yoffset, "Z Rotation");
		yoffset += ygap;
		font.draw_text(gc, xoffset, yoffset, "X Translation");
		yoffset += ygap;
		font.draw_text(gc, xoffset, yoffset, "Y Translation");
		yoffset += ygap;
		font.draw_text(gc, xoffset, yoffset, "Z Translation");
		yoffset += ygap;

		if (!gui.run())
			break;

		gc.set_map_mode(cl_user_projection);
		gc.set_projection(projection_matrix);
		gc.set_modelview(modelview_matrix);

		control_window();

		gui.draw();

		window.flip(1);

		CL_KeepAlive::process();
	}

	return 0;
}
コード例 #16
0
ファイル: test.cpp プロジェクト: PaulFSherwood/cplusplus
	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;
	}