Browse Source

Added include path to common. Renamed math to fpumath.

bkaradzic 12 years ago
parent
commit
18f2e82362

+ 4 - 4
examples/00-helloworld/helloworld.cpp

@@ -3,12 +3,12 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "processevents.h"
 
 
 int _main_(int /*_argc*/, char** /*_argv*/)
 int _main_(int /*_argc*/, char** /*_argv*/)
 {
 {

+ 5 - 5
examples/01-cubes/cubes.cpp

@@ -3,14 +3,14 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 5 - 5
examples/02-metaballs/metaballs.cpp

@@ -3,14 +3,14 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 5 - 5
examples/03-raymarch/raymarch.cpp

@@ -3,14 +3,14 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 5 - 5
examples/04-mesh/mesh.cpp

@@ -3,15 +3,15 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
 #include <bx/readerwriter.h>
 #include <bx/readerwriter.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 5 - 5
examples/05-instancing/instancing.cpp

@@ -3,14 +3,14 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 5 - 5
examples/06-bump/bump.cpp

@@ -3,15 +3,15 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/countof.h>
 #include <bx/countof.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 4 - 4
examples/07-callback/callback.cpp

@@ -3,15 +3,15 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
 #include <bx/readerwriter.h>
 #include <bx/readerwriter.h>
 #include <bx/string.h>
 #include <bx/string.h>
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/aviwriter.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "aviwriter.h"
 
 
 #include <inttypes.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdio.h>

+ 6 - 6
examples/08-update/update.cpp

@@ -3,16 +3,16 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
 #include <bx/uint32_t.h>
 #include <bx/uint32_t.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
-#include "../common/packrect.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
+#include "packrect.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 6 - 6
examples/09-hdr/hdr.cpp

@@ -3,17 +3,17 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/countof.h>
 #include <bx/countof.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
 #include <bx/readerwriter.h>
 #include <bx/readerwriter.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
-#include "../common/imgui/imgui.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
+#include "imgui/imgui.h"
 
 
 #include <string.h>
 #include <string.h>
 #include <vector>
 #include <vector>

+ 7 - 7
examples/10-font/font.cpp

@@ -3,19 +3,19 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
 #include <bx/countof.h>
 #include <bx/countof.h>
 #include <bx/string.h>
 #include <bx/string.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
-#include "../common/font/font_manager.h"
-#include "../common/font/text_buffer_manager.h"
+#include "font/font_manager.h"
+#include "font/text_buffer_manager.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <wchar.h>
 #include <wchar.h>

+ 27 - 27
examples/11-fontsdf/fontsdf.cpp

@@ -3,18 +3,18 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
 
 
-#include "../common/font/font_manager.h"
-#include "../common/font/text_metrics.h"
-#include "../common/font/text_buffer_manager.h"
-#include "../common/imgui/imgui.h"
+#include "font/font_manager.h"
+#include "font/text_metrics.h"
+#include "font/text_buffer_manager.h"
+#include "imgui/imgui.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
@@ -112,13 +112,13 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 
 
 	// Create a distance field font.
 	// Create a distance field font.
 	FontHandle base_distance_font = fontManager->createFontByPixelSize(font_tt, 0, 48, FONT_TYPE_DISTANCE);
 	FontHandle base_distance_font = fontManager->createFontByPixelSize(font_tt, 0, 48, FONT_TYPE_DISTANCE);
-	
+
 	// Create a scaled down version of the same font (without adding anything to the atlas).
 	// Create a scaled down version of the same font (without adding anything to the atlas).
 	FontHandle scaled_font = fontManager->createScaledFontToPixelSize(base_distance_font, 14);
 	FontHandle scaled_font = fontManager->createScaledFontToPixelSize(base_distance_font, 14);
-		
-	TextLineMetrics metrics(fontManager, scaled_font);		
+
+	TextLineMetrics metrics(fontManager->getFontInfo(scaled_font) );
 	uint32_t lineCount = metrics.getLineCount(bigText);
 	uint32_t lineCount = metrics.getLineCount(bigText);
-	
+
 	float visibleLineCount = 20.0f;
 	float visibleLineCount = 20.0f;
 
 
 	const char* textBegin = 0;
 	const char* textBegin = 0;
@@ -129,7 +129,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 	textBufferManager->setTextColor(scrollableBuffer, 0xFFFFFFFF);
 	textBufferManager->setTextColor(scrollableBuffer, 0xFFFFFFFF);
 
 
 	textBufferManager->appendText(scrollableBuffer, scaled_font, textBegin, textEnd);
 	textBufferManager->appendText(scrollableBuffer, scaled_font, textBegin, textEnd);
-	
+
 	MouseState mouseState;
 	MouseState mouseState;
 	int32_t scrollArea = 0;
 	int32_t scrollArea = 0;
 	while (!processEvents(width, height, debug, reset, &mouseState) )
 	while (!processEvents(width, height, debug, reset, &mouseState) )
@@ -145,22 +145,22 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 
 
 		const int guiPanelWidth = 250;
 		const int guiPanelWidth = 250;
 		const int guiPanelHeight = 200;
 		const int guiPanelHeight = 200;
-	
+
 		imguiBeginScrollArea("Text Area", width - guiPanelWidth - 10, 10, guiPanelWidth, guiPanelHeight, &scrollArea);
 		imguiBeginScrollArea("Text Area", width - guiPanelWidth - 10, 10, guiPanelWidth, guiPanelHeight, &scrollArea);
 		imguiSeparatorLine();
 		imguiSeparatorLine();
-				
+
 		static float textScroll = 0.0f;
 		static float textScroll = 0.0f;
 		static float textRotation = 0.0f;
 		static float textRotation = 0.0f;
 		static float textScale = 1.0f;
 		static float textScale = 1.0f;
 		static float textSize = 14.0f;
 		static float textSize = 14.0f;
-		
-		bool recomputeVisibleText = false;		
+
+		bool recomputeVisibleText = false;
 		recomputeVisibleText |= imguiSlider("Number of lines", &visibleLineCount, 1.0f, 177.0f , 1.0f);
 		recomputeVisibleText |= imguiSlider("Number of lines", &visibleLineCount, 1.0f, 177.0f , 1.0f);
 		if(imguiSlider("Font size", &textSize, 6.0f, 64.0f , 1.0f))
 		if(imguiSlider("Font size", &textSize, 6.0f, 64.0f , 1.0f))
 		{
 		{
 			fontManager->destroyFont(scaled_font);
 			fontManager->destroyFont(scaled_font);
 			scaled_font = fontManager->createScaledFontToPixelSize(base_distance_font, (uint32_t) textSize);
 			scaled_font = fontManager->createScaledFontToPixelSize(base_distance_font, (uint32_t) textSize);
-			metrics = TextLineMetrics (fontManager, scaled_font);			
+			metrics = TextLineMetrics(fontManager->getFontInfo(scaled_font) );
 			recomputeVisibleText = true;
 			recomputeVisibleText = true;
 		}
 		}
 
 
@@ -174,9 +174,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 			metrics.getSubText(bigText,(uint32_t)textScroll, (uint32_t)(textScroll+visibleLineCount), textBegin, textEnd);			
 			metrics.getSubText(bigText,(uint32_t)textScroll, (uint32_t)(textScroll+visibleLineCount), textBegin, textEnd);			
 			textBufferManager->appendText(scrollableBuffer, scaled_font, textBegin, textEnd);
 			textBufferManager->appendText(scrollableBuffer, scaled_font, textBegin, textEnd);
 		}			
 		}			
-		
+
 		imguiEndScrollArea();
 		imguiEndScrollArea();
-		
+
 		imguiEndFrame();
 		imguiEndFrame();
 
 
 		// Set view 0 default viewport.
 		// Set view 0 default viewport.
@@ -209,10 +209,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 
 
 		// Setup a top-left ortho matrix for screen space drawing.
 		// Setup a top-left ortho matrix for screen space drawing.
 		mtxOrtho(proj, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
 		mtxOrtho(proj, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
-				
+
 		// Set view and projection matrix for view 0.
 		// Set view and projection matrix for view 0.
 		bgfx::setViewTransform(0, view, proj);
 		bgfx::setViewTransform(0, view, proj);
-		
+
 		//very crude approximation :(
 		//very crude approximation :(
 		float textAreaWidth = 0.5f * 66.0f * fontManager->getFontInfo(scaled_font).maxAdvanceWidth;
 		float textAreaWidth = 0.5f * 66.0f * fontManager->getFontInfo(scaled_font).maxAdvanceWidth;
 
 
@@ -220,7 +220,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 		float textCenterMat[16];
 		float textCenterMat[16];
 		float textScaleMat[16];
 		float textScaleMat[16];
 		float screenCenterMat[16];
 		float screenCenterMat[16];
-		
+
 		mtxRotateZ(textRotMat, textRotation);
 		mtxRotateZ(textRotMat, textRotation);
 		mtxTranslate(textCenterMat, -(textAreaWidth * 0.5f), (-visibleLineCount)*metrics.getLineHeight()*0.5f, 0);
 		mtxTranslate(textCenterMat, -(textAreaWidth * 0.5f), (-visibleLineCount)*metrics.getLineHeight()*0.5f, 0);
 		mtxScale(textScaleMat, textScale, textScale, 1.0f);
 		mtxScale(textScaleMat, textScale, textScale, 1.0f);
@@ -229,16 +229,16 @@ int _main_(int /*_argc*/, char** /*_argv*/)
 		//first translate to text center, then scale, then rotate
 		//first translate to text center, then scale, then rotate
 		float tmpMat[16];
 		float tmpMat[16];
 		mtxMul(tmpMat, textCenterMat, textRotMat);
 		mtxMul(tmpMat, textCenterMat, textRotMat);
-		
+
 		float tmpMat2[16];
 		float tmpMat2[16];
 		mtxMul(tmpMat2, tmpMat, textScaleMat);
 		mtxMul(tmpMat2, tmpMat, textScaleMat);
-		
+
 		float tmpMat3[16];
 		float tmpMat3[16];
 		mtxMul(tmpMat3, tmpMat2, screenCenterMat);
 		mtxMul(tmpMat3, tmpMat2, screenCenterMat);
 
 
 		// Set model matrix for rendering.
 		// Set model matrix for rendering.
 		bgfx::setTransform(tmpMat3);
 		bgfx::setTransform(tmpMat3);
-	
+
 		// Draw your text.
 		// Draw your text.
 		textBufferManager->submitTextBuffer(scrollableBuffer, 0);
 		textBufferManager->submitTextBuffer(scrollableBuffer, 0);
 
 

+ 6 - 6
examples/12-lod/lod.cpp

@@ -3,16 +3,16 @@
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  * License: http://www.opensource.org/licenses/BSD-2-Clause
  */
  */
 
 
-#include "../common/common.h"
+#include "common.h"
 
 
 #include <bgfx.h>
 #include <bgfx.h>
 #include <bx/timer.h>
 #include <bx/timer.h>
 #include <bx/readerwriter.h>
 #include <bx/readerwriter.h>
-#include "../common/entry.h"
-#include "../common/dbg.h"
-#include "../common/math.h"
-#include "../common/processevents.h"
-#include "../common/imgui/imgui.h"
+#include "entry.h"
+#include "dbg.h"
+#include "fpumath.h"
+#include "processevents.h"
+#include "imgui/imgui.h"
 
 
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>

+ 13 - 13
examples/common/font/text_metrics.cpp

@@ -1,7 +1,7 @@
 /*
 /*
- * Copyright 2013 Jeremie Roy. All rights reserved.
- * License: http://www.opensource.org/licenses/BSD-2-Clause
- */
+* Copyright 2013 Jeremie Roy. All rights reserved.
+* License: http://www.opensource.org/licenses/BSD-2-Clause
+*/
 
 
 #include <wchar.h> // wcslen
 #include <wchar.h> // wcslen
 
 
@@ -22,7 +22,7 @@ void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
 {
 {
 	GlyphInfo glyph;
 	GlyphInfo glyph;
 	const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);
 	const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);
-	
+
 	if (font.lineGap > m_lineGap)
 	if (font.lineGap > m_lineGap)
 	{
 	{
 		m_lineGap = font.lineGap;
 		m_lineGap = font.lineGap;
@@ -37,7 +37,7 @@ void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
 
 
 	CodePoint codepoint = 0;
 	CodePoint codepoint = 0;
 	uint32_t state = 0;
 	uint32_t state = 0;
-	
+
 	for (; *_string; ++_string)
 	for (; *_string; ++_string)
 	{
 	{
 		if (!utf8_decode(&state, (uint32_t*)&codepoint, *_string) )
 		if (!utf8_decode(&state, (uint32_t*)&codepoint, *_string) )
@@ -52,7 +52,8 @@ void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
 					m_x = 0;
 					m_x = 0;
 					break;
 					break;
 				}
 				}
-				//TODO handle kerning
+
+
 				m_x += glyph.advance_x;
 				m_x += glyph.advance_x;
 				if(m_x > m_width)
 				if(m_x > m_width)
 				{
 				{
@@ -73,7 +74,7 @@ void TextMetrics::appendText(FontHandle _fontHandle, const wchar_t* _string)
 {
 {
 	GlyphInfo glyph;
 	GlyphInfo glyph;
 	const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);
 	const FontInfo& font = m_fontManager->getFontInfo(_fontHandle);
-	
+
 	if (font.lineGap > m_lineGap) 
 	if (font.lineGap > m_lineGap) 
 	{
 	{
 		m_lineGap = font.lineGap;
 		m_lineGap = font.lineGap;
@@ -113,10 +114,9 @@ void TextMetrics::appendText(FontHandle _fontHandle, const wchar_t* _string)
 	}
 	}
 }
 }
 
 
-TextLineMetrics::TextLineMetrics(FontManager* _fontManager, FontHandle _fontHandle)
+TextLineMetrics::TextLineMetrics(const FontInfo& _fontInfo)
 {
 {
-	const FontInfo& font = _fontManager->getFontInfo(_fontHandle);
-	m_lineHeight = font.ascender - font.descender + font.lineGap;
+	m_lineHeight = _fontInfo.ascender - _fontInfo.descender + _fontInfo.lineGap;
 }
 }
 
 
 uint32_t TextLineMetrics::getLineCount(const char* _string) const
 uint32_t TextLineMetrics::getLineCount(const char* _string) const
@@ -177,8 +177,8 @@ void TextLineMetrics::getSubText(const char* _string, uint32_t _firstLine, uint3
 
 
 	BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
 	BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
 	_begin = _string;
 	_begin = _string;
-	
-	while((*_string) && (currentLine < _lastLine) )
+
+	while ( (*_string) && (currentLine < _lastLine) )
 	{
 	{
 		for (; *_string; ++_string)
 		for (; *_string; ++_string)
 		{	
 		{	
@@ -281,7 +281,7 @@ void TextLineMetrics::getVisibleText(const wchar_t* _string, float _top, float _
 {
 {
 	// y is bottom of a text line
 	// y is bottom of a text line
 	float y = m_lineHeight;
 	float y = m_lineHeight;
-	
+
 	const wchar_t* _textEnd = _string + wcslen(_string);
 	const wchar_t* _textEnd = _string + wcslen(_string);
 
 
 	while (y < _top)
 	while (y < _top)

+ 8 - 9
examples/common/font/text_metrics.h

@@ -1,7 +1,7 @@
 /*
 /*
- * Copyright 2013 Jeremie Roy. All rights reserved.
- * License: http://www.opensource.org/licenses/BSD-2-Clause
- */
+* Copyright 2013 Jeremie Roy. All rights reserved.
+* License: http://www.opensource.org/licenses/BSD-2-Clause
+*/
 
 
 #ifndef __TEXT_METRICS_H__
 #ifndef __TEXT_METRICS_H__
 #define __TEXT_METRICS_H__
 #define __TEXT_METRICS_H__
@@ -12,13 +12,13 @@ class TextMetrics
 {
 {
 public:
 public:
 	TextMetrics(FontManager* _fontManager);
 	TextMetrics(FontManager* _fontManager);
-	
+
 	/// Append an ASCII/utf-8 string to the metrics helper.
 	/// Append an ASCII/utf-8 string to the metrics helper.
 	void appendText(FontHandle _fontHandle, const char* _string);
 	void appendText(FontHandle _fontHandle, const char* _string);
 
 
 	/// Append a wide char string to the metrics helper.
 	/// Append a wide char string to the metrics helper.
 	void appendText(FontHandle _fontHandle, const wchar_t* _string);
 	void appendText(FontHandle _fontHandle, const wchar_t* _string);
-		
+
 	/// Return the width of the measured text.
 	/// Return the width of the measured text.
 	float getWidth() const { return m_width; }
 	float getWidth() const { return m_width; }
 
 
@@ -38,8 +38,8 @@ private:
 class TextLineMetrics
 class TextLineMetrics
 {
 {
 public:
 public:
-	TextLineMetrics(FontManager* _fontManager, FontHandle _fontHandle);
-	
+	TextLineMetrics(const FontInfo& _fontInfo);
+
 	/// Return the height of a line of text using the given font.
 	/// Return the height of a line of text using the given font.
 	float getLineHeight() const { return m_lineHeight; }
 	float getLineHeight() const { return m_lineHeight; }
 
 
@@ -48,7 +48,7 @@ public:
 
 
 	/// Return the number of text line in the given text.
 	/// Return the number of text line in the given text.
 	uint32_t getLineCount(const wchar_t* _string) const;
 	uint32_t getLineCount(const wchar_t* _string) const;
-	
+
 	/// Return the first and last character visible in the [_firstLine, _lastLine] range.
 	/// Return the first and last character visible in the [_firstLine, _lastLine] range.
 	void getSubText(const char* _string, uint32_t _firstLine, uint32_t _lastLine, const char*& _begin, const char*& _end);
 	void getSubText(const char* _string, uint32_t _firstLine, uint32_t _lastLine, const char*& _begin, const char*& _end);
 
 
@@ -62,7 +62,6 @@ public:
 	void getVisibleText(const wchar_t* _string, float _top, float _bottom, const wchar_t*& _begin, const wchar_t*& _end);
 	void getVisibleText(const wchar_t* _string, float _top, float _bottom, const wchar_t*& _begin, const wchar_t*& _end);
 
 
 private:
 private:
-	FontManager* m_fontManager;
 	float m_lineHeight;
 	float m_lineHeight;
 };
 };
 
 

+ 0 - 0
examples/common/math.h → examples/common/fpumath.h


+ 1 - 1
examples/common/imgui/imgui.cpp

@@ -29,7 +29,7 @@
 #include <bgfx.h>
 #include <bgfx.h>
 
 
 #include "imgui.h"
 #include "imgui.h"
-#include "../math.h"
+#include "../fpumath.h"
 
 
 #include "vs_imgui_color.bin.h"
 #include "vs_imgui_color.bin.h"
 #include "fs_imgui_color.bin.h"
 #include "fs_imgui_color.bin.h"

+ 1 - 0
premake/premake4.lua

@@ -47,6 +47,7 @@ function exampleProject(_name, _uuid)
 		BX_DIR .. "include",
 		BX_DIR .. "include",
 		BGFX_DIR .. "include",
 		BGFX_DIR .. "include",
 		BGFX_DIR .. "3rdparty",
 		BGFX_DIR .. "3rdparty",
+		BGFX_DIR .. "examples/common",
 	}
 	}
 
 
 	files {
 	files {