forked from angusforbes/OpenGLRenderLibrary
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the process of deleting all the demo code and demo data so that this
library is leaner. Made it so that you specify the actual Renderer from the AppDelegate (rather than in the IOSGLView or NSGLView, which now can be left alone!). Added some convenience methods for loading fonts/font atlases, made it easer to load programs, textures, etc.
- Loading branch information
Angus Forbes
committed
Apr 17, 2012
1 parent
45e4a26
commit 0d404ce
Showing
181 changed files
with
106,359 additions
and
8,921 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
#include <map> | ||
#include "FontData.h" | ||
#include "Texture.hpp" | ||
#include "Vector.hpp" | ||
//#include "Program.hpp" | ||
|
||
#ifndef OpenGLRenderLibraryNS_FontAtlas_hpp | ||
#define OpenGLRenderLibraryNS_FontAtlas_hpp | ||
|
||
using namespace std; | ||
|
||
class FontAtlas { | ||
|
||
public: | ||
|
||
|
||
FontAtlas(Texture* _fontTexture, int _tw, int _th, | ||
const string& _fontName, bool _isBold, bool _isItalic, | ||
int _lineHeight, int _base, | ||
map<char, FontData*>& _values ); | ||
|
||
string fontName; | ||
Texture* fontTexture; | ||
bool isBold; | ||
bool isItalic; | ||
int tw; | ||
int th; | ||
int lineHeight; | ||
int base; | ||
map<char, FontData*> values; | ||
|
||
map<char, FontData*>& GetValues(); | ||
|
||
// void Text(float pen_x, float pen_y, string text, vec4 color, bool usePixel); | ||
// void Text(float pen_x, float pen_y, string text, vec4 color); | ||
|
||
void Bind(); | ||
void Unbind(); | ||
|
||
|
||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
#include "FontAtlas.hpp" | ||
#include "Renderer.hpp" | ||
|
||
FontAtlas::FontAtlas(Texture* _fontTexture, int _tw, int _th, | ||
const string &_fontName, bool _isBold, bool _isItalic, | ||
int _lineHeight, int _base, | ||
map<char, FontData*>& _values ) { | ||
|
||
|
||
fontTexture = _fontTexture; | ||
tw = _tw; | ||
th = _th; | ||
fontName = _fontName; | ||
isBold = _isBold; | ||
isItalic = _isItalic; | ||
lineHeight = _lineHeight; | ||
base = _base; | ||
values = _values; | ||
|
||
//should include kerning in here as well... haven't gotten around to it... | ||
|
||
} | ||
|
||
map<char, FontData*>& FontAtlas::GetValues() { | ||
|
||
return values; | ||
} | ||
|
||
void FontAtlas::Bind() { | ||
Renderer::GetRenderer()->CurrentFont = this; | ||
} | ||
|
||
void FontAtlas::Unbind() { | ||
Renderer::GetRenderer()->CurrentFont = NULL; | ||
} | ||
|
||
/* | ||
void FontAtlas::Text( float penx, float peny, string text, vec4 color, bool usePixel ) { | ||
Renderer::GetRenderer()->Text(this, penx, peny, text, color, usePixel); | ||
} | ||
void FontAtlas::Text( float penx, float peny, string text, vec4 color ) { | ||
Renderer::GetRenderer()->Text(this, penx, peny, text, color, false); | ||
} | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
|
||
#ifndef OpenGLRenderLibraryNS_FontData_h | ||
#define OpenGLRenderLibraryNS_FontData_h | ||
|
||
|
||
class FontData { | ||
|
||
public: | ||
|
||
FontData(); | ||
FontData(char _val, int _x, int _y, int _w, int _h, int _xoff, int _yoff, int _xadvance); | ||
|
||
char val; | ||
int x; | ||
int y; | ||
int w; | ||
int h; | ||
int xoff; | ||
int yoff; | ||
int xadvance; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "FontData.h" | ||
|
||
FontData::FontData(char _val, int _x, int _y, int _w, int _h, int _xoff, int _yoff, int _xadvance) { | ||
val = _val; | ||
x = _x; | ||
y = _y; | ||
w =_w; | ||
h = _h; | ||
xoff = _xoff; | ||
yoff = _yoff; | ||
xadvance = _xadvance; | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
#import "Renderer.hpp" | ||
|
||
|
||
#include <OpenGLES/ES2/gl.h> | ||
#include <OpenGLES/ES2/glext.h> | ||
|
||
|
Oops, something went wrong.