compilation back but the system does not work at all

This commit is contained in:
Edouard Dupin 2012-08-26 22:45:24 +02:00
parent 6ac6bc50d0
commit 1d5be4e953
26 changed files with 98 additions and 53 deletions

View File

@ -26,6 +26,7 @@
#define __RESOURCES_H__
#include <etk/Types.h>
#include <etk/UString.h>
#include <ewol/Debug.h>
namespace ewol

View File

@ -26,6 +26,7 @@
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/ResourceManager.h>
#include <ewol/font/FontFreeType.h>
static etk::Vector<ewol::Resource*> l_resourceList;
@ -53,7 +54,7 @@ void ewol::resource::UnInit(void)
}
// internal generic keeper ...
static ewol::Resource* Keep(etk::UString name)
static ewol::Resource* LocalKeep(etk::UString& name)
{
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
if (l_resourceList[iii] != NULL) {
@ -74,12 +75,12 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::TexturedFont*& object, i
object = NULL;
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
if (l_resourceList[iii] != NULL) {
if(l_resourceList[iii]->HasName(name)) {
if(l_resourceList[iii]->HasName(filename)) {
ewol::TexturedFont* tmpObject = static_cast<ewol::TexturedFont*>(l_resourceList[iii]);
if (NULL!=tmpObject) {
if (tmpObject->getFontSize() == size) {
l_resourceList[iii]->Increment();
object = static_cast<ewol::TexturedFont*>l_resourceList[iii]
object = static_cast<ewol::TexturedFont*>(l_resourceList[iii]);
return false;
}
}
@ -100,12 +101,12 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::TexturedFont*& object, i
bool ewol::resource::Keep(etk::UString& filename, ewol::Font*& object)
{
object = static_cast<ewol::Font*>(Keep(filename));
object = static_cast<ewol::Font*>(LocalKeep(filename));
if (NULL != object) {
return true;
}
// need to crate a new one ...
object = new ewol::Font(filename, size);
object = new ewol::FontFreeType(filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
@ -117,12 +118,12 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Font*& object)
bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
{
object = static_cast<ewol::Program*>(Keep(filename));
object = static_cast<ewol::Program*>(LocalKeep(filename));
if (NULL != object) {
return true;
}
// need to crate a new one ...
object = new ewol::Program(filename, size);
object = new ewol::Program(filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
@ -134,12 +135,12 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
{
object = static_cast<ewol::Shader*>(Keep(filename));
object = static_cast<ewol::Shader*>(LocalKeep(filename));
if (NULL != object) {
return true;
}
// need to crate a new one ...
object = new ewol::Shader(filename, size);
object = new ewol::Shader(filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
@ -151,7 +152,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
void ewol::resource::Release(ewol::Resource*& object)
{
if (NUUL == object) {
if (NULL == object) {
EWOL_ERROR("Try to remove a resource that have null pointer ...");
return;
}
@ -175,3 +176,28 @@ void ewol::resource::Release(ewol::Resource*& object)
object = NULL;
}
void ewol::resource::Release(ewol::TexturedFont*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Font*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Program*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Shader*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
object = NULL;
}

View File

@ -45,7 +45,11 @@ namespace ewol
bool Keep(etk::UString& filename, ewol::Program*& object);
bool Keep(etk::UString& filename, ewol::Shader*& object);
void Release(ewol::resource*& object);
void Release(ewol::Resource*& object);
void Release(ewol::TexturedFont*& object);
void Release(ewol::Font*& object);
void Release(ewol::Program*& object);
void Release(ewol::Shader*& object);
}
};

View File

@ -78,9 +78,11 @@ namespace ewol
} GlyphProperty;
class Font : public ewol::Resource
{
public:
Font(etk::UString fontFolder, etk::UString fontName) : ewol::Resource(fontName) {};
Font(etk::UString fontName) : ewol::Resource(fontName) {};
virtual ~Font(void) {};
const char* GetType(void) { return "ewol::Font"; };
virtual int32_t Draw(draw::Image& imageOut,
int32_t fontSize,
Vector2D<float> textPos,

View File

@ -28,7 +28,7 @@
#include <etk/Vector.h>
#include <ewol/font/FontFreeType.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
extern "C" {
#include <freetype/ft2build.h>
}
@ -63,15 +63,14 @@ void ewol::FreeTypeUnInit(void)
ewol::FontFreeType::FontFreeType(etk::UString fontFolder, etk::UString fontName) :
Font(fontFolder, fontName)
ewol::FontFreeType::FontFreeType(etk::UString fontName) :
Font(fontName)
{
m_init = false;
m_FileBuffer = NULL;
m_FileSize = 0;
etk::UString tmpFileName = fontFolder + "/" + fontName;
etk::File myfile(tmpFileName, etk::FILE_TYPE_DATA);
etk::File myfile(fontName, etk::FILE_TYPE_DATA);
if (false == myfile.Exist()) {
EWOL_ERROR("File Does not exist : " << myfile);
return;
@ -88,7 +87,7 @@ ewol::FontFreeType::FontFreeType(etk::UString fontFolder, etk::UString fontName)
// allocate data
m_FileBuffer = new FT_Byte[m_FileSize];
if (NULL == m_FileBuffer) {
EWOL_ERROR("Error Memory allocation size=" << tmpFileName);
EWOL_ERROR("Error Memory allocation size=" << fontName);
return;
}
// load data from the file :
@ -103,7 +102,7 @@ ewol::FontFreeType::FontFreeType(etk::UString fontFolder, etk::UString fontName)
EWOL_ERROR("... another error code means that the font file could not ... be opened or read, or simply that it is broken...");
} else {
// all OK
EWOL_INFO("load font : \"" << tmpFileName << "\" ");
EWOL_INFO("load font : \"" << fontName << "\" ");
//Display();
m_init = true;
}

View File

@ -44,7 +44,7 @@ namespace ewol
bool m_init;
void Display(void);
public:
FontFreeType(etk::UString fontFolder, etk::UString fontName);
FontFreeType(etk::UString fontName);
~FontFreeType(void);
int32_t Draw(draw::Image& imageOut,
int32_t fontSize,

View File

@ -26,6 +26,7 @@
#include <ewol/font/Font.h>
#include <ewol/font/TexturedFont.h>
#include <ewol/font/FontManager.h>
#include <ewol/ResourceManager.h>
static int32_t nextP2(int32_t value)
@ -56,13 +57,13 @@ static int32_t simpleSQRT(int32_t value)
ewol::TexturedFont::TexturedFont(etk::UString fontName, int32_t size) :
ewol::Resource(fontName),
m_size(size),
m_font(NULL),
m_counter(1),
m_lastGlyphPos(0,0),
m_lastRawHeigh(0)
{
m_size = size;
m_font = ewol::font::Keep(fontName);
ewol::resource::Keep(fontName, m_font);
if (NULL == m_font) {
return;
}
@ -183,7 +184,9 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName, int32_t size) :
ewol::TexturedFont::~TexturedFont(void)
{
ewol::font::Release(m_font);
if (NULL!= m_font) {
ewol::resource::Release(m_font);
}
}
int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,

View File

@ -29,10 +29,11 @@
#include <ewol/font/Font.h>
#include <ewol/texture/Texture.h>
#include <ewol/Resource.h>
namespace ewol
{
class TexturedFont {
class TexturedFont : public ewol::Resource {
typedef struct {
GlyphProperty property;
@ -44,7 +45,6 @@ namespace ewol
int32_t m_height;
ewol::Font* m_font;
ewol::Texture m_texture;
uint32_t m_counter;
etk::Vector<freeTypeFontElement_ts> m_listElement;
// for the texture generation :
Vector2D<int32_t> m_lastGlyphPos;
@ -52,10 +52,8 @@ namespace ewol
public:
TexturedFont(etk::UString fontName, int32_t size);
~TexturedFont(void);
const char* GetType(void) { return "ewol::TexturedFont"; };
int32_t getFontSize(void) { return m_size; };
bool HasName(etk::UString& fileName, int32_t size) { return (m_size!=size)?false:((m_font==NULL)?false:m_font->HasName(fileName)); };
void Increment(void) { m_counter++; };
bool Decrement(void) { m_counter--; return (m_counter==0)?true:false; };
int32_t Draw(Vector2D<float> textPos,
const etk::UString& unicodeString,
etk::Vector<Vector2D<float> > & coord,
@ -70,7 +68,6 @@ namespace ewol
int32_t GetHeight(void) { return m_height; };
int32_t GetFontSize(void) { return m_size; };
ewol::Texture& GetTex(void) { return m_texture; };
etk::UString GetFontName(void) { if(NULL==m_font) { return "error"; } return m_font->GetName(); };
};

View File

@ -23,7 +23,7 @@
*/
#include <ewol/oObject/2DColored.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <math.h>

View File

@ -23,9 +23,10 @@
*/
#include <ewol/oObject/2DTextColored.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <ewol/texture/Texture.h>
#include <ewol/font/FontManager.h>
#include <ewol/ResourceManager.h>
#undef __class__
#define __class__ "ewol::OObject2DTextColored"
@ -34,11 +35,13 @@ void ewol::OObject2DTextColored::SetFontProperty(etk::UString fontName, int32_t
{
// remove old one
if (NULL != m_font) {
ewol::font::TexturedRelease(m_font);
ewol::resource::Release(m_font);
m_font = NULL;
}
// link to new One
m_font = ewol::font::TexturedKeep(fontName, fontSize);
if (false == ewol::resource::Keep(fontName, m_font, fontSize)) {
}
}
void ewol::OObject2DTextColored::SetFont(etk::UString fontName)
@ -56,7 +59,7 @@ void ewol::OObject2DTextColored::SetSize(int32_t fontSize)
// get old size
etk::UString fontName = ewol::font::GetDefaultFont();
if (NULL != m_font) {
fontName = m_font->GetFontName();
fontName = m_font->GetName();
}
SetFontProperty(fontName, fontSize);
}
@ -81,7 +84,7 @@ ewol::OObject2DTextColored::OObject2DTextColored(void) :
ewol::OObject2DTextColored::~OObject2DTextColored(void)
{
if (NULL != m_font) {
ewol::font::TexturedRelease(m_font);
ewol::resource::Release(m_font);
m_font = NULL;
}
}

View File

@ -25,7 +25,7 @@
#include <ewol/oObject/2DTextured.h>
#include <ewol/texture/Texture.h>
#include <ewol/texture/TextureManager.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#undef __class__
#define __class__ "ewol::OObject2DTextured"

View File

@ -25,7 +25,7 @@
#include <ewol/oObject/Sprite.h>
#include <ewol/texture/Texture.h>
#include <ewol/texture/TextureManager.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <math.h>
#undef __class__

View File

@ -26,7 +26,8 @@
#include <ewol/Debug.h>
#include <ewol/openGL/Program.h>
ewol::Program::Program(etk::UString& filename) : ewol::Resource(filename)
ewol::Program::Program(etk::UString& filename) :
ewol::Resource(filename),
m_program(0),
m_needToReleaseShader(false)
{

View File

@ -28,10 +28,11 @@
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
#include <ewol/openGL/openGL.h>
namespace ewol
{
Class Program : public ewol::Resource
class Program : public ewol::Resource
{
private :
GLuint m_program;
@ -39,6 +40,7 @@ namespace ewol
public:
Program(etk::UString& filename);
virtual ~Program(void);
const char* GetType(void) { return "ewol::Program"; };
GLuint GetGL_ID(void) { return m_program; };
};
};

View File

@ -28,10 +28,11 @@
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
#include <ewol/openGL/openGL.h>
namespace ewol
{
Class Shader : public ewol::Resource
class Shader : public ewol::Resource
{
private :
GLuint m_shader;
@ -39,6 +40,7 @@ namespace ewol
public:
Shader(etk::UString& filename);
virtual ~Shader(void);
const char* GetType(void) { return "ewol::Shader"; };
GLuint GetGL_ID(void) { return m_shader; };
GLenum GetShaderType(void) { return m_type; };
};

View File

@ -23,7 +23,7 @@
*/
#include <ewol/Debug.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
void glOrthoEwol(GLfloat left,

View File

@ -36,7 +36,7 @@
#include <ewol/widget/WidgetManager.h>
#include <ewol/ShortCutManager.h>
#include <ewol/os/eSystemInput.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <ewol/os/Fps.h>
#include <ewol/font/FontManager.h>

View File

@ -37,7 +37,7 @@
#include <ewol/os/eSystem.h>
#include <ewol/ewol.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <ewol/texture/Texture.h>
#undef __class__

View File

@ -34,7 +34,7 @@
#include <ewol/texture/Texture.h>
#include <ewol/texture/TextureBMP.h>
#include <ewol/os/eSystem.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <sys/time.h>

View File

@ -26,7 +26,7 @@
#include <ewol/texture/Texture.h>
#include <ewol/texture/TextureManager.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <ewol/ewol.h>

View File

@ -28,7 +28,7 @@
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <draw/Image.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
namespace ewol {
class Texture {

View File

@ -27,7 +27,7 @@
#include <ewol/oObject/OObject.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
/**
* @brief Initilise the basic widget property ==> due to the android system

View File

@ -26,7 +26,7 @@
#include <ewol/eObject/EObjectManager.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/ewol.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
{

View File

@ -26,7 +26,7 @@
#include <ewol/oObject/OObject.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <ewol/ewol.h>

View File

@ -30,7 +30,7 @@
#include <ewol/texture/Texture.h>
#include <ewol/font/Font.h>
#include <ewol/ewol.h>
#include <ewol/openGl.h>
#include <ewol/openGL/openGL.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/os/eSystem.h>

View File

@ -1,10 +1,15 @@
# Basic elements
FILE_LIST = ewol/ewol.cpp \
ewol/openGl.cpp \
ewol/ClipBoard.cpp \
ewol/Debug.cpp \
ewol/ShortCutManager.cpp
ewol/ShortCutManager.cpp \
ewol/ResourceManager.cpp
FILE_LIST+= ewol/openGL/openGL.cpp \
ewol/openGL/Shader.cpp \
ewol/openGL/Program.cpp
# Gui interface
FILE_LIST+= ewol/os/eSystem.cpp \