mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-13 04:42:12 +03:00
Added fonts example.
Removed the allocation size parameter from the ColorPointer, VertexPointer and TexCoordPointer functions. And some minor changes.
This commit is contained in:
52
.hgignore
52
.hgignore
@@ -1,28 +1,30 @@
|
||||
syntax: glob
|
||||
./obj
|
||||
./fonts
|
||||
./libs
|
||||
./make
|
||||
./assets
|
||||
./data
|
||||
./projects/android-project/bin
|
||||
./projects/android-project/obj
|
||||
./projects/android-project/data
|
||||
./projects/android-project/gen
|
||||
*\.user
|
||||
*\.filters
|
||||
*\.suo
|
||||
*\.DS_Store
|
||||
*.pdb
|
||||
./eees*
|
||||
./eeew*
|
||||
./eetest*
|
||||
./eesound*
|
||||
./eesprite*
|
||||
./eeiv*
|
||||
./docs
|
||||
syntax: regexp
|
||||
^fonts$
|
||||
^obj$
|
||||
^libs$
|
||||
^make$
|
||||
^assets$
|
||||
^data$
|
||||
^docs$
|
||||
^projects/android-project/bin$
|
||||
^projects/android-project/obj$
|
||||
^projects/android-project/data$
|
||||
^projects/android-project/gen$
|
||||
^projects/android-project/assets$
|
||||
^projects/android-project/libs$
|
||||
.*.dll
|
||||
eees*
|
||||
eeew*
|
||||
eetest*
|
||||
eesound*
|
||||
eesprite*
|
||||
eefonts*
|
||||
eeiv*
|
||||
ee.tag
|
||||
log.log
|
||||
eepp-debug.dll
|
||||
eepp.dll
|
||||
external_projects.lua
|
||||
.*\.user$
|
||||
.*\.filters$
|
||||
.*\.suo$
|
||||
.*\.DS_Store$
|
||||
.*.pdb$
|
||||
|
||||
@@ -105,7 +105,7 @@ class EE_API cTTFFont : public cFont {
|
||||
|
||||
bool iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const bool& VerticalDraw, const Uint16& NumCharsToGen, const eeColor& FontColor, Uint8 OutlineSize, const eeColor& OutlineColor, const bool& AddPixelSeparator );
|
||||
|
||||
void MakeOutline( Uint8 *in, Uint8 *out, Int16 w, Int16 h);
|
||||
void MakeOutline( Uint8 *in, Uint8 *out, Int16 w, Int16 h, Int16 OutlineSize );
|
||||
|
||||
void RebuildFromGlyphs();
|
||||
};
|
||||
|
||||
@@ -151,11 +151,11 @@ class EE_API cGL {
|
||||
|
||||
virtual void DisableClientState( GLenum array ) = 0;
|
||||
|
||||
virtual void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) = 0;
|
||||
virtual void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) = 0;
|
||||
|
||||
virtual void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) = 0;
|
||||
virtual void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) = 0;
|
||||
|
||||
virtual void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) = 0;
|
||||
virtual void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) = 0;
|
||||
|
||||
virtual void SetShader( cShaderProgram * Shader );
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ class EE_API cRendererGL : public cGL {
|
||||
|
||||
void DisableClientState( GLenum array );
|
||||
|
||||
void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void ClipPlane( GLenum plane, const GLdouble *equation );
|
||||
|
||||
|
||||
@@ -60,11 +60,11 @@ class EE_API cRendererGL3 : public cGL {
|
||||
|
||||
void DisableClientState( GLenum array );
|
||||
|
||||
void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void ClientActiveTexture( GLenum texture );
|
||||
|
||||
|
||||
@@ -63,11 +63,11 @@ class EE_API cRendererGLES2 : public cGL {
|
||||
|
||||
void DisableClientState( GLenum array );
|
||||
|
||||
void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate );
|
||||
void TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
|
||||
void ClientActiveTexture( GLenum texture );
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class CP_API cPhysicsManager {
|
||||
|
||||
/** The Memory Manager will keep track of all the allocations from cSpace, cBody, cShape and cConstraint and will release any non-released pointer.
|
||||
*** This is a lazy deallocation for the lazy programmers. It is disabled by default.
|
||||
*** To work properly set as active before allocating anything, activate it just before the singleton instantiation.
|
||||
*** To work properly set as active before allocating anything, activate it just after the singleton instantiation.
|
||||
*/
|
||||
void MemoryManager( bool MemoryManager );
|
||||
|
||||
|
||||
10
premake4.lua
10
premake4.lua
@@ -323,6 +323,10 @@ end
|
||||
function generate_os_links()
|
||||
if os.is_real("linux") then
|
||||
multiple_insert( os_links, { "rt", "pthread", "X11", "openal", "GL", "Xcursor" } )
|
||||
|
||||
if _OPTIONS["with-static-eepp"] then
|
||||
table.insert( os_links, "dl" )
|
||||
end
|
||||
elseif os.is_real("windows") then
|
||||
multiple_insert( os_links, { "OpenAL32", "opengl32", "glu32", "gdi32" } )
|
||||
elseif os.is_real("mingw32") then
|
||||
@@ -736,6 +740,12 @@ solution "eepp"
|
||||
files { "src/examples/sprites/*.cpp" }
|
||||
build_link_configuration( "eesprites" )
|
||||
|
||||
project "eepp-fonts"
|
||||
kind "WindowedApp"
|
||||
language "C++"
|
||||
files { "src/examples/fonts/*.cpp" }
|
||||
build_link_configuration( "eefonts" )
|
||||
|
||||
if os.isfile("external_projects.lua") then
|
||||
dofile("external_projects.lua")
|
||||
end
|
||||
|
||||
@@ -6,3 +6,4 @@
|
||||
#define EE_BACKEND_SDL2
|
||||
#define EE_BACKEND_SDL_1_2
|
||||
#define EE_X11_PLATFORM
|
||||
#define EE_DEBUG
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 2.7.1, 2013-05-31T22:33:05. -->
|
||||
<!-- Written by QtCreator 2.7.1, 2013-06-02T02:10:30. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@@ -48,9 +48,9 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{388e5431-b31b-42b3-b9ad-9002d279d75d}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">16</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">8</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="GenericProjectManager.GenericBuildConfiguration.BuildDirectory">/home/programming/eepp/make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
@@ -389,6 +389,46 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">debug-sprites</value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.16">
|
||||
<value type="QString" key="GenericProjectManager.GenericBuildConfiguration.BuildDirectory">/home/programming/eepp/make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets"/>
|
||||
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
|
||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments">-j4 eepp-fonts</value>
|
||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand">make</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Command">make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">debug-test</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">debug-fonts</value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="QString" key="GenericProjectManager.GenericBuildConfiguration.BuildDirectory">/home/programming/eepp/make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
@@ -709,7 +749,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">release-es</value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">16</value>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">17</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
@@ -1100,7 +1140,54 @@
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">8</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.8">
|
||||
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
|
||||
<value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">/home/programming/eepp/eefonts-debug</value>
|
||||
<value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run /home/programming/eepp/eefonts-debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eefonts-debug</value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">9</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
|
||||
@@ -455,7 +455,6 @@
|
||||
../../src/eepp/window/platform/x11/ccursorx11.cpp
|
||||
../../src/eepp/window/platform/platformimpl.hpp
|
||||
../../src/eepp/graphics/pixelperfect.cpp
|
||||
../../src/eepp/graphics/glhelper.cpp
|
||||
../../src/eepp/graphics/cvertexbuffervbo.cpp
|
||||
../../src/eepp/graphics/cvertexbufferogl.cpp
|
||||
../../src/eepp/graphics/cvertexbuffermanager.cpp
|
||||
@@ -610,3 +609,4 @@
|
||||
../../src/eepp/window/backend/SDL2/cbackendsdl2.cpp
|
||||
../../src/examples/sound/sound.cpp
|
||||
../../src/examples/sprites/sprites.cpp
|
||||
../../src/examples/fonts/fonts.cpp
|
||||
|
||||
1
projects/linux/ee.includes
Normal file
1
projects/linux/ee.includes
Normal file
@@ -0,0 +1 @@
|
||||
../../src/
|
||||
@@ -122,18 +122,16 @@ void cBatchRenderer::Flush() {
|
||||
GLi->Translatef( -mCenter.x, -mCenter.y, 0.0f);
|
||||
}
|
||||
|
||||
Uint32 alloc = sizeof(eeVertex) * NumVertex;
|
||||
|
||||
if ( NULL != mTexture ) {
|
||||
mTF->Bind( mTexture );
|
||||
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) , alloc );
|
||||
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) );
|
||||
} else {
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
}
|
||||
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) , alloc );
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) + sizeof(eeTexCoord) , alloc );
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) );
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) + sizeof(eeTexCoord) );
|
||||
|
||||
#ifdef EE_GLES
|
||||
if ( DM_QUADS == mCurrentMode ) {
|
||||
|
||||
@@ -319,11 +319,9 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con
|
||||
numvert = TextCache.CachedVerts();
|
||||
}
|
||||
|
||||
Uint32 alloc = numvert * sizeof(eeVertexCoords);
|
||||
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , 0 , reinterpret_cast<char*>( &Colors[0] ) , alloc );
|
||||
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &RenderCoords[0] ) , alloc );
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &RenderCoords[0] ) + sizeof(eeFloat) * 2 , alloc );
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , 0 , reinterpret_cast<char*>( &Colors[0] ) );
|
||||
GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &RenderCoords[0] ) );
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &RenderCoords[0] ) + sizeof(eeFloat) * 2 );
|
||||
|
||||
#ifndef EE_GLES
|
||||
GLi->DrawArrays( GL_QUADS, 0, numvert );
|
||||
@@ -500,11 +498,9 @@ void cFont::SubDraw( const String& Text, const eeFloat& X, const eeFloat& Y, con
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 alloc = numvert * sizeof(eeVertexCoords);
|
||||
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , 0 , reinterpret_cast<char*>( &mColors[0] ) , alloc );
|
||||
GLi->TexCoordPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &mRenderCoords[0] ) , alloc );
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &mRenderCoords[0] ) + sizeof(eeFloat) * 2 , alloc );
|
||||
GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , 0 , reinterpret_cast<char*>( &mColors[0] ) );
|
||||
GLi->TexCoordPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &mRenderCoords[0] ) );
|
||||
GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast<char*>( &mRenderCoords[0] ) + sizeof(eeFloat) * 2 );
|
||||
|
||||
#ifndef EE_GLES
|
||||
GLi->DrawArrays( GL_QUADS, 0, numvert );
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <eepp/graphics/cimage.hpp>
|
||||
#include <eepp/system/filesystem.hpp>
|
||||
#include <eepp/system/clog.hpp>
|
||||
#include <eepp/system/cpack.hpp>
|
||||
#include <eepp/system/cpackmanager.hpp>
|
||||
@@ -319,6 +320,11 @@ eeUint cImage::Channels() const {
|
||||
bool cImage::SaveToFile( const std::string& filepath, const EE_SAVE_TYPE& Format ) {
|
||||
bool Res = false;
|
||||
|
||||
std::string fpath( FileSystem::FileRemoveFileName( filepath ));
|
||||
|
||||
if ( !FileSystem::IsDirectory( fpath ) )
|
||||
FileSystem::MakeDir( fpath );
|
||||
|
||||
if ( NULL != mPixels && 0 != mWidth && 0 != mHeight && 0 != mChannels ) {
|
||||
if ( SAVE_TYPE_JPG != Format ) {
|
||||
Res = 0 != ( SOIL_save_image ( filepath.c_str(), Format, (Int32)mWidth, (Int32)mHeight, mChannels, GetPixelsPtr() ) );
|
||||
|
||||
@@ -327,10 +327,8 @@ void cParticleSystem::Draw() {
|
||||
GLi->Enable( GL_POINT_SPRITE );
|
||||
GLi->PointSize( mSize );
|
||||
|
||||
Uint32 alloc = mPCount * sizeof(cParticle);
|
||||
|
||||
GLi->ColorPointer ( 4, GL_FP, sizeof(cParticle), reinterpret_cast<char*>( &mParticle[0] ) + sizeof(eeFloat) * 2 , alloc );
|
||||
GLi->VertexPointer ( 2, GL_FP, sizeof(cParticle), reinterpret_cast<char*>( &mParticle[0] ) , alloc );
|
||||
GLi->ColorPointer ( 4, GL_FP, sizeof(cParticle), reinterpret_cast<char*>( &mParticle[0] ) + sizeof(eeFloat) * 2 );
|
||||
GLi->VertexPointer ( 2, GL_FP, sizeof(cParticle), reinterpret_cast<char*>( &mParticle[0] ) );
|
||||
|
||||
GLi->DrawArrays( GL_POINTS, 0, (GLsizei)mPCount );
|
||||
|
||||
|
||||
@@ -224,9 +224,9 @@ bool cTTFFont::iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const bool& V
|
||||
if ( OutlineSize ) {
|
||||
Uint32 Pos = 0;
|
||||
|
||||
std::vector<Uint8> TexO( TexSize, 0 );
|
||||
std::vector<Uint8> TexN( TexSize, 0 );
|
||||
std::vector<Uint8> TexI( TexSize, 0 );
|
||||
Uint8 * TexO = eeNewArray( Uint8, TexSize );
|
||||
Uint8 * TexN = eeNewArray( Uint8, TexSize );
|
||||
Uint8 * TexI = eeNewArray( Uint8, TexSize );
|
||||
|
||||
// Fill the TexO ( the default font alpha channels ) and the TexN ( the new outline )
|
||||
for ( Int32 y = 0; y < mTexHeight; y++ ) {
|
||||
@@ -234,33 +234,32 @@ bool cTTFFont::iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const bool& V
|
||||
Pos = x + y * (Uint32)mTexWidth;
|
||||
TexO[ Pos ] = mPixels[ Pos ].A();
|
||||
TexN[ Pos ] = TexO[ Pos ];
|
||||
TexI[ Pos ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Uint8* alpha = reinterpret_cast<Uint8*>( &TexN[0] );
|
||||
Uint8* alpha2 = reinterpret_cast<Uint8*>( &TexI[0] );
|
||||
Uint8* alpha = reinterpret_cast<Uint8*>( &TexN[0] );
|
||||
Uint8* alpha2 = reinterpret_cast<Uint8*>( &TexI[0] );
|
||||
|
||||
// Create the outline
|
||||
for ( Uint8 passes = 0; passes < OutlineSize; passes++ ) {
|
||||
MakeOutline( alpha, alpha2, static_cast<Int16>( mTexWidth ), static_cast<Int16>( mTexHeight ) );
|
||||
|
||||
Uint8* temp = alpha;
|
||||
alpha = alpha2;
|
||||
alpha2 = temp;
|
||||
}
|
||||
MakeOutline( alpha, alpha2, static_cast<Int16>( mTexWidth ), static_cast<Int16>( mTexHeight ), OutlineSize );
|
||||
|
||||
for ( Int32 y = 0; y < mTexHeight; y++ ) {
|
||||
for( Int32 x = 0; x < mTexWidth; x++) {
|
||||
Pos = x + y * (Uint32)mTexWidth;
|
||||
|
||||
// Fill the outline color
|
||||
mPixels[ Pos ] = eeColorA( OutlineColor.R(), OutlineColor.G(), OutlineColor.B(), alpha[ Pos ] );
|
||||
mPixels[ Pos ] = eeColorA( OutlineColor.R(), OutlineColor.G(), OutlineColor.B(), alpha2[ Pos ] );
|
||||
|
||||
// Fill the font color
|
||||
if ( TexO[ Pos ] > 50 )
|
||||
mPixels[ Pos ] = eeColorA( FontColor.R(), FontColor.G(), FontColor.B(), TexO[ Pos ] );
|
||||
}
|
||||
}
|
||||
|
||||
eeSAFE_DELETE_ARRAY( TexO );
|
||||
eeSAFE_DELETE_ARRAY( TexN );
|
||||
eeSAFE_DELETE_ARRAY( TexI );
|
||||
}
|
||||
|
||||
hkFontManager::instance()->CloseFont( mFont );
|
||||
@@ -374,13 +373,13 @@ bool cTTFFont::Save( const std::string& TexturePath, const std::string& Coordina
|
||||
return SaveTexture(TexturePath, Format) && SaveCoordinates( CoordinatesDatPath );
|
||||
}
|
||||
|
||||
void cTTFFont::MakeOutline( Uint8 *in, Uint8 *out, Int16 w, Int16 h) {
|
||||
void cTTFFont::MakeOutline( Uint8 *in, Uint8 *out, Int16 w, Int16 h , Int16 OutlineSize ) {
|
||||
for ( eeInt y = 0; y < h; y++ ) {
|
||||
for( eeInt x = 0; x < w; x++ ) {
|
||||
eeInt c = in[ y * w + x ];
|
||||
eeInt c = ( in[ y * w + x ] >> 24 ) & 0xFF;
|
||||
|
||||
for ( eeInt s_y = -1; s_y <= 1; s_y++ ) {
|
||||
for ( eeInt s_x = -1; s_x <= 1; s_x++ ) {
|
||||
for ( eeInt s_y = -OutlineSize; s_y <= OutlineSize; s_y++ ) {
|
||||
for ( eeInt s_x = -OutlineSize; s_x <= OutlineSize; s_x++ ) {
|
||||
eeInt get_x = x + s_x;
|
||||
eeInt get_y = y + s_y;
|
||||
|
||||
|
||||
@@ -33,13 +33,10 @@ void cVertexBufferOGL::Draw() {
|
||||
}
|
||||
|
||||
void cVertexBufferOGL::SetVertexStates() {
|
||||
Uint32 alloc = GetVertexCount() * sizeof(GLfloat) * 2;
|
||||
Uint32 allocC = GetVertexCount() * sizeof(GL_UNSIGNED_BYTE) * 4;
|
||||
|
||||
/// POSITION
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_POSITION ) ) {
|
||||
GLi->EnableClientState( GL_VERTEX_ARRAY );
|
||||
GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_POSITION ], &mVertexArray[ VERTEX_FLAG_POSITION ][0], alloc );
|
||||
GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_POSITION ], &mVertexArray[ VERTEX_FLAG_POSITION ][0] );
|
||||
} else {
|
||||
GLi->DisableClientState( GL_VERTEX_ARRAY );
|
||||
}
|
||||
@@ -47,7 +44,7 @@ void cVertexBufferOGL::SetVertexStates() {
|
||||
/// COLOR
|
||||
if( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_COLOR ) ) {
|
||||
GLi->EnableClientState( GL_COLOR_ARRAY );
|
||||
GLi->ColorPointer( eeVertexElements[ VERTEX_FLAG_COLOR ], GL_UNSIGNED_BYTE, sizeof(Uint8) * eeVertexElements[ VERTEX_FLAG_COLOR ], &mColorArray[0], allocC );
|
||||
GLi->ColorPointer( eeVertexElements[ VERTEX_FLAG_COLOR ], GL_UNSIGNED_BYTE, sizeof(Uint8) * eeVertexElements[ VERTEX_FLAG_COLOR ], &mColorArray[0] );
|
||||
} else {
|
||||
GLi->DisableClientState( GL_COLOR_ARRAY );
|
||||
}
|
||||
@@ -59,16 +56,19 @@ void cVertexBufferOGL::SetVertexStates() {
|
||||
GLi->ClientActiveTexture( GL_TEXTURE0 + i );
|
||||
GLi->EnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 + i ][0], alloc );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 + i ][0] );
|
||||
} else {
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
if ( 0 == i ) {
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_TEXTURE0 ) ) {
|
||||
GLi->EnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 ][0], alloc );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 ][0] );
|
||||
} else {
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
@@ -192,14 +192,16 @@ void cVertexBufferVBO::SetVertexStates() {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, 0, (char*)NULL, 0 );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, 0, (char*)NULL );
|
||||
}
|
||||
|
||||
mTextured = true;
|
||||
} else {
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
break;
|
||||
if ( 0 == i ) {
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
GLi->Disable( GL_TEXTURE_2D );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -219,7 +221,7 @@ void cVertexBufferVBO::SetVertexStates() {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, 0, (char*)NULL, 0 );
|
||||
GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, 0, (char*)NULL );
|
||||
}
|
||||
|
||||
mTextured = true;
|
||||
@@ -248,7 +250,7 @@ void cVertexBufferVBO::SetVertexStates() {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, 0, (char*)NULL, 0 );
|
||||
GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, 0, (char*)NULL );
|
||||
}
|
||||
} else {
|
||||
GLi->DisableClientState( GL_VERTEX_ARRAY );
|
||||
@@ -271,7 +273,7 @@ void cVertexBufferVBO::SetVertexStates() {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
GLi->ColorPointer( eeVertexElements[ VERTEX_FLAG_COLOR ], GL_UNSIGNED_BYTE, 0, (char*)NULL, 0 );
|
||||
GLi->ColorPointer( eeVertexElements[ VERTEX_FLAG_COLOR ], GL_UNSIGNED_BYTE, 0, (char*)NULL );
|
||||
}
|
||||
} else {
|
||||
GLi->DisableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
@@ -201,15 +201,15 @@ void cRendererGL::DisableClientState( GLenum array ) {
|
||||
glDisableClientState( array );
|
||||
}
|
||||
|
||||
void cRendererGL::VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGL::VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
glVertexPointer( size, type, stride, pointer );
|
||||
}
|
||||
|
||||
void cRendererGL::ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGL::ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
glColorPointer( size, type, stride, pointer );
|
||||
}
|
||||
|
||||
void cRendererGL::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGL::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
glTexCoordPointer( size, type, stride, pointer );
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ void cRendererGL3::DisableClientState( GLenum array ) {
|
||||
}
|
||||
}
|
||||
|
||||
void cRendererGL3::VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid * pointer, GLuint allocate ) {
|
||||
void cRendererGL3::VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid * pointer ) {
|
||||
const GLint index = mAttribsLoc[ EEGL_VERTEX_ARRAY ];
|
||||
|
||||
if ( -1 != index ) {
|
||||
@@ -351,7 +351,7 @@ void cRendererGL3::VertexPointer ( GLint size, GLenum type, GLsizei stride, cons
|
||||
}
|
||||
}
|
||||
|
||||
void cRendererGL3::ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGL3::ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
const GLint index = mAttribsLoc[ EEGL_COLOR_ARRAY ];
|
||||
|
||||
if ( -1 != index ) {
|
||||
@@ -369,7 +369,7 @@ void cRendererGL3::ColorPointer ( GLint size, GLenum type, GLsizei stride, const
|
||||
}
|
||||
}
|
||||
|
||||
void cRendererGL3::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGL3::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
const GLint index = mTextureUnits[ mCurActiveTex ];
|
||||
|
||||
if ( -1 != index ) {
|
||||
|
||||
@@ -398,7 +398,7 @@ void cRendererGLES2::DisableClientState( GLenum array ) {
|
||||
}
|
||||
}
|
||||
|
||||
void cRendererGLES2::VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid * pointer, GLuint allocate ) {
|
||||
void cRendererGLES2::VertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid * pointer ) {
|
||||
const GLint index = mAttribsLoc[ EEGL_VERTEX_ARRAY ];
|
||||
|
||||
if ( -1 != index ) {
|
||||
@@ -412,7 +412,7 @@ void cRendererGLES2::VertexPointer ( GLint size, GLenum type, GLsizei stride, co
|
||||
}
|
||||
}
|
||||
|
||||
void cRendererGLES2::ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGLES2::ColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
const GLint index = mAttribsLoc[ EEGL_COLOR_ARRAY ];
|
||||
|
||||
if ( -1 != index ) {
|
||||
@@ -430,7 +430,7 @@ void cRendererGLES2::ColorPointer ( GLint size, GLenum type, GLsizei stride, con
|
||||
}
|
||||
}
|
||||
|
||||
void cRendererGLES2::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLuint allocate ) {
|
||||
void cRendererGLES2::TexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) {
|
||||
if ( mCurShaderLocal ) {
|
||||
if ( 1 == mTexActive ) {
|
||||
if ( mCurShader == mShaders[ EEGLES2_SHADER_PRIMITIVE ] ) {
|
||||
|
||||
@@ -78,8 +78,8 @@ void cDampedSpring::Draw() {
|
||||
GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
std::vector<eeColorA> tcolors( springVAR_count * 4, eeColorA( 0, 255, 0, 255 ) );
|
||||
GLi->ColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast<const GLvoid*>( &tcolors[0] ), pillVAR_count * sizeof(GLfloat) * 4 );
|
||||
GLi->VertexPointer( 2, GL_FLOAT, 0, springVAR, springVAR_count * sizeof(GLfloat) * 2 );
|
||||
GLi->ColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast<const GLvoid*>( &tcolors[0] ) );
|
||||
GLi->VertexPointer( 2, GL_FLOAT, 0, springVAR );
|
||||
|
||||
GLi->PushMatrix();
|
||||
|
||||
|
||||
@@ -81,21 +81,21 @@ void cShapeSegment::Draw( cSpace * space ) {
|
||||
|
||||
GLi->MultMatrixf( matrix );
|
||||
|
||||
GLi->VertexPointer( 3, GL_FLOAT, 0, pillVAR, pillVAR_count * sizeof(GLfloat) * 3 );
|
||||
GLi->VertexPointer( 3, GL_FLOAT, 0, pillVAR );
|
||||
|
||||
if( !seg->CP_PRIVATE(shape).sensor ) {
|
||||
eeColorA C = ColorForShape( mShape, space->Space() );
|
||||
|
||||
tcolors.assign( tcolors.size(), C );
|
||||
|
||||
GLi->ColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast<const GLvoid*>( &tcolors[0] ), pillVAR_count * sizeof(GLfloat) * 4 );
|
||||
GLi->ColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast<const GLvoid*>( &tcolors[0] ) );
|
||||
|
||||
GLi->DrawArrays( GL_TRIANGLE_FAN, 0, pillVAR_count );
|
||||
}
|
||||
|
||||
tcolors.assign( tcolors.size(), eeColorA( 102, 102, 102, 255 ) );
|
||||
|
||||
GLi->ColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast<const GLvoid*>( &tcolors[0] ), pillVAR_count * sizeof(GLfloat) * 4 );
|
||||
GLi->ColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast<const GLvoid*>( &tcolors[0] ) );
|
||||
|
||||
GLi->DrawArrays( GL_LINE_LOOP, 0, pillVAR_count );
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ void cInput::ProcessEvent( InputEvent * Event ) {
|
||||
mReleaseTrigger |= EE_BUTTON_MASK( Event->button.button );
|
||||
mClickTrigger |= EE_BUTTON_MASK( Event->button.button );
|
||||
|
||||
// I know this is ugly, but i'm to lazy to fix it, it works...
|
||||
// I know this is ugly, but i'm too lazy to fix it, it works...
|
||||
if ( Event->button.button == EE_BUTTON_LEFT ) {
|
||||
mLastButtonLeftClicked = mLastButtonLeftClick;
|
||||
mLastButtonLeftClick = Sys::GetTicks();
|
||||
|
||||
@@ -64,25 +64,6 @@ Uint32 eeConvertKeyCharacter( const Uint32& KeyCode, const Uint16& Unicode, cons
|
||||
default: break;
|
||||
}
|
||||
|
||||
/** @TODO: Report SDL2 bug not reporting Key Modifiers correctly. */
|
||||
#ifndef EE_SDL_VERSION_2
|
||||
if ( !( Modifiers & KEYMOD_NUM ) ) {
|
||||
switch ( KeyCode ) {
|
||||
case KEY_KP0: value = KEY_INSERT; break;
|
||||
case KEY_KP1: value = KEY_END; break;
|
||||
case KEY_KP2: value = KEY_DOWN; break;
|
||||
case KEY_KP3: value = KEY_PAGEDOWN; break;
|
||||
case KEY_KP4: value = KEY_LEFT; break;
|
||||
case KEY_KP5: value = 0; break;
|
||||
case KEY_KP6: value = KEY_RIGHT; break;
|
||||
case KEY_KP7: value = KEY_HOME; break;
|
||||
case KEY_KP8: value = KEY_UP; break;
|
||||
case KEY_KP9: value = KEY_PAGEUP; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
win->BackColor( eeColor( 50, 50, 50 ) );
|
||||
|
||||
// Check if created
|
||||
if ( win->Created() )
|
||||
{
|
||||
if ( win->Created() ) {
|
||||
// Create an instance of the primitive renderer
|
||||
cPrimitives p;
|
||||
|
||||
@@ -19,14 +18,12 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
p.SetColor( eeColorA( 0, 255, 0, 150 ) );
|
||||
|
||||
// Application loop
|
||||
while ( win->Running() )
|
||||
{
|
||||
while ( win->Running() ) {
|
||||
// Update the input
|
||||
win->GetInput()->Update();
|
||||
|
||||
// Check if ESCAPE key is pressed
|
||||
if ( win->GetInput()->IsKeyDown( KEY_ESCAPE ) )
|
||||
{
|
||||
if ( win->GetInput()->IsKeyDown( KEY_ESCAPE ) ) {
|
||||
// Close the window
|
||||
win->Close();
|
||||
}
|
||||
|
||||
@@ -247,10 +247,10 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
|
||||
/// VertexPointer assigns values by default to the attribute "dgl_Vertex"
|
||||
/// TextureCoordPointer to "dgl_MultiTexCoord0"
|
||||
GLi->VertexPointer( 3, GL_FLOAT, sizeof(eeVector3ff), reinterpret_cast<char*> ( &vertices[0] ), 0 );
|
||||
GLi->VertexPointer( 3, GL_FLOAT, sizeof(eeVector3ff), reinterpret_cast<char*> ( &vertices[0] ) );
|
||||
|
||||
/// ColorPointer to "dgl_FrontColor"
|
||||
GLi->ColorPointer( 4, GL_FP, sizeof(eeColorAf), reinterpret_cast<char*> ( &colors[0] ), 0 );
|
||||
GLi->ColorPointer( 4, GL_FP, sizeof(eeColorAf), reinterpret_cast<char*> ( &colors[0] ) );
|
||||
|
||||
/// Draw the lines
|
||||
GLi->DrawArrays( DM_LINES, 0, ParticlesNum );
|
||||
|
||||
110
src/examples/fonts/fonts.cpp
Normal file
110
src/examples/fonts/fonts.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
#include <eepp/ee.hpp>
|
||||
|
||||
EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
{
|
||||
// Create a new window
|
||||
cWindow * win = cEngine::instance()->CreateWindow( WindowSettings( 960, 640, "eepp - Fonts" ), ContextSettings( true ) );
|
||||
|
||||
// Set window background color
|
||||
win->BackColor( eeColor(255,255,255) );
|
||||
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
// Get the application path
|
||||
std::string AppPath = Sys::GetProcessPath();
|
||||
|
||||
// Create a new True Type Font
|
||||
cTTFFont * TTF = cTTFFont::New( "DejaVuSansMonoOutline" );
|
||||
cTTFFont * TTF2 = cTTFFont::New( "DejaVuSansMono" );
|
||||
cTextureFont * TexF = cTextureFont::New( "ProggySquareSZ" );
|
||||
cTextureFont * TexF2 = cTextureFont::New( "conchars" );
|
||||
|
||||
// Load the TTF font
|
||||
TTF->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, false, 128, eeColor(255,255,255), 3, eeColor(0,0,0), true );
|
||||
TTF2->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 24, TTF_STYLE_NORMAL, false, 128, eeColor(255,255,255), 0, eeColor(0,0,0), true );
|
||||
|
||||
// Save the TTF font so then it can be loaded as a cTextureFont
|
||||
TTF->Save( AppPath + "assets/temp/DejaVuSansMono.png", AppPath + "assets/temp/DejaVuSansMono.fnt" );
|
||||
|
||||
// Load the texture font, previusly generated from a True Type Font
|
||||
// First load the texture
|
||||
Uint32 TexFid = cTextureFactory::instance()->Load( AppPath + "assets/fonts/ProggySquareSZ.png" );
|
||||
TexF->Load( TexFid, AppPath + "assets/fonts/ProggySquareSZ.dat" );
|
||||
|
||||
// Load a monospaced texture font from image ( using the texture loader to set the color key )
|
||||
cTextureLoader TexLoader( AppPath + "assets/fonts/conchars.png" );
|
||||
TexLoader.SetColorKey( eeColor(0,0,0) );
|
||||
TexLoader.Load();;
|
||||
TexF2->Load( TexLoader.Id(), 32 );
|
||||
|
||||
// Set a text to render
|
||||
TTF->SetText( "Lorem ipsum dolor sit amet, consectetur adipisicing elit." );
|
||||
TTF2->SetText( TTF->GetText() );
|
||||
TexF->SetText( TTF->GetText() );
|
||||
TexF2->SetText( TTF->GetText() );
|
||||
|
||||
// Set the font color
|
||||
TTF2->Color( eeColor(0,0,0) );
|
||||
TexF->Color( eeColor(0,0,0) );
|
||||
|
||||
// Create a new text string
|
||||
String Txt( String::FromUtf8( "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." ) );
|
||||
|
||||
// Make the text fit the screen width ( wrap the text )
|
||||
TTF2->ShrinkText( Txt, win->GetWidth() - 96 );
|
||||
|
||||
// Create a new text cache to draw on screen
|
||||
// The cached text will
|
||||
cTextCache TxtCache( TTF2, Txt, eeColorA(0,0,0,255) );
|
||||
|
||||
// Set the font color to a substring of the text
|
||||
// To be able to set the color of the font, create the font as white
|
||||
// Create a gradient
|
||||
size_t size = TxtCache.Text().size();
|
||||
|
||||
for ( size_t i = 0; i < size; i++ ) {
|
||||
TxtCache.Color( eeColorA(255*i/size,0,0,255), i, i+1 );
|
||||
}
|
||||
|
||||
// Application loop
|
||||
while ( win->Running() ) {
|
||||
// Update the input
|
||||
win->GetInput()->Update();
|
||||
|
||||
// Check if ESCAPE key is pressed
|
||||
if ( win->GetInput()->IsKeyDown( KEY_ESCAPE ) ) {
|
||||
// Close the window
|
||||
win->Close();
|
||||
}
|
||||
|
||||
eeFloat YPos = 32;
|
||||
|
||||
// Draw the text on screen
|
||||
TTF->Draw( win->GetWidth() * 0.5f - TTF->GetTextWidth() * 0.5f, YPos );
|
||||
|
||||
TTF2->Draw( win->GetWidth() * 0.5f - TTF2->GetTextWidth() * 0.5f, ( YPos += TTF->GetTextHeight() + 24 ) );
|
||||
|
||||
TexF->Draw( win->GetWidth() * 0.5f - TexF->GetTextWidth() * 0.5f, ( YPos += TTF2->GetTextHeight() + 24 ) );
|
||||
|
||||
TexF2->Draw( win->GetWidth() * 0.5f - TexF2->GetTextWidth() * 0.5f, ( YPos += TexF->GetTextHeight() + 24 ) );
|
||||
|
||||
// Draw the cached text
|
||||
TxtCache.Draw( 48, ( YPos += TexF2->GetTextHeight() + 24 ), FONT_DRAW_CENTER );
|
||||
|
||||
// Text rotated and scaled
|
||||
TTF->Draw( win->GetWidth() * 0.5f - TTF->GetTextWidth() * 0.5f, 512, FONT_DRAW_LEFT, 0.75f, 12.5f );
|
||||
|
||||
// Draw frame
|
||||
win->Display();
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy the engine instance. Destroys all the windows and engine singletons.
|
||||
// Fonts are autoreleased by the engine
|
||||
cEngine::DestroySingleton();
|
||||
|
||||
// If was compiled in debug mode it will print the memory manager report
|
||||
EE::MemoryManager::ShowResults();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -31,9 +31,6 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
// Create a new window
|
||||
cWindow * win = cEngine::instance()->CreateWindow( WindowSettings( 640, 480, "eepp - Sprites" ), ContextSettings( true ) );
|
||||
|
||||
// Set window background color
|
||||
win->BackColor( eeColor( 0, 0, 0 ) );
|
||||
|
||||
// Check if created
|
||||
if ( win->Created() ) {
|
||||
// Get the application path
|
||||
|
||||
Reference in New Issue
Block a user