Added include path to common. Renamed math to fpumath.

This commit is contained in:
bkaradzic 2013-05-23 22:07:54 -07:00
parent fc9dc6a3cd
commit 18f2e82362
18 changed files with 113 additions and 113 deletions

View File

@ -3,12 +3,12 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.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*/)
{

View File

@ -3,14 +3,14 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.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 <string.h>

View File

@ -3,14 +3,14 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.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 <string.h>

View File

@ -3,14 +3,14 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.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 <string.h>

View File

@ -3,15 +3,15 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/timer.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 <string.h>

View File

@ -3,14 +3,14 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.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 <string.h>

View File

@ -3,15 +3,15 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/countof.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 <string.h>

View File

@ -3,15 +3,15 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/timer.h>
#include <bx/readerwriter.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 <stdio.h>

View File

@ -3,16 +3,16 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/timer.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 <string.h>

View File

@ -3,17 +3,17 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/countof.h>
#include <bx/timer.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 <vector>

View File

@ -3,19 +3,19 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/timer.h>
#include <bx/countof.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 <wchar.h>

View File

@ -3,18 +3,18 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.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 <string.h>
@ -116,7 +116,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// Create a scaled down version of the same font (without adding anything to the atlas).
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);
float visibleLineCount = 20.0f;
@ -160,7 +160,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
{
fontManager->destroyFont(scaled_font);
scaled_font = fontManager->createScaledFontToPixelSize(base_distance_font, (uint32_t) textSize);
metrics = TextLineMetrics (fontManager, scaled_font);
metrics = TextLineMetrics(fontManager->getFontInfo(scaled_font) );
recomputeVisibleText = true;
}

View File

@ -3,16 +3,16 @@
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include "../common/common.h"
#include "common.h"
#include <bgfx.h>
#include <bx/timer.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 <string.h>

View File

@ -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
@ -52,7 +52,8 @@ void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
m_x = 0;
break;
}
//TODO handle kerning
m_x += glyph.advance_x;
if(m_x > m_width)
{
@ -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
@ -178,7 +178,7 @@ void TextLineMetrics::getSubText(const char* _string, uint32_t _firstLine, uint3
BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
_begin = _string;
while((*_string) && (currentLine < _lastLine) )
while ( (*_string) && (currentLine < _lastLine) )
{
for (; *_string; ++_string)
{

View File

@ -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__
#define __TEXT_METRICS_H__
@ -38,7 +38,7 @@ private:
class TextLineMetrics
{
public:
TextLineMetrics(FontManager* _fontManager, FontHandle _fontHandle);
TextLineMetrics(const FontInfo& _fontInfo);
/// Return the height of a line of text using the given font.
float getLineHeight() const { return m_lineHeight; }
@ -62,7 +62,6 @@ public:
void getVisibleText(const wchar_t* _string, float _top, float _bottom, const wchar_t*& _begin, const wchar_t*& _end);
private:
FontManager* m_fontManager;
float m_lineHeight;
};

View File

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

View File

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