[DEV] rework (step 3)
This commit is contained in:
parent
4a8aa9f7b0
commit
f89d88e62a
@ -1,166 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/UserConfig.h>
|
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
|
||||||
#include <etk/os/FSNode.h>
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
#include <exml/Declaration.h>
|
|
||||||
|
|
||||||
class UserConfig : public ewol::EObject
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
etk::Vector<ewol::EObject*> m_list;
|
|
||||||
etk::UString m_fileName;
|
|
||||||
public:
|
|
||||||
UserConfig(void) : m_fileName("USERDATA:generalConfig.xml")
|
|
||||||
{
|
|
||||||
m_static = true; // Note : Set the object static notification( Must be set or assert at the end of process)
|
|
||||||
};
|
|
||||||
~UserConfig(void) { m_list.Clear(); };
|
|
||||||
etk::Vector<ewol::EObject*>& List(void) { return m_list; };
|
|
||||||
etk::UString& FileName(void) { return m_fileName; };
|
|
||||||
|
|
||||||
void OnObjectRemove(ewol::EObject * _removeObject)
|
|
||||||
{
|
|
||||||
for( int32_t iii=m_list.Size()-1 ; iii>=0 ; iii--) {
|
|
||||||
if (m_list[iii] == _removeObject) {
|
|
||||||
m_list.Erase(iii);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static UserConfig& l_obj(void)
|
|
||||||
{
|
|
||||||
static UserConfig s_obj;
|
|
||||||
return s_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::userConfig::Init(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::userConfig::UnInit(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const ewol::EObject* ewol::userConfig::GetUserConfig(const etk::UString& _name)
|
|
||||||
{
|
|
||||||
if (_name == "") {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
|
||||||
if (l_obj().List()[iii] != NULL) {
|
|
||||||
if (l_obj().List()[iii]->GetName() == _name) {
|
|
||||||
return l_obj().List()[iii];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::userConfig::AddUserConfig(ewol::EObject* _newConfig)
|
|
||||||
{
|
|
||||||
if (_newConfig == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
|
||||||
if (l_obj().List()[iii] != NULL) {
|
|
||||||
if (l_obj().List()[iii] == _newConfig) {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l_obj().List().PushBack(_newConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::userConfig::SetConfigName(const etk::UString& _fileName)
|
|
||||||
{
|
|
||||||
l_obj().FileName() = _fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ewol::userConfig::Load(void)
|
|
||||||
{
|
|
||||||
// allocate the document in the stack
|
|
||||||
exml::Document doc;
|
|
||||||
if (false == doc.Load(l_obj().FileName())) {
|
|
||||||
EWOL_ERROR("Error occured when loading XML : " << l_obj().FileName());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (0 == doc.Size() ) {
|
|
||||||
EWOL_ERROR("(l ?) No nodes in the xml file ... \"" << l_obj().FileName() << "\"");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
exml::Element* root = (exml::Element*)doc.GetNamed("config");
|
|
||||||
if (NULL == root ) {
|
|
||||||
EWOL_ERROR("(l ?) main node not find: \"config\" in \"" << l_obj().FileName() << "\"");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for(int32_t iii=0; iii< root->Size(); iii++) {
|
|
||||||
exml::Element* child = root->GetElement(iii);
|
|
||||||
if (child==NULL) {
|
|
||||||
// other than element is trash here
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
bool elementFound = false;
|
|
||||||
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
|
||||||
if (l_obj().List()[iii] != NULL) {
|
|
||||||
if (l_obj().List()[iii]->GetName() == child->GetValue()) {
|
|
||||||
l_obj().List()[iii]->LoadXML(child);
|
|
||||||
elementFound = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (elementFound==false) {
|
|
||||||
EWOL_ERROR("(l "<<child->GetPos()<<") node not suported : \""<<child->GetValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ewol::userConfig::Save(void)
|
|
||||||
{
|
|
||||||
// step 1 : Move the file to prevent writing error
|
|
||||||
etk::FSNodeHistory(l_obj().FileName(), 9);
|
|
||||||
|
|
||||||
exml::Document doc;
|
|
||||||
doc.Append(new exml::DeclarationXML("1.0"));
|
|
||||||
exml::Element * ElementBase = new exml::Element("config");
|
|
||||||
doc.Append(ElementBase);
|
|
||||||
for (int32_t iii=0; iii<l_obj().List().Size() ; iii++) {
|
|
||||||
if (l_obj().List()[iii] == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (l_obj().List()[iii]->GetName().Size() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
exml::Element* element = new exml::Element(l_obj().List()[iii]->GetName());
|
|
||||||
if (NULL != element) {
|
|
||||||
l_obj().List()[iii]->StoreXML(element);
|
|
||||||
ElementBase->Append(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Save Document
|
|
||||||
doc.Store(l_obj().FileName());
|
|
||||||
EWOL_DEBUG("Save in file : " << l_obj().FileName());
|
|
||||||
// step 3 : Remove oldest save
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __EWOL_USER_CONFIG_H__
|
|
||||||
#define __EWOL_USER_CONFIG_H__
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <etk/Stream.h>
|
|
||||||
#include <ewol/eObject/EObject.h>
|
|
||||||
|
|
||||||
namespace ewol
|
|
||||||
{
|
|
||||||
namespace userConfig
|
|
||||||
{
|
|
||||||
void Init(void);
|
|
||||||
void UnInit(void);
|
|
||||||
const ewol::EObject* GetUserConfig(const etk::UString& _name);
|
|
||||||
void AddUserConfig(ewol::EObject* _newConfig);
|
|
||||||
//void RmUserConfig(ewol::EObject* _newConfig); // note : To remove user config ==> just destroy it ==> simple ..
|
|
||||||
void SetConfigName(const etk::UString& _fileName="USERDATA:generalConfig.xml");
|
|
||||||
bool Load(void);
|
|
||||||
bool Save(void);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/clipBoard.h>
|
#include <ewol/clipBoard.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ClipBoard"
|
#define __class__ "ClipBoard"
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Area.h>
|
#include <ewol/compositing/Area.h>
|
||||||
#include <ewol/config.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Area"
|
#define __class__ "ewol::Area"
|
||||||
@ -24,7 +23,7 @@ ewol::Area::Area(const ivec2& _size) :
|
|||||||
m_GLtexID(-1),
|
m_GLtexID(-1),
|
||||||
m_resource(NULL)
|
m_resource(NULL)
|
||||||
{
|
{
|
||||||
ewol::resource::Keep(m_resource);
|
ewol::ResourceManager::Keep(m_resource);
|
||||||
m_resource->SetImageSize(_size);
|
m_resource->SetImageSize(_size);
|
||||||
m_resource->Flush();
|
m_resource->Flush();
|
||||||
LoadProgram();
|
LoadProgram();
|
||||||
@ -33,10 +32,10 @@ ewol::Area::Area(const ivec2& _size) :
|
|||||||
ewol::Area::~Area(void)
|
ewol::Area::~Area(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_resource) {
|
if (NULL != m_resource) {
|
||||||
ewol::resource::Release(m_resource);
|
ewol::ResourceManager::Release(m_resource);
|
||||||
m_resource = NULL;
|
m_resource = NULL;
|
||||||
}
|
}
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Area::LoadProgram(void)
|
void ewol::Area::LoadProgram(void)
|
||||||
@ -44,7 +43,7 @@ void ewol::Area::LoadProgram(void)
|
|||||||
etk::UString tmpString("DATA:textured3D.prog");
|
etk::UString tmpString("DATA:textured3D.prog");
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||||
|
@ -289,7 +289,7 @@ void ewol::Drawing::ResetCount(void)
|
|||||||
void ewol::Drawing::UnLoadProgram(void)
|
void ewol::Drawing::UnLoadProgram(void)
|
||||||
{
|
{
|
||||||
if (NULL!=m_GLprogram) {
|
if (NULL!=m_GLprogram) {
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
m_GLprogram = NULL;
|
m_GLprogram = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ void ewol::Drawing::LoadProgram(void)
|
|||||||
// oad the new ...
|
// oad the new ...
|
||||||
etk::UString tmpString("DATA:color3.prog");
|
etk::UString tmpString("DATA:color3.prog");
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Image.h>
|
#include <ewol/compositing/Image.h>
|
||||||
#include <ewol/config.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Image"
|
#define __class__ "ewol::Image"
|
||||||
@ -35,10 +34,10 @@ ewol::Image::Image(const etk::UString& _imageName) :
|
|||||||
ewol::Image::~Image(void)
|
ewol::Image::~Image(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_resource) {
|
if (NULL != m_resource) {
|
||||||
ewol::resource::Release(m_resource);
|
ewol::ResourceManager::Release(m_resource);
|
||||||
m_resource = NULL;
|
m_resource = NULL;
|
||||||
}
|
}
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Image::LoadProgram(void)
|
void ewol::Image::LoadProgram(void)
|
||||||
@ -46,7 +45,7 @@ void ewol::Image::LoadProgram(void)
|
|||||||
etk::UString tmpString("DATA:textured3D.prog");
|
etk::UString tmpString("DATA:textured3D.prog");
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||||
@ -241,14 +240,14 @@ void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size)
|
|||||||
Clear();
|
Clear();
|
||||||
// remove old one
|
// remove old one
|
||||||
if (NULL != m_resource) {
|
if (NULL != m_resource) {
|
||||||
ewol::resource::Release(m_resource);
|
ewol::ResourceManager::Release(m_resource);
|
||||||
m_resource = NULL;
|
m_resource = NULL;
|
||||||
}
|
}
|
||||||
ivec2 tmpSize(_size.x(),_size.y());
|
ivec2 tmpSize(_size.x(),_size.y());
|
||||||
// note that no image can be loaded...
|
// note that no image can be loaded...
|
||||||
if (_newFile != "") {
|
if (_newFile != "") {
|
||||||
// link to new One
|
// link to new One
|
||||||
if (false == ewol::resource::Keep(_newFile, m_resource, tmpSize)) {
|
if (false == ewol::ResourceManager::Keep(_newFile, m_resource, tmpSize)) {
|
||||||
EWOL_ERROR("Can not get Image resource");
|
EWOL_ERROR("Can not get Image resource");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
#include <ewol/config.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Shaper"
|
#define __class__ "ewol::Shaper"
|
||||||
@ -52,15 +51,15 @@ ewol::Shaper::~Shaper(void)
|
|||||||
void ewol::Shaper::UnLoadProgram(void)
|
void ewol::Shaper::UnLoadProgram(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_GLprogram) {
|
if (NULL != m_GLprogram) {
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
m_GLprogram = NULL;
|
m_GLprogram = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != m_resourceTexture) {
|
if (NULL != m_resourceTexture) {
|
||||||
ewol::resource::Release(m_resourceTexture);
|
ewol::ResourceManager::Release(m_resourceTexture);
|
||||||
m_resourceTexture = NULL;
|
m_resourceTexture = NULL;
|
||||||
}
|
}
|
||||||
if (NULL != m_config) {
|
if (NULL != m_config) {
|
||||||
ewol::resource::Release(m_config);
|
ewol::ResourceManager::Release(m_config);
|
||||||
m_config = NULL;
|
m_config = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ void ewol::Shaper::LoadProgram(void)
|
|||||||
EWOL_DEBUG("no Shaper set for loading resources ...");
|
EWOL_DEBUG("no Shaper set for loading resources ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (true == ewol::resource::Keep(m_name, m_config) ) {
|
if (true == ewol::ResourceManager::Keep(m_name, m_config) ) {
|
||||||
m_confIdPaddingX = m_config->Request("PaddingX");
|
m_confIdPaddingX = m_config->Request("PaddingX");
|
||||||
m_confIdPaddingY = m_config->Request("PaddingY");
|
m_confIdPaddingY = m_config->Request("PaddingY");
|
||||||
m_confIdChangeTime = m_config->Request("ChangeTime");
|
m_confIdChangeTime = m_config->Request("ChangeTime");
|
||||||
@ -86,7 +85,7 @@ void ewol::Shaper::LoadProgram(void)
|
|||||||
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
|
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
if (true == ewol::resource::Keep(tmpFilename, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(tmpFilename, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||||
// Widget property ==> for the Vertex shader
|
// Widget property ==> for the Vertex shader
|
||||||
@ -105,7 +104,7 @@ void ewol::Shaper::LoadProgram(void)
|
|||||||
if (basicImageFile != "") {
|
if (basicImageFile != "") {
|
||||||
tmpFilename = file.GetRelativeFolder() + basicImageFile;
|
tmpFilename = file.GetRelativeFolder() + basicImageFile;
|
||||||
ivec2 size(64,64);
|
ivec2 size(64,64);
|
||||||
if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) {
|
if (true == ewol::ResourceManager::Keep(tmpFilename, m_resourceTexture, size) ) {
|
||||||
// nothing else to do ...
|
// nothing else to do ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Sprite.h>
|
#include <ewol/compositing/Sprite.h>
|
||||||
#include <ewol/config.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Sprite"
|
#define __class__ "ewol::Sprite"
|
||||||
|
@ -8,42 +8,11 @@
|
|||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/config.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Text"
|
#define __class__ "ewol::Text"
|
||||||
|
|
||||||
ewol::Text::Text(void) :
|
|
||||||
m_position(0.0, 0.0, 0.0),
|
|
||||||
m_clippingPosStart(0.0, 0.0, 0.0),
|
|
||||||
m_clippingPosStop(0.0, 0.0, 0.0),
|
|
||||||
m_clippingEnable(false),
|
|
||||||
m_color(etk::color::black),
|
|
||||||
m_colorBg(etk::color::none),
|
|
||||||
m_colorCursor(etk::color::black),
|
|
||||||
m_colorSelection(etk::color::olive),
|
|
||||||
m_mode(ewol::font::Regular),
|
|
||||||
m_kerning(true),
|
|
||||||
m_distanceField(false),
|
|
||||||
m_previousCharcode(0),
|
|
||||||
m_startTextpos(0),
|
|
||||||
m_stopTextPos(0),
|
|
||||||
m_alignement(ewol::Text::alignDisable),
|
|
||||||
m_GLprogram(NULL),
|
|
||||||
m_GLPosition(-1),
|
|
||||||
m_GLMatrix(-1),
|
|
||||||
m_GLColor(-1),
|
|
||||||
m_GLtexture(-1),
|
|
||||||
m_GLtexID(-1),
|
|
||||||
m_selectionStartPos(-100),
|
|
||||||
m_cursorPos(-100),
|
|
||||||
m_font(NULL)
|
|
||||||
{
|
|
||||||
SetFont("", -1);
|
|
||||||
LoadProgram();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ewol::Text::Text(const etk::UString& _fontName, int32_t _fontSize) :
|
ewol::Text::Text(const etk::UString& _fontName, int32_t _fontSize) :
|
||||||
m_position(0.0, 0.0, 0.0),
|
m_position(0.0, 0.0, 0.0),
|
||||||
@ -80,10 +49,10 @@ ewol::Text::~Text(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (NULL != m_font) {
|
if (NULL != m_font) {
|
||||||
ewol::resource::Release(m_font);
|
ewol::ResourceManager::Release(m_font);
|
||||||
m_font = NULL;
|
m_font = NULL;
|
||||||
}
|
}
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Text::LoadProgram(void)
|
void ewol::Text::LoadProgram(void)
|
||||||
@ -91,7 +60,7 @@ void ewol::Text::LoadProgram(void)
|
|||||||
etk::UString tmpString("DATA:text.prog");
|
etk::UString tmpString("DATA:text.prog");
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||||
@ -347,19 +316,19 @@ void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize)
|
|||||||
Clear();
|
Clear();
|
||||||
// remove old one
|
// remove old one
|
||||||
if (NULL != m_font) {
|
if (NULL != m_font) {
|
||||||
ewol::resource::Release(m_font);
|
ewol::ResourceManager::Release(m_font);
|
||||||
m_font = NULL;
|
m_font = NULL;
|
||||||
}
|
}
|
||||||
if (_fontSize <= 0) {
|
if (_fontSize <= 0) {
|
||||||
_fontSize = ewol::config::FontGetDefaultSize();
|
_fontSize = ewol::eSystem::GetSystem().GetFontDefault().GetSize();
|
||||||
}
|
}
|
||||||
if (_fontName == "") {
|
if (_fontName == "") {
|
||||||
_fontName = ewol::config::FontGetDefaultName();
|
_fontName = ewol::eSystem::GetSystem().GetFontDefault().GetName();
|
||||||
}
|
}
|
||||||
_fontName += ":";
|
_fontName += ":";
|
||||||
_fontName += _fontSize;
|
_fontName += _fontSize;
|
||||||
// link to new One
|
// link to new One
|
||||||
if (false == ewol::resource::Keep(_fontName, m_font)) {
|
if (false == ewol::ResourceManager::Keep(_fontName, m_font)) {
|
||||||
EWOL_ERROR("Can not get font resource");
|
EWOL_ERROR("Can not get font resource");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,16 +94,12 @@ namespace ewol
|
|||||||
*/
|
*/
|
||||||
void LoadProgram(void);
|
void LoadProgram(void);
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @brief generic constructor
|
|
||||||
*/
|
|
||||||
Text(void);
|
|
||||||
/**
|
/**
|
||||||
* @brief generic constructor
|
* @brief generic constructor
|
||||||
* @param[in] _fontName Name of the font that might be loaded
|
* @param[in] _fontName Name of the font that might be loaded
|
||||||
* @param[in] _fontSize Size of the font that might be loaded
|
* @param[in] _fontSize Size of the font that might be loaded
|
||||||
*/
|
*/
|
||||||
Text(const etk::UString& _fontName, int32_t _fontSize);
|
Text(const etk::UString& _fontName="", int32_t _fontSize=-1);
|
||||||
/**
|
/**
|
||||||
* @brief generic destructor
|
* @brief generic destructor
|
||||||
*/
|
*/
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/config.h>
|
|
||||||
#include <ewol/renderer/resources/FontFreeType.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::config"
|
|
||||||
|
|
||||||
static etk::UString l_fontConfigFolder = "DATA::fonts";
|
|
||||||
static etk::UString l_fontConfigName = "Arial";
|
|
||||||
static int32_t l_fontConfigSize = 10;
|
|
||||||
|
|
||||||
void ewol::config::Init(void)
|
|
||||||
{
|
|
||||||
// reset font properties
|
|
||||||
l_fontConfigFolder = "DATA::fonts";
|
|
||||||
l_fontConfigName = "Arial;Helvetica";
|
|
||||||
l_fontConfigSize = 10;
|
|
||||||
ewol::FreeTypeInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::config::UnInit(void)
|
|
||||||
{
|
|
||||||
// UnInit FreeTypes
|
|
||||||
ewol::FreeTypeUnInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::config::FontFolder(const etk::UString& _folder)
|
|
||||||
{
|
|
||||||
l_fontConfigFolder = _folder;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::config::FontSetDefault(const etk::UString& _fontName, int32_t _size)
|
|
||||||
{
|
|
||||||
l_fontConfigName = _fontName;
|
|
||||||
l_fontConfigSize = _size;
|
|
||||||
}
|
|
||||||
|
|
||||||
const etk::UString& ewol::config::FontGetDefaultName(void)
|
|
||||||
{
|
|
||||||
return l_fontConfigName;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ewol::config::FontGetDefaultSize(void)
|
|
||||||
{
|
|
||||||
return l_fontConfigSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __EWOL_CONFIG_H__
|
|
||||||
#define __EWOL_CONFIG_H__
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <etk/UString.h>
|
|
||||||
|
|
||||||
namespace ewol
|
|
||||||
{
|
|
||||||
namespace config
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @brief Specify the default font folder for the Ewol search system (only needed when embended font)
|
|
||||||
* @param[in] _folder basic folder of the font (ex: DATA:fonts)
|
|
||||||
*/
|
|
||||||
void FontFolder(const etk::UString& _folder);
|
|
||||||
/**
|
|
||||||
* @brief Set the defaut font for all the widgets and basics display.
|
|
||||||
* @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
|
|
||||||
* @param[in] _size The default size of the font default=10.
|
|
||||||
*/
|
|
||||||
void FontSetDefault(const etk::UString& _fontName, int32_t _size);
|
|
||||||
/**
|
|
||||||
* @brief Get the current default font name
|
|
||||||
* @raturn a reference on the font name string
|
|
||||||
*/
|
|
||||||
const etk::UString& FontGetDefaultName(void);
|
|
||||||
/**
|
|
||||||
* @brief Get the default font size.
|
|
||||||
* @return the font size.
|
|
||||||
*/
|
|
||||||
int32_t FontGetDefaultSize(void);
|
|
||||||
|
|
||||||
|
|
||||||
// Internal section :
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Init the configuration
|
|
||||||
*/
|
|
||||||
void Init(void);
|
|
||||||
/**
|
|
||||||
* UnInit the configuration
|
|
||||||
*/
|
|
||||||
void UnInit(void);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -8,23 +8,16 @@
|
|||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
#include <ewol/renderer/resources/TexturedFont.h>
|
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
#include <ewol/commandLine.h>
|
#include <ewol/commandLine.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
#include <ewol/Dimension.h>
|
#include <ewol/Dimension.h>
|
||||||
#include <date/date.h>
|
#include <date/date.h>
|
||||||
#include <ewol/UserConfig.h>
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol"
|
#define __class__ "ewol"
|
||||||
/*
|
|
||||||
void ewol::SetFontSourcesFolder(bool _inOsSystem)
|
|
||||||
{
|
|
||||||
ewol::font::SetFontPropety(_inOsSystem);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
int32_t ewol::Run(int32_t _argc, const char* _argv[])
|
int32_t ewol::Run(int32_t _argc, const char* _argv[])
|
||||||
{
|
{
|
||||||
if (NULL!=_argv) {
|
if (NULL!=_argv) {
|
||||||
@ -32,7 +25,6 @@ int32_t ewol::Run(int32_t _argc, const char* _argv[])
|
|||||||
}
|
}
|
||||||
// init display convertions:
|
// init display convertions:
|
||||||
ewol::dimension::Init();
|
ewol::dimension::Init();
|
||||||
ewol::userConfig::Init();
|
|
||||||
|
|
||||||
EWOL_DEBUG("Store commangLine in the specific system");
|
EWOL_DEBUG("Store commangLine in the specific system");
|
||||||
ewol::commandLine::Clean();
|
ewol::commandLine::Clean();
|
||||||
|
36
sources/ewol/renderer/ConfigFont.cpp
Normal file
36
sources/ewol/renderer/ConfigFont.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/renderer/ConfigFont.h>
|
||||||
|
#include <ewol/renderer/resources/FontFreeType.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "ConfigFont"
|
||||||
|
|
||||||
|
ewol::ConfigFont::ConfigFont(void) :
|
||||||
|
m_folder("DATA::fonts"),
|
||||||
|
m_name("Arial;Helvetica"),
|
||||||
|
m_size(10),
|
||||||
|
m_useExternal(false)
|
||||||
|
{
|
||||||
|
ewol::FreeTypeInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
ewol::ConfigFont::~ConfigFont(void)
|
||||||
|
{
|
||||||
|
// UnInit FreeTypes
|
||||||
|
ewol::FreeTypeUnInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::ConfigFont::Set(const etk::UString& _fontName, int32_t _size)
|
||||||
|
{
|
||||||
|
m_name = _fontName;
|
||||||
|
m_size = _size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
75
sources/ewol/renderer/ConfigFont.h
Normal file
75
sources/ewol/renderer/ConfigFont.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_CONFIG_FONT_H__
|
||||||
|
#define __EWOL_CONFIG_FONT_H__
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <etk/UString.h>
|
||||||
|
|
||||||
|
namespace ewol
|
||||||
|
{
|
||||||
|
class ConfigFont
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor / destructor
|
||||||
|
*/
|
||||||
|
ConfigFont(void);
|
||||||
|
~ConfigFont(void);
|
||||||
|
private:
|
||||||
|
etk::UString m_folder;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Specify the default font folder for the Ewol search system (only needed when embended font)
|
||||||
|
* @param[in] _folder basic folder of the font (ex: DATA:fonts)
|
||||||
|
*/
|
||||||
|
void SetFolder(const etk::UString& _folder) { m_folder = _folder; };
|
||||||
|
/**
|
||||||
|
* @brief Get the default font folder.
|
||||||
|
* @return The default font folder.
|
||||||
|
*/
|
||||||
|
const etk::UString& GetFolder(void) { return m_folder; };
|
||||||
|
private:
|
||||||
|
etk::UString m_name;
|
||||||
|
int32_t m_size;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set the defaut font for all the widgets and basics display.
|
||||||
|
* @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
|
||||||
|
* @param[in] _size The default size of the font default=10.
|
||||||
|
*/
|
||||||
|
void Set(const etk::UString& _fontName, int32_t _size);
|
||||||
|
/**
|
||||||
|
* @brief Get the current default font name
|
||||||
|
* @raturn a reference on the font name string
|
||||||
|
*/
|
||||||
|
const etk::UString& GetName(void) { return m_name; };
|
||||||
|
/**
|
||||||
|
* @brief Get the default font size.
|
||||||
|
* @return the font size.
|
||||||
|
*/
|
||||||
|
int32_t GetSize(void) { return m_size; };
|
||||||
|
private:
|
||||||
|
bool m_useExternal;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Set use of internal/external Font
|
||||||
|
* @param[in] _val true to enable search of internal data.
|
||||||
|
*/
|
||||||
|
void SetUseExternal(bool _val) { m_useExternal=_val; };
|
||||||
|
/**
|
||||||
|
* @brief Get the use of internal/external Font
|
||||||
|
* @return true to enable search of internal data.
|
||||||
|
*/
|
||||||
|
bool GetUseExternal(void) { return m_useExternal; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -6,7 +6,7 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "EConfig"
|
#define __class__ "EConfig"
|
@ -6,7 +6,7 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "EMessage"
|
#define __class__ "EMessage"
|
@ -6,11 +6,11 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
#include <ewol/eObject/EObjectMessageMultiCast.h>
|
#include <ewol/renderer/EObjectMessageMultiCast.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::EObject"
|
#define __class__ "ewol::EObject"
|
@ -21,8 +21,8 @@ namespace ewol {
|
|||||||
class eSystem;
|
class eSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <ewol/eObject/EConfig.h>
|
#include <ewol/renderer/EConfig.h>
|
||||||
#include <ewol/eObject/EMessage.h>
|
#include <ewol/renderer/EMessage.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
|
@ -6,8 +6,8 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
@ -10,7 +10,7 @@
|
|||||||
#define __EWOL_E_OBJECT_MANAGER_H__
|
#define __EWOL_E_OBJECT_MANAGER_H__
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
|
||||||
namespace ewol
|
namespace ewol
|
||||||
{
|
{
|
@ -7,8 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/eObject/EObjectMessageMultiCast.h>
|
#include <ewol/renderer/EObjectMessageMultiCast.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "EObjectMessageMultiCast"
|
#define __class__ "EObjectMessageMultiCast"
|
@ -14,7 +14,7 @@
|
|||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
#include <exml/exml.h>
|
#include <exml/exml.h>
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class EObjectMessageMultiCast
|
class EObjectMessageMultiCast
|
@ -45,7 +45,7 @@ ewol::Material::Material(void) :
|
|||||||
ewol::Material::~Material(void)
|
ewol::Material::~Material(void)
|
||||||
{
|
{
|
||||||
if(NULL!=m_texture0) {
|
if(NULL!=m_texture0) {
|
||||||
ewol::resource::Release(m_texture0);
|
ewol::ResourceManager::Release(m_texture0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename)
|
|||||||
// prevent overloard error :
|
// prevent overloard error :
|
||||||
ewol::TextureFile* tmpCopy = m_texture0;
|
ewol::TextureFile* tmpCopy = m_texture0;
|
||||||
m_texture0 = NULL;
|
m_texture0 = NULL;
|
||||||
if (false == ewol::resource::Keep(_filename, m_texture0, tmpSize)) {
|
if (false == ewol::ResourceManager::Keep(_filename, m_texture0, tmpSize)) {
|
||||||
EWOL_ERROR("Can not load specific texture : " << _filename);
|
EWOL_ERROR("Can not load specific texture : " << _filename);
|
||||||
// retreave previous texture:
|
// retreave previous texture:
|
||||||
m_texture0 = tmpCopy;
|
m_texture0 = tmpCopy;
|
||||||
@ -74,7 +74,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename)
|
|||||||
}
|
}
|
||||||
if (NULL != tmpCopy) {
|
if (NULL != tmpCopy) {
|
||||||
// really release previous texture. In case of same texture loading, then we did not have reload it .. just increase and decrease index...
|
// really release previous texture. In case of same texture loading, then we did not have reload it .. just increase and decrease index...
|
||||||
ewol::resource::Release(tmpCopy);
|
ewol::ResourceManager::Release(tmpCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,72 +12,64 @@
|
|||||||
#include <ewol/renderer/resources/FontFreeType.h>
|
#include <ewol/renderer/resources/FontFreeType.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
|
|
||||||
// Specific for the resource :
|
// Specific for the resource :
|
||||||
uint32_t ewol::Resource::valBase=0;
|
uint32_t ewol::Resource::valBase=0;
|
||||||
|
|
||||||
|
|
||||||
static etk::Vector<ewol::Resource*> l_resourceList;
|
|
||||||
static etk::Vector<ewol::Resource*> l_resourceListToUpdate;
|
|
||||||
static bool l_contextHasBeenRemoved = true;
|
|
||||||
|
|
||||||
void ewol::resource::Init(void)
|
ewol::ResourceManager::ResourceManager(void) :
|
||||||
|
m_contextHasBeenRemoved(true)
|
||||||
{
|
{
|
||||||
// nothing to do in theory then, we clean the buffers :
|
// nothing to do ...
|
||||||
// NOTE : If we do domething here, then the system does not work corectly
|
|
||||||
if (l_resourceList.Size() != 0) {
|
|
||||||
EWOL_CRITICAL("Start with a resource manager Not empty, number of resources loaded : " << l_resourceList.Size());
|
|
||||||
}
|
|
||||||
l_resourceListToUpdate.Clear();
|
|
||||||
l_resourceList.Clear();
|
|
||||||
l_contextHasBeenRemoved = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::UnInit(void)
|
ewol::ResourceManager::~ResourceManager(void)
|
||||||
{
|
{
|
||||||
Display();
|
Display();
|
||||||
l_resourceListToUpdate.Clear();
|
m_resourceListToUpdate.Clear();
|
||||||
// remove all resources ...
|
// remove all resources ...
|
||||||
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
|
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
|
||||||
if (l_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
EWOL_WARNING("Find a resource that is not removed : [" << l_resourceList[iii]->GetUID() << "]"
|
EWOL_WARNING("Find a resource that is not removed : [" << m_resourceList[iii]->GetUID() << "]"
|
||||||
<< "=\"" << l_resourceList[iii]->GetName() << "\" "
|
<< "=\"" << m_resourceList[iii]->GetName() << "\" "
|
||||||
<< l_resourceList[iii]->GetCounter() << " elements");
|
<< m_resourceList[iii]->GetCounter() << " elements");
|
||||||
delete(l_resourceList[iii]);
|
delete(m_resourceList[iii]);
|
||||||
l_resourceList[iii] = NULL;
|
m_resourceList[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l_resourceList.Clear();
|
m_resourceList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Display(void)
|
void ewol::ResourceManager::Display(void)
|
||||||
{
|
{
|
||||||
EWOL_INFO("Resources loaded : ");
|
EWOL_INFO("Resources loaded : ");
|
||||||
// remove all resources ...
|
// remove all resources ...
|
||||||
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
|
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
|
||||||
if (l_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
EWOL_INFO(" [" << l_resourceList[iii]->GetUID() << "]"
|
EWOL_INFO(" [" << m_resourceList[iii]->GetUID() << "]"
|
||||||
<< l_resourceList[iii]->GetType()
|
<< m_resourceList[iii]->GetType()
|
||||||
<< "=\"" << l_resourceList[iii]->GetName() << "\" "
|
<< "=\"" << m_resourceList[iii]->GetName() << "\" "
|
||||||
<< l_resourceList[iii]->GetCounter() << " elements");
|
<< m_resourceList[iii]->GetCounter() << " elements");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_INFO("Resources ---");
|
EWOL_INFO("Resources ---");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::ReLoadResources(void)
|
void ewol::ResourceManager::ReLoadResources(void)
|
||||||
{
|
{
|
||||||
EWOL_INFO("------------- Resources re-loaded -------------");
|
EWOL_INFO("------------- Resources re-loaded -------------");
|
||||||
// remove all resources ...
|
// remove all resources ...
|
||||||
if (l_resourceList.Size() != 0) {
|
if (m_resourceList.Size() != 0) {
|
||||||
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
|
||||||
EWOL_INFO(" Reload level : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
|
EWOL_INFO(" Reload level : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
|
||||||
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
|
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
|
||||||
if(l_resourceList[iii] != NULL) {
|
if(m_resourceList[iii] != NULL) {
|
||||||
if (jjj==l_resourceList[iii]->GetResourceLevel()) {
|
if (jjj==m_resourceList[iii]->GetResourceLevel()) {
|
||||||
l_resourceList[iii]->Reload();
|
m_resourceList[iii]->Reload();
|
||||||
EWOL_INFO(" [" << l_resourceList[iii]->GetUID() << "]="<< l_resourceList[iii]->GetType());
|
EWOL_INFO(" [" << m_resourceList[iii]->GetUID() << "]="<< m_resourceList[iii]->GetType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,48 +80,48 @@ void ewol::resource::ReLoadResources(void)
|
|||||||
EWOL_INFO("------------- Resources -------------");
|
EWOL_INFO("------------- Resources -------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Update(ewol::Resource* object)
|
void ewol::ResourceManager::Update(ewol::Resource* object)
|
||||||
{
|
{
|
||||||
// chek if not added before
|
// chek if not added before
|
||||||
for (int32_t iii=0; iii<l_resourceListToUpdate.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceListToUpdate.Size(); iii++) {
|
||||||
if (l_resourceListToUpdate[iii] != NULL) {
|
if (m_resourceListToUpdate[iii] != NULL) {
|
||||||
if (l_resourceListToUpdate[iii] == object) {
|
if (m_resourceListToUpdate[iii] == object) {
|
||||||
// just prevent some double add ...
|
// just prevent some double add ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add it ...
|
// add it ...
|
||||||
l_resourceListToUpdate.PushBack(object);
|
m_resourceListToUpdate.PushBack(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specific to load or update the data in the openGl context ==> system use only
|
// Specific to load or update the data in the openGl context ==> system use only
|
||||||
void ewol::resource::UpdateContext(void)
|
void ewol::ResourceManager::UpdateContext(void)
|
||||||
{
|
{
|
||||||
if (true == l_contextHasBeenRemoved) {
|
if (true == m_contextHasBeenRemoved) {
|
||||||
// need to update all ...
|
// need to update all ...
|
||||||
l_contextHasBeenRemoved = false;
|
m_contextHasBeenRemoved = false;
|
||||||
if (l_resourceList.Size() != 0) {
|
if (m_resourceList.Size() != 0) {
|
||||||
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
|
||||||
EWOL_INFO(" UpdateContext level (D) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
|
EWOL_INFO(" UpdateContext level (D) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
|
||||||
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
|
||||||
if(l_resourceList[iii] != NULL) {
|
if(m_resourceList[iii] != NULL) {
|
||||||
if (jjj==l_resourceList[iii]->GetResourceLevel()) {
|
if (jjj==m_resourceList[iii]->GetResourceLevel()) {
|
||||||
//EWOL_DEBUG("Update context of " << iii << " named : " << l_resourceList[iii]->GetName());
|
//EWOL_DEBUG("Update context of " << iii << " named : " << l_resourceList[iii]->GetName());
|
||||||
l_resourceList[iii]->UpdateContext();
|
m_resourceList[iii]->UpdateContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if (l_resourceListToUpdate.Size() != 0) {
|
if (m_resourceListToUpdate.Size() != 0) {
|
||||||
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
|
for (int32_t jjj=0; jjj<MAX_RESOURCE_LEVEL; jjj++) {
|
||||||
EWOL_INFO(" UpdateContext level (U) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
|
EWOL_INFO(" UpdateContext level (U) : " << jjj << "/" << (MAX_RESOURCE_LEVEL-1));
|
||||||
for (int32_t iii=0; iii<l_resourceListToUpdate.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceListToUpdate.Size(); iii++) {
|
||||||
if(l_resourceListToUpdate[iii] != NULL) {
|
if(m_resourceListToUpdate[iii] != NULL) {
|
||||||
if (jjj==l_resourceListToUpdate[iii]->GetResourceLevel()) {
|
if (jjj==m_resourceListToUpdate[iii]->GetResourceLevel()) {
|
||||||
l_resourceListToUpdate[iii]->UpdateContext();
|
m_resourceListToUpdate[iii]->UpdateContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,20 +129,19 @@ void ewol::resource::UpdateContext(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clean the update list
|
// Clean the update list
|
||||||
l_resourceListToUpdate.Clear();
|
m_resourceListToUpdate.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// in this case, it is really too late ...
|
// in this case, it is really too late ...
|
||||||
void ewol::resource::ContextHasBeenDestroyed(void)
|
void ewol::ResourceManager::ContextHasBeenDestroyed(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
|
||||||
if (l_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
l_resourceList[iii]->RemoveContextToLate();
|
m_resourceList[iii]->RemoveContextToLate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ewol::openGL::ContextIsRemoved();
|
|
||||||
// no context preent ...
|
// no context preent ...
|
||||||
l_contextHasBeenRemoved = true;
|
m_contextHasBeenRemoved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,14 +149,14 @@ void ewol::resource::ContextHasBeenDestroyed(void)
|
|||||||
|
|
||||||
|
|
||||||
// internal generic keeper ...
|
// internal generic keeper ...
|
||||||
ewol::Resource* ewol::resource::LocalKeep(const etk::UString& filename)
|
ewol::Resource* ewol::ResourceManager::LocalKeep(const etk::UString& filename)
|
||||||
{
|
{
|
||||||
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << filename << "\"");
|
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << filename << "\"");
|
||||||
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
|
||||||
if (l_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
if(l_resourceList[iii]->HasName(filename)) {
|
if(m_resourceList[iii]->HasName(filename)) {
|
||||||
l_resourceList[iii]->Increment();
|
m_resourceList[iii]->Increment();
|
||||||
return l_resourceList[iii];
|
return m_resourceList[iii];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,24 +165,24 @@ ewol::Resource* ewol::resource::LocalKeep(const etk::UString& filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// internal generic keeper ...
|
// internal generic keeper ...
|
||||||
void ewol::resource::LocalAdd(ewol::Resource* object)
|
void ewol::ResourceManager::LocalAdd(ewol::Resource* object)
|
||||||
{
|
{
|
||||||
//Add ... find empty slot
|
//Add ... find empty slot
|
||||||
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceList.Size(); iii++) {
|
||||||
if (l_resourceList[iii] == NULL) {
|
if (m_resourceList[iii] == NULL) {
|
||||||
l_resourceList[iii] = object;
|
m_resourceList[iii] = object;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add at the end if no slot is free
|
// add at the end if no slot is free
|
||||||
l_resourceList.PushBack(object);
|
m_resourceList.PushBack(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the type of the resource ...
|
// return the type of the resource ...
|
||||||
bool ewol::resource::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
|
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
|
||||||
{
|
{
|
||||||
EWOL_VERBOSE("KEEP : TexturedFont : file : \"" << filename << "\"");
|
EWOL_VERBOSE("KEEP : TexturedFont : file : \"" << filename << "\"");
|
||||||
object = static_cast<ewol::TexturedFont*>(LocalKeep(filename));
|
object = static_cast<ewol::TexturedFont*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -201,15 +192,15 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::TexturedFont*& obj
|
|||||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object)
|
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::FontBase*& object)
|
||||||
{
|
{
|
||||||
EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\"");
|
EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\"");
|
||||||
object = static_cast<ewol::FontBase*>(LocalKeep(filename));
|
object = static_cast<ewol::FontBase*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -219,14 +210,14 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object)
|
|||||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object)
|
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Program*& object)
|
||||||
{
|
{
|
||||||
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
|
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
|
||||||
object = static_cast<ewol::Program*>(LocalKeep(filename));
|
object = static_cast<ewol::Program*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -236,14 +227,14 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object)
|
|||||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object)
|
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Shader*& object)
|
||||||
{
|
{
|
||||||
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << filename << "\"");
|
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << filename << "\"");
|
||||||
object = static_cast<ewol::Shader*>(LocalKeep(filename));
|
object = static_cast<ewol::Shader*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -253,11 +244,11 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object)
|
|||||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::resource::Keep(ewol::Texture*& object)
|
bool ewol::ResourceManager::Keep(ewol::Texture*& object)
|
||||||
{
|
{
|
||||||
// this element create a new one every time ....
|
// this element create a new one every time ....
|
||||||
object = new ewol::Texture("");
|
object = new ewol::Texture("");
|
||||||
@ -265,15 +256,15 @@ bool ewol::resource::Keep(ewol::Texture*& object)
|
|||||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::resource::Keep(ewol::Colored3DObject*& _object)
|
bool ewol::ResourceManager::Keep(ewol::Colored3DObject*& _object)
|
||||||
{
|
{
|
||||||
EWOL_VERBOSE("KEEP : direct Colored3DObject");
|
EWOL_VERBOSE("KEEP : direct Colored3DObject");
|
||||||
etk::UString filename = "?metaObject?Colored3DObject";
|
etk::UString filename = "?metaObject?Colored3DObject";
|
||||||
_object = static_cast<ewol::Colored3DObject*>(LocalKeep(filename));
|
_object = static_cast<ewol::Colored3DObject*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
|
||||||
if (NULL != _object) {
|
if (NULL != _object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -283,7 +274,7 @@ bool ewol::resource::Keep(ewol::Colored3DObject*& _object)
|
|||||||
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
|
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(_object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
@ -306,7 +297,7 @@ static int32_t nextP2(int32_t _value)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
|
bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
|
||||||
{
|
{
|
||||||
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
|
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
|
||||||
if (_filename == "") {
|
if (_filename == "") {
|
||||||
@ -315,7 +306,7 @@ bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _ob
|
|||||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(_object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_size.x()==0) {
|
if (_size.x()==0) {
|
||||||
@ -346,7 +337,7 @@ bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
|
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
|
||||||
_object = static_cast<ewol::TextureFile*>(LocalKeep(TmpFilename));
|
_object = static_cast<ewol::TextureFile*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(TmpFilename));
|
||||||
if (NULL != _object) {
|
if (NULL != _object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -357,14 +348,14 @@ bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _ob
|
|||||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(_object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
|
bool ewol::ResourceManager::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
|
||||||
{
|
{
|
||||||
_object = static_cast<ewol::Mesh*>(LocalKeep(_meshName));
|
_object = static_cast<ewol::Mesh*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(_meshName));
|
||||||
if (NULL != _object) {
|
if (NULL != _object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -373,12 +364,12 @@ bool ewol::resource::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
|
|||||||
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
|
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(_object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object)
|
bool ewol::ResourceManager::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object)
|
||||||
{
|
{
|
||||||
// this element create a new one every time ....
|
// this element create a new one every time ....
|
||||||
_object = new ewol::VirtualBufferObject(_accesMode);
|
_object = new ewol::VirtualBufferObject(_accesMode);
|
||||||
@ -386,14 +377,14 @@ bool ewol::resource::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObj
|
|||||||
EWOL_ERROR("allocation error of a resource : ??VBO??");
|
EWOL_ERROR("allocation error of a resource : ??VBO??");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(_object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
|
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
|
||||||
{
|
{
|
||||||
EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\"");
|
EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\"");
|
||||||
object = static_cast<ewol::ConfigFile*>(LocalKeep(filename));
|
object = static_cast<ewol::ConfigFile*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
|
||||||
if (NULL != object) {
|
if (NULL != object) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -403,33 +394,33 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& objec
|
|||||||
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
|
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LocalAdd(object);
|
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::resource::Release(ewol::Resource*& object)
|
void ewol::ResourceManager::Release(ewol::Resource*& object)
|
||||||
{
|
{
|
||||||
if (NULL == object) {
|
if (NULL == object) {
|
||||||
EWOL_ERROR("Try to remove a resource that have null pointer ...");
|
EWOL_ERROR("Try to remove a resource that have null pointer ...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<l_resourceListToUpdate.Size(); iii++) {
|
for (int32_t iii=0; iii<m_resourceListToUpdate.Size(); iii++) {
|
||||||
if (l_resourceListToUpdate[iii] == object) {
|
if (m_resourceListToUpdate[iii] == object) {
|
||||||
l_resourceListToUpdate[iii] = NULL;
|
m_resourceListToUpdate[iii] = NULL;
|
||||||
//l_resourceListToUpdate.Erase(iii);
|
//l_resourceListToUpdate.Erase(iii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_VERBOSE("RELEASE (default) : file : \"" << object->GetName() << "\"");
|
EWOL_VERBOSE("RELEASE (default) : file : \"" << object->GetName() << "\"");
|
||||||
for (int32_t iii=l_resourceList.Size()-1; iii>=0; iii--) {
|
for (int32_t iii=m_resourceList.Size()-1; iii>=0; iii--) {
|
||||||
if (l_resourceList[iii] != NULL) {
|
if (m_resourceList[iii] != NULL) {
|
||||||
if(l_resourceList[iii] == object) {
|
if(m_resourceList[iii] == object) {
|
||||||
if (true == l_resourceList[iii]->Decrement()) {
|
if (true == m_resourceList[iii]->Decrement()) {
|
||||||
// delete element
|
// delete element
|
||||||
delete(l_resourceList[iii]);
|
delete(m_resourceList[iii]);
|
||||||
// remove element from the list :
|
// remove element from the list :
|
||||||
l_resourceList[iii] = NULL;
|
m_resourceList[iii] = NULL;
|
||||||
}
|
}
|
||||||
// insidiously remove the pointer for the caller ...
|
// insidiously remove the pointer for the caller ...
|
||||||
object = NULL;
|
object = NULL;
|
||||||
@ -443,68 +434,68 @@ void ewol::resource::Release(ewol::Resource*& object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::resource::Release(ewol::TexturedFont*& object)
|
void ewol::ResourceManager::Release(ewol::TexturedFont*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
void ewol::resource::Release(ewol::FontBase*& object)
|
void ewol::ResourceManager::Release(ewol::FontBase*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
void ewol::resource::Release(ewol::Program*& object)
|
void ewol::ResourceManager::Release(ewol::Program*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
void ewol::resource::Release(ewol::Shader*& object)
|
void ewol::ResourceManager::Release(ewol::Shader*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
void ewol::resource::Release(ewol::Texture*& object)
|
void ewol::ResourceManager::Release(ewol::Texture*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
void ewol::resource::Release(ewol::TextureFile*& object)
|
void ewol::ResourceManager::Release(ewol::TextureFile*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
//EWOL_INFO("RELEASE : TextureFile : nb=" << object2->GetCounter());
|
//EWOL_INFO("RELEASE : TextureFile : nb=" << object2->GetCounter());
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Release(ewol::Mesh*& object)
|
void ewol::ResourceManager::Release(ewol::Mesh*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Release(ewol::ConfigFile*& object)
|
void ewol::ResourceManager::Release(ewol::ConfigFile*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Release(ewol::Colored3DObject*& object)
|
void ewol::ResourceManager::Release(ewol::Colored3DObject*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::resource::Release(ewol::VirtualBufferObject*& object)
|
void ewol::ResourceManager::Release(ewol::VirtualBufferObject*& object)
|
||||||
{
|
{
|
||||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||||
Release(object2);
|
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
|
@ -24,96 +24,102 @@
|
|||||||
|
|
||||||
namespace ewol
|
namespace ewol
|
||||||
{
|
{
|
||||||
namespace resource {
|
class ResourceManager
|
||||||
/**
|
{
|
||||||
* @brief Initialize the internal variable
|
private:
|
||||||
*/
|
etk::Vector<ewol::Resource*> m_resourceList;
|
||||||
void Init(void);
|
etk::Vector<ewol::Resource*> m_resourceListToUpdate;
|
||||||
/**
|
bool m_contextHasBeenRemoved;
|
||||||
* @brief Uninitiamize the resource manager, free all resources previously requested
|
public:
|
||||||
* @note when not free ==> generate warning, because the segfault can appear after...
|
/**
|
||||||
*/
|
* @brief Initialize the internal variable
|
||||||
void UnInit(void);
|
*/
|
||||||
/**
|
ResourceManager(void);
|
||||||
* @brief Display in the log all the resources loaded ...
|
/**
|
||||||
*/
|
* @brief Uninitiamize the resource manager, free all resources previously requested
|
||||||
void Display(void);
|
* @note when not free ==> generate warning, because the segfault can appear after...
|
||||||
/**
|
*/
|
||||||
* @brief Reload all resources from files, and send there in openGL card if needed.
|
~ResourceManager(void);
|
||||||
* @note If File is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
|
/**
|
||||||
*/
|
* @brief Display in the log all the resources loaded ...
|
||||||
void ReLoadResources(void);
|
*/
|
||||||
/**
|
void Display(void);
|
||||||
* @brief Call by the system to send all the needed data on the graphic card chen they change ...
|
/**
|
||||||
* @param[in] object The resources that might be updated
|
* @brief Reload all resources from files, and send there in openGL card if needed.
|
||||||
*/
|
* @note If File is reference at THEME:XXX:filename if the Theme change the file will reload the newOne
|
||||||
void Update(ewol::Resource* object);
|
*/
|
||||||
/**
|
void ReLoadResources(void);
|
||||||
* @brief Call by the system chen the openGL Context has been unexpectially removed ==> This reload all the texture, VBO and other ....
|
/**
|
||||||
*/
|
* @brief Call by the system to send all the needed data on the graphic card chen they change ...
|
||||||
void UpdateContext(void);
|
* @param[in] object The resources that might be updated
|
||||||
/**
|
*/
|
||||||
* @brief This is to inform the resources manager that we have no more openGl context ...
|
void Update(ewol::Resource* object);
|
||||||
*/
|
/**
|
||||||
void ContextHasBeenDestroyed(void);
|
* @brief Call by the system chen the openGL Context has been unexpectially removed ==> This reload all the texture, VBO and other ....
|
||||||
|
*/
|
||||||
// internal API to extent eResources in extern Soft
|
void UpdateContext(void);
|
||||||
ewol::Resource* LocalKeep(const etk::UString& filename);
|
/**
|
||||||
void LocalAdd(ewol::Resource* object);
|
* @brief This is to inform the resources manager that we have no more openGl context ...
|
||||||
|
*/
|
||||||
/**
|
void ContextHasBeenDestroyed(void);
|
||||||
* @brief Load the specify resources type
|
private:
|
||||||
* @param[in] filename The filename of the resources
|
// internal API to extent eResources in extern Soft
|
||||||
* @param[in,out] object The resources that might be instanciate.
|
ewol::Resource* LocalKeep(const etk::UString& filename);
|
||||||
* @return true if the resource has been loaded corectly.
|
void LocalAdd(ewol::Resource* object);
|
||||||
* @return false An error occured ...
|
public:
|
||||||
* @note when you call the Keep function, you must call the Realease function ==> otherwise the resources will never be freed
|
/**
|
||||||
* @note The resources with the same name are loaded only one time, a counter prevent multiple loading...
|
* @brief Load the specify resources type
|
||||||
*/
|
* @param[in] filename The filename of the resources
|
||||||
bool Keep(const etk::UString& filename, ewol::TexturedFont*& object);
|
* @param[in,out] object The resources that might be instanciate.
|
||||||
bool Keep(const etk::UString& filename, ewol::FontBase*& object);
|
* @return true if the resource has been loaded corectly.
|
||||||
bool Keep(const etk::UString& filename, ewol::Program*& object);
|
* @return false An error occured ...
|
||||||
bool Keep(const etk::UString& filename, ewol::Shader*& object);
|
* @note when you call the Keep function, you must call the Realease function ==> otherwise the resources will never be freed
|
||||||
bool Keep(ewol::Texture*& object); // no name needed here ...
|
* @note The resources with the same name are loaded only one time, a counter prevent multiple loading...
|
||||||
bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size=ivec2(-1,-1));
|
*/
|
||||||
bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object);
|
static bool Keep(const etk::UString& filename, ewol::TexturedFont*& object);
|
||||||
bool Keep(const etk::UString& meshName, ewol::Mesh*& object);
|
static bool Keep(const etk::UString& filename, ewol::FontBase*& object);
|
||||||
bool Keep(const etk::UString& filename, ewol::ConfigFile*& object);
|
static bool Keep(const etk::UString& filename, ewol::Program*& object);
|
||||||
bool Keep(ewol::Colored3DObject*& object);
|
static bool Keep(const etk::UString& filename, ewol::Shader*& object);
|
||||||
|
static bool Keep(ewol::Texture*& object); // no name needed here ...
|
||||||
// must became :
|
static bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size=ivec2(-1,-1));
|
||||||
/*
|
static bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object);
|
||||||
ewol::Font* KeepFont(const etk::UString& _filename);
|
static bool Keep(const etk::UString& meshName, ewol::Mesh*& object);
|
||||||
ewol::Program* KeepProgram(const etk::UString& _filename);
|
static bool Keep(const etk::UString& filename, ewol::ConfigFile*& object);
|
||||||
ewol::Shader* KeepShader(const etk::UString& _filename);
|
static bool Keep(ewol::Colored3DObject*& object);
|
||||||
ewol::Texture* KeepTexture(void);
|
|
||||||
ewol::Texture* KeepTexture(const etk::UString& _filename, const ivec2& size=ivec2(-1,-1));
|
// must became :
|
||||||
void AddTextureResourceCreator(pf* _plop, const etk::UString& _ext);
|
/*
|
||||||
ewol::Audio* KeepAudio(const etk::UString& _filename, bool _inRam=false);
|
ewol::Font* KeepFont(const etk::UString& _filename);
|
||||||
void AddAudioResourceCreator(pf* _plop, const etk::UString& _ext);
|
ewol::Program* KeepProgram(const etk::UString& _filename);
|
||||||
ewol::VirtualBufferObject* KeepVBO(const etk::UString& _accesMode);
|
ewol::Shader* KeepShader(const etk::UString& _filename);
|
||||||
ewol::Mesh* KeepMesh(const etk::UString& _filename);
|
ewol::Texture* KeepTexture(void);
|
||||||
ewol::ConfigFile* KeepConfigFile(const etk::UString& _filename);
|
ewol::Texture* KeepTexture(const etk::UString& _filename, const ivec2& size=ivec2(-1,-1));
|
||||||
ewol::Colored3DObject* Keep3DObject(void);
|
void AddTextureResourceCreator(pf* _plop, const etk::UString& _ext);
|
||||||
|
ewol::Audio* KeepAudio(const etk::UString& _filename, bool _inRam=false);
|
||||||
void Release(ewol::Resource*& object);
|
void AddAudioResourceCreator(pf* _plop, const etk::UString& _ext);
|
||||||
*/
|
ewol::VirtualBufferObject* KeepVBO(const etk::UString& _accesMode);
|
||||||
/**
|
ewol::Mesh* KeepMesh(const etk::UString& _filename);
|
||||||
* @brief Release a resources and free it if the Last release is call.
|
ewol::ConfigFile* KeepConfigFile(const etk::UString& _filename);
|
||||||
* @param[in,out] object element to realease ==> is return at NULL value.
|
ewol::Colored3DObject* Keep3DObject(void);
|
||||||
*/
|
|
||||||
void Release(ewol::Resource*& object);
|
void Release(ewol::Resource*& object);
|
||||||
void Release(ewol::TexturedFont*& object);
|
*/
|
||||||
void Release(ewol::FontBase*& object);
|
/**
|
||||||
void Release(ewol::Program*& object);
|
* @brief Release a resources and free it if the Last release is call.
|
||||||
void Release(ewol::Shader*& object);
|
* @param[in,out] object element to realease ==> is return at NULL value.
|
||||||
void Release(ewol::Texture*& object);
|
*/
|
||||||
void Release(ewol::TextureFile*& object);
|
void Release(ewol::Resource*& object);
|
||||||
void Release(ewol::VirtualBufferObject*& object);
|
static void Release(ewol::TexturedFont*& object);
|
||||||
void Release(ewol::Mesh*& object);
|
static void Release(ewol::FontBase*& object);
|
||||||
void Release(ewol::ConfigFile*& object);
|
static void Release(ewol::Program*& object);
|
||||||
void Release(ewol::Colored3DObject*& object);
|
static void Release(ewol::Shader*& object);
|
||||||
}
|
static void Release(ewol::Texture*& object);
|
||||||
|
static void Release(ewol::TextureFile*& object);
|
||||||
|
static void Release(ewol::VirtualBufferObject*& object);
|
||||||
|
static void Release(ewol::Mesh*& object);
|
||||||
|
static void Release(ewol::ConfigFile*& object);
|
||||||
|
static void Release(ewol::Colored3DObject*& object);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,15 +14,12 @@
|
|||||||
#include <ewol/Dimension.h>
|
#include <ewol/Dimension.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
|
|
||||||
#include <ewol/config.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
|
||||||
|
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
#include <ewol/renderer/os/eSystemInput.h>
|
#include <ewol/renderer/eSystemInput.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
|
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
@ -43,16 +40,6 @@ static etk::Mutex& MutexInterface(void)
|
|||||||
return s_interfaceMutex;
|
return s_interfaceMutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the draw mutex (ewol render).
|
|
||||||
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
|
||||||
* @return the main inteface Mutex
|
|
||||||
*/
|
|
||||||
static etk::Mutex& MutexDraw(void)
|
|
||||||
{
|
|
||||||
static etk::Mutex s_drawMutex;
|
|
||||||
return s_drawMutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ewol::eSystem* l_curentInterface=NULL;
|
static ewol::eSystem* l_curentInterface=NULL;
|
||||||
ewol::eSystem& ewol::eSystem::GetSystem(void)
|
ewol::eSystem& ewol::eSystem::GetSystem(void)
|
||||||
@ -251,10 +238,6 @@ ewol::eSystem::eSystem(void) :
|
|||||||
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute());
|
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute());
|
||||||
// TODO : Remove this ...
|
// TODO : Remove this ...
|
||||||
etk::InitDefaultFolder("ewolApplNoName");
|
etk::InitDefaultFolder("ewolApplNoName");
|
||||||
// TODO : Remove all of this gloabals ...
|
|
||||||
ewol::openGL::Init();
|
|
||||||
ewol::resource::Init();
|
|
||||||
ewol::config::Init();
|
|
||||||
// request the init of the application in the main context of openGL ...
|
// request the init of the application in the main context of openGL ...
|
||||||
{
|
{
|
||||||
eSystemMessage data;
|
eSystemMessage data;
|
||||||
@ -282,11 +265,11 @@ ewol::eSystem::~eSystem(void)
|
|||||||
SetSystem();
|
SetSystem();
|
||||||
// call application to uninit
|
// call application to uninit
|
||||||
APP_UnInit(*this);
|
APP_UnInit(*this);
|
||||||
|
if (NULL!=m_windowsCurrent) {
|
||||||
|
EWOL_ERROR("Main windows has not been removed... ==> memory leek");
|
||||||
|
}
|
||||||
// unset all windows
|
// unset all windows
|
||||||
m_windowsCurrent = NULL;
|
m_windowsCurrent = NULL;
|
||||||
ewol::config::UnInit();
|
|
||||||
ewol::resource::UnInit();
|
|
||||||
ewol::openGL::UnInit();
|
|
||||||
m_msgSystem.Clean();
|
m_msgSystem.Clean();
|
||||||
// release the curent interface :
|
// release the curent interface :
|
||||||
ReleaseSystem();
|
ReleaseSystem();
|
||||||
@ -461,12 +444,12 @@ bool ewol::eSystem::OS_Draw(bool _displayEveryTime)
|
|||||||
//! Drawing section :
|
//! Drawing section :
|
||||||
{
|
{
|
||||||
// Lock OpenGl context:
|
// Lock OpenGl context:
|
||||||
MutexDraw().Lock();
|
ewol::openGL::Lock();
|
||||||
m_FpsSystemContext.Tic();
|
m_FpsSystemContext.Tic();
|
||||||
if (NULL != m_windowsCurrent) {
|
if (NULL != m_windowsCurrent) {
|
||||||
if( true == needRedraw
|
if( true == needRedraw
|
||||||
|| true == _displayEveryTime) {
|
|| true == _displayEveryTime) {
|
||||||
ewol::resource::UpdateContext();
|
m_resourceManager.UpdateContext();
|
||||||
m_FpsSystemContext.IncrementCounter();
|
m_FpsSystemContext.IncrementCounter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -488,7 +471,7 @@ bool ewol::eSystem::OS_Draw(bool _displayEveryTime)
|
|||||||
//glFinish();
|
//glFinish();
|
||||||
m_FpsFlush.Toc();
|
m_FpsFlush.Toc();
|
||||||
// Release Open GL Context
|
// Release Open GL Context
|
||||||
MutexDraw().UnLock();
|
ewol::openGL::UnLock();
|
||||||
}
|
}
|
||||||
m_FpsSystemEvent.Draw();
|
m_FpsSystemEvent.Draw();
|
||||||
m_FpsSystemContext.Draw();
|
m_FpsSystemContext.Draw();
|
||||||
@ -512,7 +495,7 @@ void ewol::eSystem::ResetIOEvent(void)
|
|||||||
|
|
||||||
void ewol::eSystem::OS_OpenGlContextDestroy(void)
|
void ewol::eSystem::OS_OpenGlContextDestroy(void)
|
||||||
{
|
{
|
||||||
ewol::resource::ContextHasBeenDestroyed();
|
m_resourceManager.ContextHasBeenDestroyed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,12 +14,14 @@
|
|||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/clipBoard.h>
|
#include <ewol/clipBoard.h>
|
||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
#include <ewol/renderer/os/eSystemInput.h>
|
#include <ewol/renderer/eSystemInput.h>
|
||||||
#include <ewol/renderer/os/Fps.h>
|
#include <ewol/renderer/os/Fps.h>
|
||||||
#include <etk/MessageFifo.h>
|
#include <etk/MessageFifo.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/renderer/ConfigFont.h>
|
||||||
#include <ewol/eObject/EObjectMessageMultiCast.h>
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
|
#include <ewol/renderer/EObjectMessageMultiCast.h>
|
||||||
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
|
|
||||||
|
|
||||||
// TODO : Remove this from here ...
|
// TODO : Remove this from here ...
|
||||||
@ -75,8 +77,13 @@ class eSystemMessage {
|
|||||||
|
|
||||||
namespace ewol
|
namespace ewol
|
||||||
{
|
{
|
||||||
|
// TODO : Rename this Context
|
||||||
class eSystem
|
class eSystem
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
ewol::ConfigFont m_configFont; //!< global font configuration
|
||||||
|
public:
|
||||||
|
ewol::ConfigFont& GetFontDefault(void) { return m_configFont; };
|
||||||
private:
|
private:
|
||||||
ewol::WidgetManager m_widgetManager; //!< global widget manager
|
ewol::WidgetManager m_widgetManager; //!< global widget manager
|
||||||
public:
|
public:
|
||||||
@ -89,13 +96,17 @@ namespace ewol
|
|||||||
ewol::EObjectMessageMultiCast m_MessageMulticast; //!< global message multicastiong system
|
ewol::EObjectMessageMultiCast m_MessageMulticast; //!< global message multicastiong system
|
||||||
public:
|
public:
|
||||||
ewol::EObjectMessageMultiCast& GetEObjectMessageMultiCast(void) { return m_MessageMulticast; };
|
ewol::EObjectMessageMultiCast& GetEObjectMessageMultiCast(void) { return m_MessageMulticast; };
|
||||||
|
private:
|
||||||
|
ewol::ResourceManager m_resourceManager; //!< global resources Manager
|
||||||
|
public:
|
||||||
|
ewol::ResourceManager& GetResourcesManager(void) { return m_resourceManager; };
|
||||||
public:
|
public:
|
||||||
eSystem(void);
|
eSystem(void);
|
||||||
virtual ~eSystem(void);
|
virtual ~eSystem(void);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief From everyware in the program, we can get the system inteface.
|
* @brief From everyware in the program, we can get the system inteface.
|
||||||
* @return curent pointer on the instance.
|
* @return current reference on the instance.
|
||||||
*/
|
*/
|
||||||
static eSystem& GetSystem(void);
|
static eSystem& GetSystem(void);
|
||||||
protected:
|
protected:
|
@ -13,12 +13,10 @@
|
|||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
#include <ewol/renderer/eSystemInput.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
|
||||||
#include <ewol/renderer/os/eSystemInput.h>
|
|
||||||
#include <ewol/renderer/resources/Texture.h>
|
#include <ewol/renderer/resources/Texture.h>
|
||||||
|
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
@ -10,6 +10,17 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the draw mutex (ewol render).
|
||||||
|
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
||||||
|
* @return the main inteface Mutex
|
||||||
|
*/
|
||||||
|
static etk::Mutex& MutexOpenGl(void)
|
||||||
|
{
|
||||||
|
static etk::Mutex s_drawMutex;
|
||||||
|
return s_drawMutex;
|
||||||
|
}
|
||||||
|
|
||||||
etk::Vector<mat4> l_matrixList;
|
etk::Vector<mat4> l_matrixList;
|
||||||
mat4 l_matrixCamera;
|
mat4 l_matrixCamera;
|
||||||
static uint32_t l_flagsCurrent = 0;
|
static uint32_t l_flagsCurrent = 0;
|
||||||
@ -17,9 +28,10 @@ static uint32_t l_flagsMustBeSet = 0;
|
|||||||
static uint32_t l_textureflags = 0;
|
static uint32_t l_textureflags = 0;
|
||||||
static int32_t l_programId = 0;
|
static int32_t l_programId = 0;
|
||||||
|
|
||||||
void ewol::openGL::Init(void)
|
|
||||||
|
void ewol::openGL::Lock(void)
|
||||||
{
|
{
|
||||||
// remove deprecated pb ...
|
MutexOpenGl().Lock();
|
||||||
l_matrixList.Clear();
|
l_matrixList.Clear();
|
||||||
mat4 tmpMat;
|
mat4 tmpMat;
|
||||||
l_matrixList.PushBack(tmpMat);
|
l_matrixList.PushBack(tmpMat);
|
||||||
@ -30,17 +42,9 @@ void ewol::openGL::Init(void)
|
|||||||
l_programId = -1;
|
l_programId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::openGL::UnLock(void)
|
||||||
void ewol::openGL::UnInit(void)
|
|
||||||
{
|
{
|
||||||
l_matrixList.Clear();
|
MutexOpenGl().UnLock();
|
||||||
l_matrixCamera.Identity();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::openGL::ContextIsRemoved(void)
|
|
||||||
{
|
|
||||||
// same as call Init, but in case of changing...
|
|
||||||
ewol::openGL::Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::openGL::SetBasicMatrix(const mat4& newOne)
|
void ewol::openGL::SetBasicMatrix(const mat4& newOne)
|
||||||
|
@ -56,18 +56,13 @@ extern "C" {
|
|||||||
namespace ewol {
|
namespace ewol {
|
||||||
namespace openGL {
|
namespace openGL {
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the open gl system (all the data register in the graphic card is all time duplicate in the memory)
|
* @brief Lock the OpenGL context for one user only ==> better to keep flags and other things ...
|
||||||
* this is due to the fact of some operating system destroy sometime the opengl context
|
|
||||||
*/
|
*/
|
||||||
void Init(void);
|
void Lock(void);
|
||||||
/**
|
/**
|
||||||
* @brief un-init the opengl element from the graphic card
|
* @brief Un-lock the OpenGL context for an other user...
|
||||||
*/
|
*/
|
||||||
void UnInit(void);
|
void UnLock(void);
|
||||||
/**
|
|
||||||
* @brief Need to call it when openGl context is removed ==> need to reset internal properties ...
|
|
||||||
*/
|
|
||||||
void ContextIsRemoved(void);
|
|
||||||
/**
|
/**
|
||||||
* @brief When you will done an opengl rendering, you might call this reset matrix first. It remove all the stach of the matrix pushed.
|
* @brief When you will done an opengl rendering, you might call this reset matrix first. It remove all the stach of the matrix pushed.
|
||||||
* @param[in] newOne the default matrix that might be set for the graphic card for renderer. if too more pop will be done, this is the last that mmight survived
|
* @param[in] newOne the default matrix that might be set for the graphic card for renderer. if too more pop will be done, this is the last that mmight survived
|
||||||
|
@ -12,9 +12,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/renderer/audio/audio.h>
|
#include <ewol/renderer/audio/audio.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
#include <ewol/Dimension.h>
|
#include <ewol/Dimension.h>
|
||||||
/* include auto generated file */
|
/* include auto generated file */
|
||||||
#include <ewol/renderer/os/org_ewol_EwolConstants.h>
|
#include <ewol/renderer/os/org_ewol_EwolConstants.h>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#import <ewol/renderer/os/gui.MacOs.OpenglView.h>
|
#import <ewol/renderer/os/gui.MacOs.OpenglView.h>
|
||||||
#include <OpenGL/gl.h>
|
#include <OpenGL/gl.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/Dimension.h>
|
#include <ewol/Dimension.h>
|
||||||
|
|
||||||
|
@ -15,10 +15,9 @@
|
|||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -15,11 +15,10 @@
|
|||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
|
|
||||||
#include <ewol/renderer/resources/Texture.h>
|
#include <ewol/renderer/resources/Texture.h>
|
||||||
#include <ewol/renderer/resources/Image.h>
|
#include <ewol/renderer/resources/Image.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -10,15 +10,13 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/key.h>
|
#include <ewol/key.h>
|
||||||
#include <ewol/config.h>
|
|
||||||
#include <ewol/commandLine.h>
|
#include <ewol/commandLine.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/Dimension.h>
|
#include <ewol/Dimension.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -33,10 +33,9 @@
|
|||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -21,7 +21,7 @@ ewol::Colored3DObject::Colored3DObject(etk::UString _genName) :
|
|||||||
etk::UString tmpString("DATA:simple3D.prog");
|
etk::UString tmpString("DATA:simple3D.prog");
|
||||||
// get the shader resource :
|
// get the shader resource :
|
||||||
m_GLPosition = 0;
|
m_GLPosition = 0;
|
||||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||||
m_GLColor = m_GLprogram->GetUniform("EW_color");
|
m_GLColor = m_GLprogram->GetUniform("EW_color");
|
||||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||||
@ -31,7 +31,7 @@ ewol::Colored3DObject::Colored3DObject(etk::UString _genName) :
|
|||||||
ewol::Colored3DObject::~Colored3DObject(void)
|
ewol::Colored3DObject::~Colored3DObject(void)
|
||||||
{
|
{
|
||||||
// remove dynamics dependencies :
|
// remove dynamics dependencies :
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,17 @@
|
|||||||
|
|
||||||
|
|
||||||
// free Font hnadle of librairies ... entry for acces ...
|
// free Font hnadle of librairies ... entry for acces ...
|
||||||
|
static int32_t l_countLoaded=0;
|
||||||
static FT_Library library;
|
static FT_Library library;
|
||||||
|
|
||||||
void ewol::FreeTypeInit(void)
|
void ewol::FreeTypeInit(void)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("==> Init Font-Manager");
|
EWOL_DEBUG("==> Init Font-Manager");
|
||||||
|
l_countLoaded++;
|
||||||
|
if (l_countLoaded>1) {
|
||||||
|
// already loaded ...
|
||||||
|
return;
|
||||||
|
}
|
||||||
int32_t error = FT_Init_FreeType( &library );
|
int32_t error = FT_Init_FreeType( &library );
|
||||||
if(0 != error) {
|
if(0 != error) {
|
||||||
EWOL_CRITICAL(" when loading FreeType Librairy ...");
|
EWOL_CRITICAL(" when loading FreeType Librairy ...");
|
||||||
@ -37,6 +43,11 @@ void ewol::FreeTypeInit(void)
|
|||||||
void ewol::FreeTypeUnInit(void)
|
void ewol::FreeTypeUnInit(void)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("==> Un-Init Font-Manager");
|
EWOL_DEBUG("==> Un-Init Font-Manager");
|
||||||
|
l_countLoaded--;
|
||||||
|
if (l_countLoaded>0) {
|
||||||
|
// already needed ...
|
||||||
|
return;
|
||||||
|
}
|
||||||
int32_t error = FT_Done_FreeType( library );
|
int32_t error = FT_Done_FreeType( library );
|
||||||
library = NULL;
|
library = NULL;
|
||||||
if(0 != error) {
|
if(0 != error) {
|
||||||
|
@ -33,7 +33,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
|
|||||||
|
|
||||||
//EWOL_DEBUG(m_name << " " << m_light);
|
//EWOL_DEBUG(m_name << " " << m_light);
|
||||||
|
|
||||||
if (true == ewol::resource::Keep(_shaderName, m_GLprogram) ) {
|
if (true == ewol::ResourceManager::Keep(_shaderName, m_GLprogram) ) {
|
||||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||||
m_GLNormal = m_GLprogram->GetAttribute("EW_normal");
|
m_GLNormal = m_GLprogram->GetAttribute("EW_normal");
|
||||||
@ -44,7 +44,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
|
|||||||
m_light.Link(m_GLprogram, "EW_directionalLight");
|
m_light.Link(m_GLprogram, "EW_directionalLight");
|
||||||
}
|
}
|
||||||
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
|
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
|
||||||
ewol::resource::Keep("w-fff", m_verticesVBO);
|
ewol::ResourceManager::Keep("w-fff", m_verticesVBO);
|
||||||
|
|
||||||
// load the curent file :
|
// load the curent file :
|
||||||
etk::UString tmpName = _fileName.ToLower();
|
etk::UString tmpName = _fileName.ToLower();
|
||||||
@ -68,8 +68,8 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
|
|||||||
ewol::Mesh::~Mesh(void)
|
ewol::Mesh::~Mesh(void)
|
||||||
{
|
{
|
||||||
// remove dynamics dependencies :
|
// remove dynamics dependencies :
|
||||||
ewol::resource::Release(m_GLprogram);
|
ewol::ResourceManager::Release(m_GLprogram);
|
||||||
ewol::resource::Release(m_verticesVBO);
|
ewol::ResourceManager::Release(m_verticesVBO);
|
||||||
if (m_functionFreeShape!=NULL) {
|
if (m_functionFreeShape!=NULL) {
|
||||||
m_functionFreeShape(m_pointerShape);
|
m_functionFreeShape(m_pointerShape);
|
||||||
m_pointerShape = NULL;
|
m_pointerShape = NULL;
|
||||||
|
@ -37,14 +37,14 @@ ewol::Program::Program(const etk::UString& filename) :
|
|||||||
// remove extention ...
|
// remove extention ...
|
||||||
tmpFilename.Remove(tmpFilename.Size()-4, 4);
|
tmpFilename.Remove(tmpFilename.Size()-4, 4);
|
||||||
ewol::Shader* tmpShader = NULL;
|
ewol::Shader* tmpShader = NULL;
|
||||||
if (false == ewol::resource::Keep(tmpFilename+"vert", tmpShader)) {
|
if (false == ewol::ResourceManager::Keep(tmpFilename+"vert", tmpShader)) {
|
||||||
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
EWOL_DEBUG("Add shader on program : "<< tmpFilename << "vert");
|
EWOL_DEBUG("Add shader on program : "<< tmpFilename << "vert");
|
||||||
m_shaderList.PushBack(tmpShader);
|
m_shaderList.PushBack(tmpShader);
|
||||||
}
|
}
|
||||||
if (false == ewol::resource::Keep(tmpFilename+"frag", tmpShader)) {
|
if (false == ewol::ResourceManager::Keep(tmpFilename+"frag", tmpShader)) {
|
||||||
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -81,7 +81,7 @@ ewol::Program::Program(const etk::UString& filename) :
|
|||||||
// get it with relative position :
|
// get it with relative position :
|
||||||
etk::UString tmpFilename = file.GetRelativeFolder() + tmpData;
|
etk::UString tmpFilename = file.GetRelativeFolder() + tmpData;
|
||||||
ewol::Shader* tmpShader = NULL;
|
ewol::Shader* tmpShader = NULL;
|
||||||
if (false == ewol::resource::Keep(tmpFilename, tmpShader)) {
|
if (false == ewol::ResourceManager::Keep(tmpFilename, tmpShader)) {
|
||||||
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
||||||
} else {
|
} else {
|
||||||
EWOL_DEBUG("Add shader on program : "<< tmpFilename);
|
EWOL_DEBUG("Add shader on program : "<< tmpFilename);
|
||||||
@ -99,7 +99,7 @@ ewol::Program::Program(const etk::UString& filename) :
|
|||||||
ewol::Program::~Program(void)
|
ewol::Program::~Program(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_shaderList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_shaderList.Size(); iii++) {
|
||||||
ewol::resource::Release(m_shaderList[iii]);
|
ewol::ResourceManager::Release(m_shaderList[iii]);
|
||||||
m_shaderList[iii] = 0;
|
m_shaderList[iii] = 0;
|
||||||
}
|
}
|
||||||
m_shaderList.Clear();
|
m_shaderList.Clear();
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
|
|
||||||
#include <ewol/config.h>
|
|
||||||
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
#include <ewol/renderer/ResourceManager.h>
|
||||||
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
#include <ewol/renderer/resources/font/FontBase.h>
|
#include <ewol/renderer/resources/font/FontBase.h>
|
||||||
#include <ewol/renderer/resources/TexturedFont.h>
|
#include <ewol/renderer/resources/TexturedFont.h>
|
||||||
@ -68,16 +67,6 @@ static int32_t simpleSQRT(int32_t value)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool& GetFontInSystem(void)
|
|
||||||
{
|
|
||||||
static bool fontInOs = true;
|
|
||||||
return fontInOs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::font::SetFontPropety(bool inOSSystem)
|
|
||||||
{
|
|
||||||
GetFontInSystem() = inOSSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||||
ewol::Texture(fontName)
|
ewol::Texture(fontName)
|
||||||
@ -123,14 +112,14 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
|||||||
m_size = tmpSize;
|
m_size = tmpSize;
|
||||||
|
|
||||||
etk::Vector<etk::UString> folderList;
|
etk::Vector<etk::UString> folderList;
|
||||||
if (true==GetFontInSystem()) {
|
if (true==ewol::eSystem::GetSystem().GetFontDefault().GetUseExternal()) {
|
||||||
#if defined(__TARGET_OS__Android)
|
#if defined(__TARGET_OS__Android)
|
||||||
folderList.PushBack("/system/fonts");
|
folderList.PushBack("/system/fonts");
|
||||||
#elif defined(__TARGET_OS__Linux)
|
#elif defined(__TARGET_OS__Linux)
|
||||||
folderList.PushBack("/usr/share/fonts/truetype");
|
folderList.PushBack("/usr/share/fonts/truetype");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
folderList.PushBack("DATA:fonts");
|
folderList.PushBack(ewol::eSystem::GetSystem().GetFontDefault().GetFolder());
|
||||||
for (int32_t folderID=0; folderID<folderList.Size() ; folderID++) {
|
for (int32_t folderID=0; folderID<folderList.Size() ; folderID++) {
|
||||||
etk::FSNode myFolder(folderList[folderID]);
|
etk::FSNode myFolder(folderList[folderID]);
|
||||||
// find the real Font name :
|
// find the real Font name :
|
||||||
|
@ -17,7 +17,6 @@ namespace ewol
|
|||||||
{
|
{
|
||||||
namespace font
|
namespace font
|
||||||
{
|
{
|
||||||
void SetFontPropety(bool inOSSystem);
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
Regular=0,
|
Regular=0,
|
||||||
Italic,
|
Italic,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Button"
|
#define __class__ "Button"
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <ewol/widget/meta/ColorChooser.h>
|
#include <ewol/widget/meta/ColorChooser.h>
|
||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";
|
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <ewol/widget/Entry.h>
|
#include <ewol/widget/Entry.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/eObject/EObject.h>
|
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/widget/Menu.h>
|
#include <ewol/widget/Menu.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
|
@ -7,12 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/renderer/EObjectManager.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/renderer/os/gui.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "DrawProperty"
|
#define __class__ "DrawProperty"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#ifndef __EWOL_WIDGET_H__
|
#ifndef __EWOL_WIDGET_H__
|
||||||
#define __EWOL_WIDGET_H__
|
#define __EWOL_WIDGET_H__
|
||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/renderer/EObject.h>
|
||||||
#include <ewol/Dimension.h>
|
#include <ewol/Dimension.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/renderer/openGL.h>
|
#include <ewol/renderer/openGL.h>
|
||||||
#include <ewol/renderer/os/eSystem.h>
|
#include <ewol/renderer/eSystem.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <ewol/widget/Image.h>
|
#include <ewol/widget/Image.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/widget/Composer.h>
|
#include <ewol/widget/Composer.h>
|
||||||
#include <ewol/UserConfig.h>
|
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
|
|
||||||
|
|
||||||
@ -213,7 +212,8 @@ void widget::Parameter::OnReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
// Close this widget ...
|
// Close this widget ...
|
||||||
AutoDestroy();
|
AutoDestroy();
|
||||||
} else if (_msg.GetMessage() == ewolEventParameterSave) {
|
} else if (_msg.GetMessage() == ewolEventParameterSave) {
|
||||||
ewol::userConfig::Save();
|
//ewol::userConfig::Save();
|
||||||
|
EWOL_TODO("Save Parameter !!! ");
|
||||||
} else if (_msg.GetMessage() == l_eventMenuSelected) {
|
} else if (_msg.GetMessage() == l_eventMenuSelected) {
|
||||||
if (NULL != m_wSlider) {
|
if (NULL != m_wSlider) {
|
||||||
int32_t value = 0;
|
int32_t value = 0;
|
||||||
|
@ -15,34 +15,30 @@ def Create(target):
|
|||||||
'ewol/ewol.cpp',
|
'ewol/ewol.cpp',
|
||||||
'ewol/clipBoard.cpp',
|
'ewol/clipBoard.cpp',
|
||||||
'ewol/debug.cpp',
|
'ewol/debug.cpp',
|
||||||
'ewol/config.cpp',
|
|
||||||
'ewol/commandLine.cpp',
|
'ewol/commandLine.cpp',
|
||||||
'ewol/key.cpp',
|
'ewol/key.cpp',
|
||||||
'ewol/cursor.cpp',
|
'ewol/cursor.cpp',
|
||||||
'ewol/Dimension.cpp',
|
'ewol/Dimension.cpp'])
|
||||||
'ewol/UserConfig.cpp'])
|
|
||||||
|
|
||||||
# Basic Eobject of EWOL
|
# Basic Eobject of EWOL
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([])
|
||||||
'ewol/eObject/EConfig.cpp',
|
|
||||||
'ewol/eObject/EMessage.cpp',
|
|
||||||
'ewol/eObject/EObject.cpp',
|
|
||||||
'ewol/eObject/EObjectManager.cpp',
|
|
||||||
'ewol/eObject/EObjectMessageMultiCast.cpp'])
|
|
||||||
|
|
||||||
#openGl Basic access abstraction (for the model matrix and include
|
#openGl Basic access abstraction (for the model matrix and include
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
|
'ewol/renderer/EConfig.cpp',
|
||||||
|
'ewol/renderer/EMessage.cpp',
|
||||||
|
'ewol/renderer/EObject.cpp',
|
||||||
|
'ewol/renderer/EObjectManager.cpp',
|
||||||
|
'ewol/renderer/EObjectMessageMultiCast.cpp',
|
||||||
'ewol/renderer/openGL.cpp',
|
'ewol/renderer/openGL.cpp',
|
||||||
|
'ewol/renderer/ConfigFont.cpp',
|
||||||
'ewol/renderer/EventInput.cpp',
|
'ewol/renderer/EventInput.cpp',
|
||||||
'ewol/renderer/EventEntry.cpp',
|
'ewol/renderer/EventEntry.cpp',
|
||||||
'ewol/renderer/EventTime.cpp',
|
'ewol/renderer/EventTime.cpp',
|
||||||
'ewol/renderer/Light.cpp',
|
'ewol/renderer/Light.cpp',
|
||||||
'ewol/renderer/Material.cpp'])
|
'ewol/renderer/Material.cpp',
|
||||||
|
'ewol/renderer/eSystem.cpp',
|
||||||
# Operating System interface
|
'ewol/renderer/eSystemInput.cpp'])
|
||||||
myModule.AddSrcFile([
|
|
||||||
'ewol/renderer/os/eSystem.cpp',
|
|
||||||
'ewol/renderer/os/eSystemInput.cpp'])
|
|
||||||
|
|
||||||
# renderer :
|
# renderer :
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user