void CL_ListViewLayoutIcons::update_shown_items_grid(CL_Font &font, CL_ListViewItem doc_item)
{
	CL_GraphicContext &gc = listview->get_gc(); 
	shown_items.clear();
	row_counter = 0;

	CL_ListViewItem item = doc_item.get_first_child();

	int x = rect_view.left;
	int y = rect_view.top - scroll_y;

	int skip_items = (scroll_y/size_cell.height) * max_grid_cols_visible;
	int skip_rows = skip_items/max_grid_cols_visible;
	y += skip_rows * size_cell.height;
	int skip_item_counter = 0;

	while (item.is_item())
	{
		if (skip_item_counter < skip_items)
		{
			item = item.get_next_sibling();
			skip_item_counter++;
		}

		ListViewShownItem si;
		si.valid = true;
		si.item = item;
		CL_Rect rect_cell(x, y, x+size_cell.width, y+size_cell.height);
		si.rect_cell.push_back(rect_cell);
		rect_cell.shrink(rect_cell_shrink.left, rect_cell_shrink.top, rect_cell_shrink.right, rect_cell_shrink.bottom); // part_cell.get_content_box(si.rect_cell);
		CL_Rect rect_cell_content = rect_cell;
		si.rect_icon = get_icon_rect(rect_cell_content, item, rect_cell_content.left);

		const CL_StringRef &text = si.item.get_column(header->get_first_column().get_column_id()).get_text();
		CL_Size text_size = font.get_text_size(gc, text);
		CL_Rect text_rect;
		text_rect.left = rect_cell_content.get_center().x - text_size.width/2;
		text_rect.top = rect_cell_content.bottom - text_size.height;
		text_rect.set_size(text_size);
		si.descent = font.get_font_metrics().get_descent();
		si.rect_text.push_back(text_rect);

		shown_items.push_back(si);

		x += size_cell.width;

		if (x + size_cell.width > rect_view.right)
		{
			row_counter++;
			if (row_counter > (max_rows_visible+1))
				break;
			y += size_cell.height;
			x = rect_view.left;
		}

		item = item.get_next_sibling();
	}

	valid = true;
}
void CL_ListViewLayoutIcons::create_parts()
{
	part_row = CL_GUIThemePart(listview, "row");
	part_opener = CL_GUIThemePart(listview, "row_opener");
	part_cell = CL_GUIThemePart(listview, "cell");

	part_cell.set_state("icons", true);
	part_cell.set_state(CssStr::normal, true);
	part_row.set_state(CssStr::normal, true);

	size_icon.width = part_cell.get_property_int(prop_icon_width);
	size_icon.height = part_cell.get_property_int(prop_icon_height);

	CL_Font font = part_cell.get_font();
	height_text = font.get_text_size(gc, "l").height;

	size_cell = part_cell.get_preferred_size();
	height_row = size_cell.height;
	max_rows_visible = rect_view.get_height() / size_cell.width;
	max_grid_cols_visible = rect_view.get_width() / size_cell.height;

	lineedit_textrect_offset.left = part_cell.get_property_int(CssStr::lineedit_offset_left);
	lineedit_textrect_offset.top = part_cell.get_property_int(CssStr::lineedit_offset_top);
	lineedit_textrect_offset.bottom = part_cell.get_property_int(CssStr::lineedit_offset_bottom);
	lineedit_textrect_offset.right = part_cell.get_property_int(CssStr::lineedit_offset_right);
}
CL_SpanLayout_Impl::TextSizeResult CL_SpanLayout_Impl::find_text_size(CL_GraphicContext &gc, const TextBlock &block, unsigned int object_index)
{
	CL_Font font = objects[object_index].font;
	if (layout_cache.object_index != object_index)
	{
		layout_cache.object_index = object_index;
		layout_cache.metrics = font.get_font_metrics();
	}

	TextSizeResult result;
	result.start = block.start;
	int pos = block.start;
	int x_position = 0;
	while (pos != block.end)
	{
		int end = cl_min(objects[object_index].end, block.end);
		CL_StringRef subtext = text.substr(pos, end-pos);

		CL_Size text_size = font.get_text_size(gc, subtext);

		result.width += text_size.width;
		result.height = cl_max(result.height, (int)(layout_cache.metrics.get_height()+layout_cache.metrics.get_external_leading())/*text_size.height*/);
		result.ascender = cl_max(result.ascender, (int)layout_cache.metrics.get_ascent());
		result.descender = cl_max(result.descender, (int)layout_cache.metrics.get_descent());

		LineSegment segment;
		segment.type = object_text;
		segment.start = pos;
		segment.end = end;
		segment.font = objects[object_index].font;
		segment.color = objects[object_index].color;
		segment.id = objects[object_index].id;
		segment.x_position = x_position;
		segment.width = text_size.width;
		segment.ascender = (int)layout_cache.metrics.get_ascent();
		segment.descender = (int)layout_cache.metrics.get_descent();
		x_position += text_size.width;
		result.segments.push_back(segment);

		pos = end;
		if (pos == objects[object_index].end)
		{
			object_index++;
			result.objects_traversed++;

			if (object_index < objects.size())
			{
				layout_cache.object_index = object_index;
				font = objects[object_index].font;
				layout_cache.metrics = font.get_font_metrics();
			}
		}
	}
	result.end = pos;
	return result;
}
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;
}
Example #5
0
void LabelImpl::draw(CL_GraphicContext &p_gc)
{
	G_ASSERT(m_parent->isLoaded());

	float ax, ay;
	const CL_Size s = m_parent->size(p_gc);

	calculateAttachPoint(s.width, s.height, ax, ay);

	CL_Pointf position;
	position.x = m_pos.x - ax;
	position.y = m_pos.y - ay - m_fontMetrics.get_descent();

	if (m_shadowVisible) {
		drawShadow(p_gc, position);
	}

	m_clFont->draw_text(p_gc, position.x, position.y, m_text, m_color);

#if !defined(NDEBUG) && defined(DRAW_LABEL_BOUNDS)
	// draw label frame debug code
	CL_Pen newPen;
	newPen.set_line_width(1.0f);

	const CL_Pen oldPen = p_gc.get_pen();
	p_gc.set_pen(newPen);

	const float y2 = y + m_fontMetrics.get_descent();
	CL_Draw::box(p_gc, x, y2 - s.height, x + s.width, y2, CL_Colorf::red);

	p_gc.set_pen(oldPen);
#endif // !NDEBUG && DRAW_LABEL_BOUNDS
}
void CL_ListViewHeader_Impl::on_render(CL_GraphicContext &gc, const CL_Rect &update_rect)
{
	CL_Rect rect = listview_header->get_geometry();
	part_component.render_box(gc, rect.get_size(), update_rect);
	
	// draw listview column headers and backgrounds
	text_height = font.get_text_size(gc, "l").height;
	CL_ListViewColumnHeader col = first_column;
	while (!col.is_null())
	{
		CL_GUIThemePart &part = col.impl->part;
		CL_Rect &crect = col.impl->rect;
		if (display_mode != listview_mode_details)
			crect.right = rect.right;
		part.render_box(gc, crect, update_rect);
		CL_Rect content_rect = part.get_content_box(crect);

		part.render_text(gc, col.get_caption(), content_rect, update_rect);

		col = col.get_next_sibling();

		if (display_mode != listview_mode_details)
			break;
	}
}
Example #7
0
void LabelImpl::drawShadow(CL_GraphicContext &p_gc, const CL_Pointf &p_pos)
{
	CL_Pointf position;
	position.x = p_pos.x + m_shadowOffset.x;
	position.y = p_pos.y + m_shadowOffset.y;
	m_clFont->draw_text(p_gc, position.x, position.y, m_text, m_shadowColor);
}
Example #8
0
void CL_StatusBar_Impl::on_render(CL_GraphicContext &gc, const CL_Rect &update_rect)
{
	CL_Rect rect(CL_Point(0,0), statusbar->get_geometry().get_size());
	part_component.render_box(gc, rect, update_rect);
	CL_Rect content = part_component.get_content_box(rect);

	CL_Rect rect_status_text = content;

	if (show_size_grip)
	{
		int preferred_width = part_size_grip.get_preferred_width();
		CL_Rect rect_sizegrip(content.right - preferred_width, content.top, content.right, content.bottom);
		part_size_grip.render_box(gc, rect_sizegrip, update_rect);
		rect_status_text.right = rect_sizegrip.left;
	}

	if (!statusbar_parts.empty())
		rect_status_text.right = statusbar_parts[0].position.left;

	part_status_text.render_box(gc, rect_status_text, update_rect);
	CL_Rect status_text_content = part_status_text.get_content_box(rect_status_text);

	font.draw_text(gc, status_text_content.left + 4, content.bottom - 6, status_text, text_color);

	for (unsigned int index = 0; index < statusbar_parts.size(); index++)
	{
		CL_StatusBar_Part &statusbar_part = statusbar_parts[index];
		part_status_part.render_box(gc, statusbar_part.position, update_rect);
		CL_Rect part_content = part_status_part.get_content_box(statusbar_part.position);
		int icon_width = 0;
		if (!statusbar_part.icon.is_null())
		{
			statusbar_part.icon.draw(gc, (float)part_content.left + 4, (float)part_content.bottom - 6 - statusbar_part.icon.get_height());
			icon_width = statusbar_part.icon.get_width() + 4;
		}
		if (!statusbar_part.text.empty())
		{
			font.draw_text(gc, part_content.left + 4 + icon_width, part_content.bottom - 6, statusbar_part.text, text_color);
		}
	}
}
Example #9
0
void Info::draw(CL_GraphicContext &gc)
{
	CL_String text_to_draw = name;

	CL_Rect draw_rect = get_geometry();

	int draw_xpos = 0;
	int draw_ypos = 0;

	//CL_Draw::fill(gc, CL_Rect(draw_xpos, draw_ypos, CL_Size(get_width(), get_height())), CL_Colorf(CL_Colorf::red));

	CL_Font font = gui->get_font();

	CL_FontMetrics metrics = font.get_font_metrics(gc);
	draw_ypos += (int) metrics.get_ascent();

	CL_Colorf color;

	int time_diff = CL_System::get_time() - activated_time;
	float color_value = 1.0f - ( ( (float) time_diff ) / 1000.0f);
	if ( (color_value <= 1.0f) && (color_value > 0.0f) )
	{
		color = CL_Colorf(color_value, color_value/2.0f, color_value/2.0f, color_value);
		font.draw_text(gc, draw_xpos, draw_ypos, "#", color);
		color = CL_Colorf(color_value, color_value/2.0f, color_value/2.0f, 1.0f);
		text_to_draw = name + comment;

		set_constant_repaint(true);
	}
	else
	{
		color = CL_Colorf(0, 0, 0, 1.0f);
		set_constant_repaint(false);
	}

	//font.draw_text(gc, draw_xpos + 16, draw_ypos, text_to_draw, CL_Colorf::white);
	font.draw_text(gc, draw_xpos + 16-1, draw_ypos-1, text_to_draw, color);
}
CL_GUIThemePart::VerticalTextPosition CL_GUIThemePart::get_vertical_text_align(CL_GraphicContext &gc, CL_Font &font, const CL_Rect &content_rect)
{
	// See diagram in: Documentation\Overview\fonts.html (Font Metrics)

	CL_FontMetrics metrics = font.get_font_metrics();
	float align_height = metrics.get_ascent() - metrics.get_internal_leading();
	float content_height = content_rect.get_height();
	float baseline = (content_height + align_height) / 2.0f;

	VerticalTextPosition result;
	result.baseline = baseline + content_rect.top;
	result.top = result.baseline - metrics.get_ascent();
	result.bottom = result.baseline + metrics.get_descent();
	return result;
}
Example #11
0
void ExampleText::update_text(CL_GraphicContext &gc, CL_FrameBuffer &fb_text, CL_Font &font, std::vector<CL_SpanLayout> &layout)
{
	gc.set_frame_buffer(fb_text);

	CL_Draw::fill(gc, 0.0f, 0.0f, (float)text_window_size, (float)text_window_size, CL_Colorf(0.0f, 0.0f, 0.0f, 1.0f));

	CL_String text(cl_format("Frames per second = %1", last_fps));
	font.draw_text(gc, 20, 20, text, CL_Colorf::white);

	for (unsigned int line_count = 0; line_count < layout.size(); line_count++)
	{
		layout[line_count].draw_layout(gc);
	}

	gc.reset_frame_buffer();
}
Example #12
0
//Zeichnen eines Menüeintrages, z.B.: Lebensanzeige (nicht für Baufelder)
void Menu::drawMenuItem(std::string outputString, int itemLength, CL_Texture texture, CL_Font font,
		int textOffsetY, int xPosition)
{
	CL_Rectf textureRectangle;
	CL_Quadf textureQuad;

	//Definieren eines Rechtecks für Position und Größe der Textur des Menüeintrages
	textureRectangle = CL_Rectf(
		(float)xPosition,
		viewPort.get_height() - menuHeight + ((menuHeight - itemLength) / 2.0f),
		CL_Sizex<float>((float)itemLength, (float)itemLength));
	textureQuad = CL_Quadf(textureRectangle);
	CL_Draw::texture(world->get_gc(), texture, textureRectangle);
	
	//Text zum Menüeintrag schreiben
	font.draw_text(world->get_gc(), textureRectangle.right + 5.0f,
		(float)(viewPort.get_height() - menuHeight + textOffsetY),
		outputString, CL_Colorf::white);
}
Example #13
0
void LabelImpl::load(CL_GraphicContext &p_gc)
{
	CL_FontDescription desc;
	desc.set_height(m_size);

	if (m_font == Label::F_REGULAR || m_font == Label::F_BOLD) {
		desc.set_typeface_name("tahoma");

		if (m_font == Label::F_BOLD) {
			desc.set_weight(100000);
		}

		m_clFont = new CL_Font_System(p_gc, desc);
	} else {
		desc.set_typeface_name("resources/pixel.ttf");
		m_clFont = new CL_Font_Freetype(p_gc, desc);
	}

	// remember metrics
	m_fontMetrics = m_clFont->get_font_metrics(p_gc);
}
CL_Size CL_GUIThemePart::get_text_size( CL_GraphicContext &gc, const CL_StringRef &str ) const
{
	CL_Font font = get_font();
	return font.get_text_size(gc, str);
}
Example #15
0
// 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;
}
Example #16
0
// 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;
}
Example #17
0
//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;
	}
}
void FramerateCounter::show_fps(CL_GraphicContext &gc, CL_Font &fps_font)
{
	CL_String fps = cl_format("%1 fps", get_framerate());
	fps_font.draw_text(gc, gc.get_width() - 100, 30, fps);
}