[DEV] rework some global elements (step 5)

This commit is contained in:
Edouard DUPIN 2013-09-02 06:46:49 +02:00
parent 3b874d3786
commit f52a6919e3
55 changed files with 809 additions and 912 deletions

View File

@ -45,7 +45,7 @@ ewol::Material::Material(void) :
ewol::Material::~Material(void)
{
if(NULL!=m_texture0) {
ewol::ResourceManager::Release(m_texture0);
ewol::resource::Release(m_texture0);
}
}
@ -66,7 +66,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename)
// prevent overloard error :
ewol::TextureFile* tmpCopy = m_texture0;
m_texture0 = NULL;
if (false == ewol::ResourceManager::Keep(_filename, m_texture0, tmpSize)) {
if (false == ewol::resource::Keep(_filename, m_texture0, tmpSize)) {
EWOL_ERROR("Can not load specific texture : " << _filename);
// retreave previous texture:
m_texture0 = tmpCopy;
@ -74,7 +74,7 @@ void ewol::Material::SetTexture0(const etk::UString& _filename)
}
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...
ewol::ResourceManager::Release(tmpCopy);
ewol::resource::Release(tmpCopy);
}
}

View File

@ -10,36 +10,37 @@
#include <ewol/commandLine.h>
#include <etk/Vector.h>
// ------------------------------------------------------------------------
// Command line arguments
// ------------------------------------------------------------------------
static etk::Vector<etk::UString> listArgs;
void ewol::commandLine::Clean(void)
void ewol::CommandLine::Parse(int32_t _argc, const char* _argv[])
{
EWOL_DEBUG("Clean commandLine (START)");
listArgs.Clear();
EWOL_DEBUG("Clean commandLine (END)");
}
int32_t ewol::commandLine::Size(void)
{
return listArgs.Size();
}
etk::UString ewol::commandLine::Get(int32_t _id)
{
if (_id<0 && _id>=listArgs.Size()) {
return "";
for( int32_t i=1 ; i<_argc; i++) {
EWOL_INFO("commandLine : \"" << _argv[i] << "\"" );
m_listArgs.PushBack(_argv[i]);
}
return listArgs[_id];
}
void ewol::commandLine::Add(const etk::UString& _newElement)
esize_t ewol::CommandLine::Size(void)
{
listArgs.PushBack(_newElement);
return m_listArgs.Size();
}
const etk::UString& ewol::CommandLine::Get(int32_t _id)
{
static const etk::UString errorArg("");
if (_id<0 && _id>=m_listArgs.Size()) {
return errorArg;
}
return m_listArgs[_id];
}
void ewol::CommandLine::Add(const etk::UString& _newElement)
{
m_listArgs.PushBack(_newElement);
}
void ewol::CommandLine::Remove(esize_t _id)
{
m_listArgs.Remove(_id);
}

View File

@ -14,26 +14,35 @@
namespace ewol
{
namespace commandLine {
/**
* @brief Remove all the element bufferised in the commandLine system
*/
void Clean(void);
/**
* @brief Get the number of element in the Command Line
* @return the number of element
*/
int32_t Size(void);
/**
* @brief Get an element with a specific ID
* @return _id The cmdLine Id element
*/
etk::UString Get(int32_t _id);
/**
* @brief Add one element at the Command Line
* @param[in] _newElement String in the input that might be added.
*/
void Add(const etk::UString& _newElement);
class CommandLine
{
private:
etk::Vector<etk::UString> m_listArgs; //!< list of all argument parsed
public:
/**
* @brief Parse the command line parameters
*/
void Parse(int32_t _argc, const char* _argv[]);
/**
* @brief Get the number of element in the Command Line
* @return the number of element
*/
esize_t Size(void);
/**
* @brief Get an element with a specific ID
* @return _id The cmdLine Id element
*/
const etk::UString& Get(int32_t _id);
/**
* @brief Add one element at the Command Line
* @param[in] _newElement String in the input that might be added.
*/
void Add(const etk::UString& _newElement);
/**
* @brief Remove an element
* @param[in] _id Id of the element
*/
void Remove(esize_t _id);
};
};

View File

@ -23,7 +23,7 @@ ewol::Area::Area(const ivec2& _size) :
m_GLtexID(-1),
m_resource(NULL)
{
ewol::ResourceManager::Keep(m_resource);
ewol::resource::Keep(m_resource);
m_resource->SetImageSize(_size);
m_resource->Flush();
LoadProgram();
@ -32,10 +32,10 @@ ewol::Area::Area(const ivec2& _size) :
ewol::Area::~Area(void)
{
if (NULL != m_resource) {
ewol::ResourceManager::Release(m_resource);
ewol::resource::Release(m_resource);
m_resource = NULL;
}
ewol::ResourceManager::Release(m_GLprogram);
ewol::resource::Release(m_GLprogram);
}
void ewol::Area::LoadProgram(void)
@ -43,7 +43,7 @@ void ewol::Area::LoadProgram(void)
etk::UString tmpString("DATA:textured3D.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");

View File

@ -289,7 +289,7 @@ void ewol::Drawing::ResetCount(void)
void ewol::Drawing::UnLoadProgram(void)
{
if (NULL!=m_GLprogram) {
ewol::ResourceManager::Release(m_GLprogram);
ewol::resource::Release(m_GLprogram);
m_GLprogram = NULL;
}
}
@ -301,7 +301,7 @@ void ewol::Drawing::LoadProgram(void)
// oad the new ...
etk::UString tmpString("DATA:color3.prog");
// get the shader resource :
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");

View File

@ -34,10 +34,10 @@ ewol::Image::Image(const etk::UString& _imageName) :
ewol::Image::~Image(void)
{
if (NULL != m_resource) {
ewol::ResourceManager::Release(m_resource);
ewol::resource::Release(m_resource);
m_resource = NULL;
}
ewol::ResourceManager::Release(m_GLprogram);
ewol::resource::Release(m_GLprogram);
}
void ewol::Image::LoadProgram(void)
@ -45,7 +45,7 @@ void ewol::Image::LoadProgram(void)
etk::UString tmpString("DATA:textured3D.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
@ -240,14 +240,14 @@ void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size)
Clear();
// remove old one
if (NULL != m_resource) {
ewol::ResourceManager::Release(m_resource);
ewol::resource::Release(m_resource);
m_resource = NULL;
}
ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded...
if (_newFile != "") {
// link to new One
if (false == ewol::ResourceManager::Keep(_newFile, m_resource, tmpSize)) {
if (false == ewol::resource::Keep(_newFile, m_resource, tmpSize)) {
EWOL_ERROR("Can not get Image resource");
}
}

View File

@ -51,15 +51,15 @@ ewol::Shaper::~Shaper(void)
void ewol::Shaper::UnLoadProgram(void)
{
if (NULL != m_GLprogram) {
ewol::ResourceManager::Release(m_GLprogram);
ewol::resource::Release(m_GLprogram);
m_GLprogram = NULL;
}
if (NULL != m_resourceTexture) {
ewol::ResourceManager::Release(m_resourceTexture);
ewol::resource::Release(m_resourceTexture);
m_resourceTexture = NULL;
}
if (NULL != m_config) {
ewol::ResourceManager::Release(m_config);
ewol::resource::Release(m_config);
m_config = NULL;
}
}
@ -70,7 +70,7 @@ void ewol::Shaper::LoadProgram(void)
EWOL_DEBUG("no Shaper set for loading resources ...");
return;
}
if (true == ewol::ResourceManager::Keep(m_name, m_config) ) {
if (true == ewol::resource::Keep(m_name, m_config) ) {
m_confIdPaddingX = m_config->Request("PaddingX");
m_confIdPaddingY = m_config->Request("PaddingY");
m_confIdChangeTime = m_config->Request("ChangeTime");
@ -85,7 +85,7 @@ void ewol::Shaper::LoadProgram(void)
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::ResourceManager::Keep(tmpFilename, m_GLprogram) ) {
if (true == ewol::resource::Keep(tmpFilename, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
// Widget property ==> for the Vertex shader
@ -104,7 +104,7 @@ void ewol::Shaper::LoadProgram(void)
if (basicImageFile != "") {
tmpFilename = file.GetRelativeFolder() + basicImageFile;
ivec2 size(64,64);
if (true == ewol::ResourceManager::Keep(tmpFilename, m_resourceTexture, size) ) {
if (true == ewol::resource::Keep(tmpFilename, m_resourceTexture, size) ) {
// nothing else to do ...
}
}

View File

@ -49,10 +49,10 @@ ewol::Text::~Text(void)
{
if (NULL != m_font) {
ewol::ResourceManager::Release(m_font);
ewol::resource::Release(m_font);
m_font = NULL;
}
ewol::ResourceManager::Release(m_GLprogram);
ewol::resource::Release(m_GLprogram);
}
void ewol::Text::LoadProgram(void)
@ -60,7 +60,7 @@ void ewol::Text::LoadProgram(void)
etk::UString tmpString("DATA:text.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
@ -316,7 +316,7 @@ void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize)
Clear();
// remove old one
if (NULL != m_font) {
ewol::ResourceManager::Release(m_font);
ewol::resource::Release(m_font);
m_font = NULL;
}
if (_fontSize <= 0) {
@ -328,7 +328,7 @@ void ewol::Text::SetFont(etk::UString _fontName, int32_t _fontSize)
_fontName += ":";
_fontName += _fontSize;
// link to new One
if (false == ewol::ResourceManager::Keep(_fontName, m_font)) {
if (false == ewol::resource::Keep(_fontName, m_font)) {
EWOL_ERROR("Can not get font resource");
}
}

View File

@ -18,46 +18,6 @@
#undef __class__
#define __class__ "ewol"
int32_t ewol::Run(int32_t _argc, const char* _argv[])
{
if (NULL!=_argv) {
etk::SetArgZero(_argv[0]);
}
// init display convertions:
ewol::dimension::Init();
EWOL_DEBUG("Store commangLine in the specific system");
ewol::commandLine::Clean();
for( int32_t i=1 ; i<_argc; i++) {
EWOL_INFO("commandLine : \"" << _argv[i] << "\"" );
if (0==strncmp("-l0", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_NONE);
} else if (0==strncmp("-l1", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_CRITICAL);
} else if (0==strncmp("-l2", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_ERROR);
} else if (0==strncmp("-l3", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_WARNING);
} else if (0==strncmp("-l4", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_INFO);
} else if (0==strncmp("-l5", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_DEBUG);
} else if( 0==strncmp("-l6", _argv[i], 256)
|| 0==strncmp("-l7", _argv[i], 256)
|| 0==strncmp("-l8", _argv[i], 256)
|| 0==strncmp("-l9", _argv[i], 256)) {
GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE);
} else {
ewol::commandLine::Add(_argv[i]);
}
}
// call standard RUN ...
int32_t error = ewol::eContext::main(_argc, _argv);
ewol::commandLine::Clean();
return error;
}
etk::UString ewol::GetCompilationMode(void)
{
@ -85,62 +45,6 @@ etk::UString ewol::GetBoardType(void)
#endif
}
/*
void ewol::WindowsSet(ewol::Windows* _windows)
{
// Remove current Focus :
ewol::widgetManager::FocusSetDefault(NULL);
ewol::widgetManager::FocusRelease();
// set display of the windows :
eSystem::SetCurrentWindows(_windows);
// Set the new default Focus :
ewol::widgetManager::FocusSetDefault(_windows);
}
void ewol::WindowsPopUpAdd(ewol::Widget* _tmpWidget)
{
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
if (NULL != tmpWindows && NULL != _tmpWidget) {
tmpWindows->PopUpWidgetPush(_tmpWidget);
}
}
void ewol::ChangeSize(const ivec2& _size)
{
guiInterface::ChangeSize(_size);
}
void ewol::ChangePos(const ivec2& _pos)
{
guiInterface::ChangePos(_pos);
}
void ewol::ForceRedrawAll(void)
{
eSystem::ForceRedrawAll();
}
void ewol::RequestUpdateSize(void)
{
eSystem::RequestUpdateSize();
}
void ewol::Keyboard(bool _hide)
{
if (true == _hide) {
guiInterface::KeyboardHide();
} else {
guiInterface::KeyboardShow();
}
}
void ewol::SetTitle(const etk::UString& _title)
{
etk::UString title = _title;
guiInterface::SetTitle(title);
}
*/
etk::UString ewol::GetVersion(void)
{
#define FIRST_YEAR (2011)
@ -152,27 +56,5 @@ etk::UString ewol::GetVersion(void)
return tmpOutput;
}
int64_t ewol::GetTime(void)
{
return ewol::eContext::GetTime();
}
/*
void ewol::InputEventTransfertWidget(ewol::Widget* _source, ewol::Widget* _destination)
{
eSystem::InputEventTransfertWidget(_source, _destination);
}
void ewol::ForceOrientation(ewol::orientation_te _orientation)
{
guiInterface::ForceOrientation(_orientation);
}
void ewol::SetIcon(const etk::UString& _icon)
{
guiInterface::SetIcon(_icon);
}
*/

View File

@ -34,6 +34,7 @@ namespace ewol
/**
* @brief Get current time in us...
* @return The current time
* @note is implemented by the OS implementation cf renderer/X11/...
*/
int64_t GetTime(void);
/**
@ -42,23 +43,10 @@ namespace ewol
*/
etk::UString GetCompilationMode(void);
/**
* @brief Get the board type ()
* @brief Get the board type (Android/Linux/MacOs/...)
* @return the string of the mode of commpilation
*/
etk::UString GetBoardType(void);
typedef enum {
SCREEN_ORIENTATION_AUTO = 0,
SCREEN_ORIENTATION_LANDSCAPE,
SCREEN_ORIENTATION_PORTRAIT,
} orientation_te;
/*
/ **
* @brief Force a specific orientation for mobile devices
* @param[in] orientation the requested position.
* /
void ForceOrientation(ewol::orientation_te _orientation);
*/
};
#endif

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsBox.h>
#include <ewol/physicsShape/PhysicsBox.h>

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol
{

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsCapsule.h>
#include <ewol/physicsShape/PhysicsCapsule.h>

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsCone.h>
#include <ewol/physicsShape/PhysicsCone.h>

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsConvexHull.h>
#include <ewol/physicsShape/PhysicsConvexHull.h>

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsCylinder.h>
#include <ewol/physicsShape/PhysicsCylinder.h>
bool ewol::PhysicsCylinder::Parse(const char* _line)

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol

View File

@ -6,13 +6,13 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/renderer/resources/physicsShape/PhysicsBox.h>
#include <ewol/renderer/resources/physicsShape/PhysicsCapsule.h>
#include <ewol/renderer/resources/physicsShape/PhysicsCone.h>
#include <ewol/renderer/resources/physicsShape/PhysicsConvexHull.h>
#include <ewol/renderer/resources/physicsShape/PhysicsCylinder.h>
#include <ewol/renderer/resources/physicsShape/PhysicsSphere.h>
#include <ewol/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsBox.h>
#include <ewol/physicsShape/PhysicsCapsule.h>
#include <ewol/physicsShape/PhysicsCone.h>
#include <ewol/physicsShape/PhysicsConvexHull.h>
#include <ewol/physicsShape/PhysicsCylinder.h>
#include <ewol/physicsShape/PhysicsSphere.h>
ewol::PhysicsShape* ewol::PhysicsShape::Create(const etk::UString& _name)

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/debug.h>
#include <ewol/renderer/resources/physicsShape/PhysicsSphere.h>
#include <ewol/physicsShape/PhysicsSphere.h>

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/renderer/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
namespace ewol

View File

@ -16,7 +16,7 @@
#include <ewol/renderer/audio/audio.h>
#include <ewol/Dimension.h>
/* include auto generated file */
#include <ewol/renderer/os/org_ewol_EwolConstants.h>
#include <ewol/renderer/Android/org_ewol_EwolConstants.h>
typedef enum {
appl_unknow,

View File

@ -7,8 +7,8 @@
*/
#include <ewol/debug.h>
#include <ewol/renderer/EObjectMessageMultiCast.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/EMultiCast.h>
#include <ewol/renderer/eContext.h>
#undef __class__
#define __class__ "EMultiCast"

View File

@ -6,8 +6,8 @@
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_E_OBJECT_MESSAGE_MULTICAST_H__
#define __EWOL_E_OBJECT_MESSAGE_MULTICAST_H__
#ifndef __EWOL_E_MULTICAST_H__
#define __EWOL_E_MULTICAST_H__
#include <etk/types.h>
#include <etk/UString.h>

View File

@ -33,7 +33,7 @@ ewol::EObject::~EObject(void)
{
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
GetEObjectManager().Rm(this);
GetEObjectMessageMultiCast().Rm(this);
GetMultiCast().Rm(this);
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
if (NULL!=m_externEvent[iii]) {
delete(m_externEvent[iii]);
@ -91,7 +91,7 @@ void ewol::EObject::GenerateEventId(const char * _generateEventId, const etk::US
void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UString& _data)
{
int32_t nbObject = GetEObjectManager().GetNumberObject();
GetEObjectMessageMultiCast().Send(this, _messageId, _data);
GetMultiCast().Send(this, _messageId, _data);
if (nbObject > GetEObjectManager().GetNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous");
}
@ -99,7 +99,7 @@ void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UStri
void ewol::EObject::RegisterMultiCast(const char* const _messageId)
{
GetEObjectMessageMultiCast().Add(this, _messageId);
GetMultiCast().Add(this, _messageId);
}
void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
@ -311,12 +311,12 @@ ewol::EObjectManager& ewol::EObject::GetEObjectManager(void)
return ewol::GetContext().GetEObjectManager();
}
ewol::EMultiCast& ewol::EObject::GetEObjectMessageMultiCast(void)
ewol::EMultiCast& ewol::EObject::GetMultiCast(void)
{
return ewol::GetContext().GetEObjectManager().MultiCast();
}
ewol::eSystem& ewol::EObject::GetSystem(void)
ewol::eContext& ewol::EObject::GetContext(void)
{
return ewol::GetContext();
}

View File

@ -18,7 +18,7 @@ namespace ewol {
class EObject;
class EObjectManager;
class EMultiCast;
class eSystem;
class eContext;
};
#include <ewol/renderer/EConfig.h>
@ -228,12 +228,12 @@ namespace ewol {
* @breif Get the current EObject Message Multicast manager.
* @return the requested object manager.
*/
ewol::EMultiCast& GetEObjectMessageMultiCast(void);
ewol::EMultiCast& GetMultiCast(void);
/**
* @brief Get the curent the system inteface.
* @return current reference on the instance.
*/
eSystem& GetSystem(void);
eContext& GetContext(void);
};
};

View File

@ -7,7 +7,7 @@
*/
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/eContext.h>
#include <ewol/ewol.h>
#undef __class__
@ -70,7 +70,7 @@ void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object)
}
}
// call input event manager to remove linked widget ...
ewol::eSystem::GetSystem().OnObjectRemove(_object);
ewol::GetContext().OnObjectRemove(_object);
}
void ewol::EObjectManager::Rm(ewol::EObject* _object)
@ -113,7 +113,7 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* _object)
EWOL_DEBUG("Auto-Remove EObject : [" << _object->GetId() << "] type=\"" << _object->GetObjectType() << "\"");
informOneObjectIsRemoved(_object);
m_eObjectAutoRemoveList.PushBack(_object);
ewol::eSystem::GetSystem().ForceRedrawAll();
ewol::GetContext().ForceRedrawAll();
return;
}
}

View File

@ -36,7 +36,7 @@ namespace ewol
private:
ewol::EMultiCast m_multiCast; //!< muticast manager
public:
ewol::EMultiCast MultiCast(void) { return m_multiCast; };
ewol::EMultiCast& MultiCast(void) { return m_multiCast; };
};
};

View File

@ -16,163 +16,464 @@
#include <etk/unicode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/Image.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/resources/Texture.h>
#include <ewol/resources/Image.h>
#include <ewol/renderer/eContext.h>
#include <ewol/renderer/openGL.h>
#include <sys/time.h>
int32_t m_currentHeight = 0;
#include <windows.h>
#include <windowsx.h>
int64_t guiInterface::GetTime(void)
int64_t ewol::GetTime(void)
{
struct timeval now;
struct timeval now;
gettimeofday(&now, NULL);
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec);
}
bool inputIsPressed[20];
static ewol::SpecialKey guiKeyBoardMode;
void guiInterface::SetTitle(etk::UString& title)
{
// TODO ...
}
#undef __class__
#define __class__ "guiInterface"
#define __class__ "ContextWindows"
bool m_run = true;
void guiInterface::Stop(void)
class WindowsContext : public eContext
{
m_run = false;
// To exit program ...
PostQuitMessage(0);
}
void guiInterface::KeyboardShow(void)
{
// nothing to do : No keyboard on computer ...
}
void guiInterface::KeyboardHide(void)
{
// nothing to do : No keyboard on computer ...
}
void guiInterface::ChangeSize(ivec2 size)
{
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
size.setValue(size.x() + border_thickness*2,
size.y() + border_thickness*2 + title_size);
//m_currentHeight = size.y;
// TODO : Later
}
void guiInterface::ChangePos(ivec2 pos)
{
// TODO : Later
}
void guiInterface::GetAbsPos(ivec2& size)
{
// TODO : Later
size.setValue(0,0);
}
// -------------------------------------------------------------------------
// ClipBoard AREA :
// -------------------------------------------------------------------------
bool l_clipBoardOwnerStd = false;
void guiInterface::ClipBoardGet(ewol::clipBoard::clipboardListe_te clipboardID)
{
// this is to force the local system to think we have the buffer
// TODO : Remove this 2 Line when code will be writen
l_clipBoardOwnerStd = true;
switch (clipboardID)
{
case ewol::clipBoard::clipboardSelection:
// NOTE : Windows does not support the middle button the we do it internaly
// just transmit an event , we have the data in the system
eSystem::ClipBoardArrive(clipboardID);
break;
case ewol::clipBoard::clipboardStd:
if (false == l_clipBoardOwnerStd) {
// Generate a request TO the OS
// TODO : Send the message to the OS "We disire to receive the copy buffer ...
} else {
// just transmit an event , we have the data in the system
eSystem::ClipBoardArrive(clipboardID);
private:
int32_t m_currentHeight = 0;
bool m_inputIsPressed[MAX_MANAGE_INPUT];
ewol::SpecialKey m_guiKeyBoardMode;
bool m_run = true;
bool m_clipBoardOwnerStd = false;
public:
WindowsContext(int32_t _argc, char* _argv[]) :
ewol::eContext(_argc, _argv)
{
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) {
m_inputIsPressed[iii] = false;
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
void guiInterface::ClipBoardSet(ewol::clipBoard::clipboardListe_te clipboardID)
{
switch (clipboardID)
{
case ewol::clipBoard::clipboardSelection:
// NOTE : nothing to do : Windows deas ot supported Middle button
break;
case ewol::clipBoard::clipboardStd:
// Request the clipBoard :
if (false == l_clipBoardOwnerStd) {
// TODO : Inform the OS that we have the current buffer of copy ...
l_clipBoardOwnerStd = true;
}
~WindowsContext(void)
{
}
int32_t Run(void)
{
HINSTANCE hInstance = 0;
WNDCLASS wc;
HWND hWnd;
HDC hDC;
HGLRC hRC;
MSG msg;
// register window class
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = "EwolMainWindows";
RegisterClass( &wc );
// create main window
hWnd = CreateWindow( "EwolMainWindows", "Ewol ... TODO Title",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX,
0, 0, 800, 600,
NULL, NULL, hInstance, NULL );
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
m_currentHeight = 600-2*border_thickness -title_size;
OS_Resize(800-2*border_thickness, m_currentHeight);
// enable OpenGL for the window
EnableOpenGL( hWnd, &hDC, &hRC );
// program main loop
while(true == m_run) {
// check for messages
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) {
// handle or dispatch messages
if ( msg.message == WM_QUIT ) {
m_run = false;
} else {
TranslateMessage( &msg );
DispatchMessage( &msg );
}
} else {
(void)Draw(true);
SwapBuffers( hDC );
}
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
// shutdown OpenGL
DisableOpenGL( hWnd, hDC, hRC );
// destroy the window explicitly
DestroyWindow( hWnd );
return msg.wParam;
}
void Stop(void)
{
m_run = false;
// To exit program ...
PostQuitMessage(0);
}
void SetSize(const vec2& _size)
{
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
size.setValue(_size.x() + border_thickness*2,
_size.y() + border_thickness*2 + title_size);
//m_currentHeight = size.y;
// TODO : Later
}
void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID)
{
// this is to force the local system to think we have the buffer
// TODO : Remove this 2 Line when code will be writen
l_clipBoardOwnerStd = true;
switch (_clipboardID)
{
case ewol::clipBoard::clipboardSelection:
// NOTE : Windows does not support the middle button the we do it internaly
// just transmit an event , we have the data in the system
ClipBoardArrive(_clipboardID);
break;
case ewol::clipBoard::clipboardStd:
if (false == l_clipBoardOwnerStd) {
// Generate a request TO the OS
// TODO : Send the message to the OS "We disire to receive the copy buffer ...
} else {
// just transmit an event , we have the data in the system
ClipBoardArrive(_clipboardID);
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
void ClipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID)
{
switch (_clipboardID)
{
case ewol::clipBoard::clipboardSelection:
// NOTE : nothing to do : Windows deas ot supported Middle button
break;
case ewol::clipBoard::clipboardStd:
// Request the clipBoard :
if (false == m_clipBoardOwnerStd) {
// TODO : Inform the OS that we have the current buffer of copy ...
m_clipBoardOwnerStd = true;
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
// Enable OpenGL
void EnableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC)
{
// get the device context (DC)
*hDC = GetDC( _hWnd );
PIXELFORMATDESCRIPTOR pfd;
// set the pixel format for the DC
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
int format = ChoosePixelFormat( *_hDC, &pfd );
SetPixelFormat( *_hDC, format, &pfd );
// create and enable the render context (RC)
*_hRC = wglCreateContext( *_hDC );
wglMakeCurrent( *_hDC, *_hRC );
}
// Disable OpenGL
void DisableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC)
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( _hRC );
ReleaseDC( _hWnd, _hDC );
}
// Window Procedure
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam)
{
// TODO : Set this function really work...
classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam);
}
LRESULT CALLBACK WndProcReal(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam)
{
bool buttonIsDown = true;
int32_t mouseButtonId = 0;
ivec2 pos;
// to know all _message : http://wiki.winehq.org/List_Of_Windows__messages
switch (_message)
{
/* **************************************************************************
* Gui event
* **************************************************************************/
case WM_CREATE:
EWOL_DEBUG("WM_CREATE");
return 0;
case WM_CLOSE:
EWOL_DEBUG("WM_CLOSE");
PostQuitMessage( 0 );
return 0;
case WM_DESTROY:
EWOL_DEBUG("WM_DESTROY");
return 0;
case WM_MOVE:
EWOL_DEBUG("WM_MOVE");
return 0;
case WM_SIZE:
EWOL_DEBUG("WM_SIZE");
return 0;
/*
case WM_GETMINMAXINFO:
{
MINMAXINFO* tmpVal = (MINMAXINFO*)lParam;
EWOL_DEBUG("WM_GETMINMAXINFO : ");
EWOL_DEBUG(" ptMaxSize : " << tmpVal->ptMaxSize.x << "," << tmpVal->ptMaxSize.y << ")");
EWOL_DEBUG(" ptMaxPosition : " << tmpVal->ptMaxPosition.x << "," << tmpVal->ptMaxPosition.y << ")");
EWOL_DEBUG(" ptMinTrackSize : " << tmpVal->ptMinTrackSize.x << "," << tmpVal->ptMinTrackSize.y << ")");
EWOL_DEBUG(" ptMaxTrackSize : " << tmpVal->ptMaxTrackSize.x << "," << tmpVal->ptMaxTrackSize.y << ")");
}
return 0;
*/
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS* tmpVal = (WINDOWPOS*)_lParam;
if (NULL != tmpVal) {
//EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")");
// in windows system, we need to remove the size of the border elements :
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
m_currentHeight = tmpVal->cy - 2*border_thickness - title_size;
OS_Resize(tmpVal->cx-2*border_thickness, m_currentHeight);
}
}
return 0;
// these message are not parse by us ...
case WM_SETCURSOR: // Call the windows if we want the mouse event :
case WM_NCHITTEST: // inform the application the position of the mouse is moving
return DefWindowProc( _hWnd, _message, _wParam, _lParam );
/* **************************************************************************
* Keyboard management
* **************************************************************************/
case WM_KEYUP:
buttonIsDown = false;
case WM_KEYDOWN:
{
etk::UniChar tmpChar = 0;
ewol::keyEvent::keyboard_te keyInput;
switch (_wParam) {
//case 80: // keypad
case VK_UP: keyInput = ewol::keyEvent::keyboardUp; break;
//case 83: // keypad
case VK_LEFT: keyInput = ewol::keyEvent::keyboardLeft; break;
//case 85: // keypad
case VK_RIGHT: keyInput = ewol::keyEvent::keyboardRight; break;
//case 88: // keypad
case VK_DOWN: keyInput = ewol::keyEvent::keyboardDown; break;
//case 81: // keypad
case VK_PRIOR: keyInput = ewol::keyEvent::keyboardPageUp; break;
//case 89: // keypad
case VK_NEXT: keyInput = ewol::keyEvent::keyboardPageDown; break;
//case 79: // keypad
case VK_HOME: keyInput = ewol::keyEvent::keyboardStart; break;
//case 87: // keypad
case VK_END: keyInput = ewol::keyEvent::keyboardEnd; break;
//case VK_: keyInput = ewol::keyEvent::keyboardStopDefil; break;
case VK_PAUSE: keyInput = ewol::keyEvent::keyboardWait; break;
//case 90: // keypad
case VK_INSERT:
keyInput = ewol::keyEvent::keyboardInsert;
guiKeyBoardMode.insert = buttonIsDown;
break;
case VK_F1: keyInput = ewol::keyEvent::keyboardF1; break;
case VK_F2: keyInput = ewol::keyEvent::keyboardF2; break;
case VK_F3: keyInput = ewol::keyEvent::keyboardF3; break;
case VK_F4: keyInput = ewol::keyEvent::keyboardF4; break;
case VK_F5: keyInput = ewol::keyEvent::keyboardF5; break;
case VK_F6: keyInput = ewol::keyEvent::keyboardF6; break;
case VK_F7: keyInput = ewol::keyEvent::keyboardF7; break;
case VK_F8: keyInput = ewol::keyEvent::keyboardF8; break;
case VK_F9: keyInput = ewol::keyEvent::keyboardF9; break;
case VK_F10: keyInput = ewol::keyEvent::keyboardF10; break;
case VK_F11: keyInput = ewol::keyEvent::keyboardF11; break;
case VK_F12:
case VK_F13:
case VK_F14:
case VK_F15:
case VK_F16:
case VK_F17:
case VK_F18:
case VK_F19:
case VK_F20:
case VK_F21:
case VK_F22:
case VK_F23:
case VK_F24: keyInput = ewol::keyEvent::keyboardF12; break;
case VK_CAPITAL: keyInput = ewol::keyEvent::keyboardCapLock; guiKeyBoardMode.capLock = buttonIsDown; break;
case VK_SHIFT:
case VK_LSHIFT: keyInput = ewol::keyEvent::keyboardShiftLeft; guiKeyBoardMode.shift = buttonIsDown; break;
case VK_RSHIFT: keyInput = ewol::keyEvent::keyboardShiftRight; guiKeyBoardMode.shift = buttonIsDown; break;
case VK_CONTROL:
case VK_LCONTROL: keyInput = ewol::keyEvent::keyboardCtrlLeft; guiKeyBoardMode.ctrl = buttonIsDown; break;
case VK_RCONTROL: keyInput = ewol::keyEvent::keyboardCtrlRight; guiKeyBoardMode.ctrl = buttonIsDown; break;
case VK_LWIN: keyInput = ewol::keyEvent::keyboardMetaLeft; guiKeyBoardMode.meta = buttonIsDown; break;
case VK_RWIN: keyInput = ewol::keyEvent::keyboardMetaRight; guiKeyBoardMode.meta = buttonIsDown; break;
case VK_MENU:
case VK_LMENU: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = buttonIsDown; break;
case VK_RMENU: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = buttonIsDown; break;
//case : keyInput = ewol::keyEvent::keyboardContextMenu; break;
case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break;
case VK_BACK: // DEL
tmpChar.Set(0x08);
break;
// TODO : Really strang, need to understand why ...
case 46: // Suppr
tmpChar.Set(0x7F);
break;
case VK_TAB: // special case for TAB
tmpChar.Set(0x09);
break;
case VK_RETURN: // special case for TAB
tmpChar = '\n';
break;
default:
{
BYTE kbd[256];
GetKeyboardState(kbd);
const int BUFFER_LENGTH = 8; //Length of the buffer
WCHAR chars[BUFFER_LENGTH];
ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0);
tmpChar.SetUtf8((char*)chars);
}
break;
}
EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam);
if (tmpChar == 0) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown);
} else {
OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown);
}
}
return 0;
/* **************************************************************************
* Mouse management
* **************************************************************************/
case WM_LBUTTONUP:
buttonIsDown = false;
case WM_LBUTTONDOWN:
mouseButtonId = 1;
pos.setValue(GET_X_LPARAM(_lParam),
m_currentHeight-GET_Y_LPARAM(_lParam));
inputIsPressed[mouseButtonId] = buttonIsDown;
OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0;
case WM_MBUTTONUP:
buttonIsDown = false;
case WM_MBUTTONDOWN:
mouseButtonId = 2;
pos.setValue(GET_X_LPARAM(_lParam),
m_currentHeight-GET_Y_LPARAM(_lParam));
inputIsPressed[mouseButtonId] = buttonIsDown;
OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0;
case WM_RBUTTONUP:
buttonIsDown = false;
case WM_RBUTTONDOWN:
mouseButtonId = 3;
pos.setValue(GET_X_LPARAM(_lParam),
m_currentHeight-GET_Y_LPARAM(_lParam));
inputIsPressed[mouseButtonId] = buttonIsDown;
OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0;
case WM_MOUSEWHEEL:
if (wParam & 0x200000) {
EWOL_DEBUG("event SCROOL UP");
mouseButtonId = 4;
} else{
EWOL_DEBUG("event SCROOL DOWN");
mouseButtonId = 5;
}
pos.setValue(GET_X_LPARAM(_lParam),
m_currentHeight-GET_Y_LPARAM(_lParam));
OS_SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y());
OS_SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y());
return 0;
case WM_MOUSEHOVER:
case WM_MOUSEMOVE:
pos.setValue(GET_X_LPARAM(_lParam),
m_currentHeight-GET_Y_LPARAM(_lParam));
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
if (true == inputIsPressed[iii]) {
EWOL_VERBOSE("Windows event: bt=" << iii << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
OS_SetMouseMotion(iii, (float)pos.x(), (float)pos.y());
return 0;
}
}
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
OS_SetMouseMotion(0, (float)pos.x(), (float)pos.y());
return 0;
default:
EWOL_DEBUG("event ..." << message );
return DefWindowProc( _hWnd, _message, _wParam, _lParam );
}
}
}
void guiInterface::SetIcon(etk::UString inputFile)
{
// TODO : ...
}
#include <windows.h>
#include <windowsx.h>
// Function Declarations
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC);
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC);
int Windows_Run(void);
/**
* @brief Main of the program
* @param std IO
* @return std IO
*/
int guiInterface::main(int argc, const char *argv[])
int ewol::Run(int _argc, const char *_argv[])
{
GLenum err = glewInit();
if (GLEW_OK != err)
{
if (GLEW_OK != err) {
/* Problem: glewInit failed, something is seriously wrong. */
EWOL_ERROR("Error:" << glewGetErrorString(err));
}
@ -180,373 +481,15 @@ int guiInterface::main(int argc, const char *argv[])
EWOL_ERROR("OpenGL 2.0 not available");
//return 1;
}
for (int32_t iii=0; iii<NB_MAX_INPUT; iii++) {
inputIsPressed[iii] = false;
}
//start the basic thread :
eSystem::Init();
// Run ...
Windows_Run();
// close windows system :
guiInterface::Stop();
// uninit ALL :
eSystem::UnInit();
return 0;
}
// WinMain
int Windows_Run(void)
{
HINSTANCE hInstance = 0;
WNDCLASS wc;
HWND hWnd;
HDC hDC;
HGLRC hRC;
MSG msg;
// register window class
wc.style = CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = "EwolMainWindows";
RegisterClass( &wc );
// create main window
hWnd = CreateWindow( "EwolMainWindows", "Ewol ... TODO Title",
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX,
0, 0, 800, 600,
NULL, NULL, hInstance, NULL );
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
m_currentHeight = 600-2*border_thickness -title_size;
eSystem::Resize(800-2*border_thickness, m_currentHeight);
// enable OpenGL for the window
EnableOpenGL( hWnd, &hDC, &hRC );
// program main loop
while(true == m_run) {
// check for messages
if ( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) {
// handle or dispatch messages
if ( msg.message == WM_QUIT ) {
m_run = false;
} else {
TranslateMessage( &msg );
DispatchMessage( &msg );
}
} else {
(void)eSystem::Draw(true);
SwapBuffers( hDC );
}
}
// shutdown OpenGL
DisableOpenGL( hWnd, hDC, hRC );
// destroy the window explicitly
DestroyWindow( hWnd );
return msg.wParam;
}
// Window Procedure
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
bool buttonIsDown = true;
int32_t mouseButtonId = 0;
ivec2 pos;
// to know all message : http://wiki.winehq.org/List_Of_Windows_Messages
switch (message)
{
/* **************************************************************************
* Gui event
* **************************************************************************/
case WM_CREATE:
EWOL_DEBUG("WM_CREATE");
return 0;
case WM_CLOSE:
EWOL_DEBUG("WM_CLOSE");
PostQuitMessage( 0 );
return 0;
case WM_DESTROY:
EWOL_DEBUG("WM_DESTROY");
return 0;
case WM_MOVE:
EWOL_DEBUG("WM_MOVE");
return 0;
case WM_SIZE:
EWOL_DEBUG("WM_SIZE");
return 0;
/*
case WM_GETMINMAXINFO:
{
MINMAXINFO* tmpVal = (MINMAXINFO*)lParam;
EWOL_DEBUG("WM_GETMINMAXINFO : ");
EWOL_DEBUG(" ptMaxSize : " << tmpVal->ptMaxSize.x << "," << tmpVal->ptMaxSize.y << ")");
EWOL_DEBUG(" ptMaxPosition : " << tmpVal->ptMaxPosition.x << "," << tmpVal->ptMaxPosition.y << ")");
EWOL_DEBUG(" ptMinTrackSize : " << tmpVal->ptMinTrackSize.x << "," << tmpVal->ptMinTrackSize.y << ")");
EWOL_DEBUG(" ptMaxTrackSize : " << tmpVal->ptMaxTrackSize.x << "," << tmpVal->ptMaxTrackSize.y << ")");
}
return 0;
*/
case WM_WINDOWPOSCHANGING:
{
WINDOWPOS* tmpVal = (WINDOWPOS*)lParam;
if (NULL != tmpVal) {
//EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")");
// in windows system, we need to remove the size of the border elements :
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
m_currentHeight = tmpVal->cy - 2*border_thickness - title_size;
eSystem::Resize(tmpVal->cx-2*border_thickness, m_currentHeight);
}
}
return 0;
// these message are not parse by us ...
case WM_SETCURSOR: // Call the windows if we want the mouse event :
case WM_NCHITTEST: // inform the application the position of the mouse is moving
return DefWindowProc( hWnd, message, wParam, lParam );
/* **************************************************************************
* Keyboard management
* **************************************************************************/
case WM_KEYUP:
buttonIsDown = false;
case WM_KEYDOWN:
{
etk::UniChar tmpChar = 0;
ewol::keyEvent::keyboard_te keyInput;
switch (wParam) {
//case 80: // keypad
case VK_UP: keyInput = ewol::keyEvent::keyboardUp; break;
//case 83: // keypad
case VK_LEFT: keyInput = ewol::keyEvent::keyboardLeft; break;
//case 85: // keypad
case VK_RIGHT: keyInput = ewol::keyEvent::keyboardRight; break;
//case 88: // keypad
case VK_DOWN: keyInput = ewol::keyEvent::keyboardDown; break;
//case 81: // keypad
case VK_PRIOR: keyInput = ewol::keyEvent::keyboardPageUp; break;
//case 89: // keypad
case VK_NEXT: keyInput = ewol::keyEvent::keyboardPageDown; break;
//case 79: // keypad
case VK_HOME: keyInput = ewol::keyEvent::keyboardStart; break;
//case 87: // keypad
case VK_END: keyInput = ewol::keyEvent::keyboardEnd; break;
//case VK_: keyInput = ewol::keyEvent::keyboardStopDefil; break;
case VK_PAUSE: keyInput = ewol::keyEvent::keyboardWait; break;
//case 90: // keypad
case VK_INSERT:
keyInput = ewol::keyEvent::keyboardInsert;
guiKeyBoardMode.insert = buttonIsDown;
break;
case VK_F1: keyInput = ewol::keyEvent::keyboardF1; break;
case VK_F2: keyInput = ewol::keyEvent::keyboardF2; break;
case VK_F3: keyInput = ewol::keyEvent::keyboardF3; break;
case VK_F4: keyInput = ewol::keyEvent::keyboardF4; break;
case VK_F5: keyInput = ewol::keyEvent::keyboardF5; break;
case VK_F6: keyInput = ewol::keyEvent::keyboardF6; break;
case VK_F7: keyInput = ewol::keyEvent::keyboardF7; break;
case VK_F8: keyInput = ewol::keyEvent::keyboardF8; break;
case VK_F9: keyInput = ewol::keyEvent::keyboardF9; break;
case VK_F10: keyInput = ewol::keyEvent::keyboardF10; break;
case VK_F11: keyInput = ewol::keyEvent::keyboardF11; break;
case VK_F12:
case VK_F13:
case VK_F14:
case VK_F15:
case VK_F16:
case VK_F17:
case VK_F18:
case VK_F19:
case VK_F20:
case VK_F21:
case VK_F22:
case VK_F23:
case VK_F24: keyInput = ewol::keyEvent::keyboardF12; break;
case VK_CAPITAL: keyInput = ewol::keyEvent::keyboardCapLock; guiKeyBoardMode.capLock = buttonIsDown; break;
case VK_SHIFT:
case VK_LSHIFT: keyInput = ewol::keyEvent::keyboardShiftLeft; guiKeyBoardMode.shift = buttonIsDown; break;
case VK_RSHIFT: keyInput = ewol::keyEvent::keyboardShiftRight; guiKeyBoardMode.shift = buttonIsDown; break;
case VK_CONTROL:
case VK_LCONTROL: keyInput = ewol::keyEvent::keyboardCtrlLeft; guiKeyBoardMode.ctrl = buttonIsDown; break;
case VK_RCONTROL: keyInput = ewol::keyEvent::keyboardCtrlRight; guiKeyBoardMode.ctrl = buttonIsDown; break;
case VK_LWIN: keyInput = ewol::keyEvent::keyboardMetaLeft; guiKeyBoardMode.meta = buttonIsDown; break;
case VK_RWIN: keyInput = ewol::keyEvent::keyboardMetaRight; guiKeyBoardMode.meta = buttonIsDown; break;
case VK_MENU:
case VK_LMENU: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = buttonIsDown; break;
case VK_RMENU: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = buttonIsDown; break;
//case : keyInput = ewol::keyEvent::keyboardContextMenu; break;
case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break;
case VK_BACK: // DEL
tmpChar.Set(0x08);
break;
// TODO : Really strang, need to understand why ...
case 46: // Suppr
tmpChar.Set(0x7F);
break;
case VK_TAB: // special case for TAB
tmpChar.Set(0x09);
break;
case VK_RETURN: // special case for TAB
tmpChar = '\n';
break;
default:
{
BYTE kbd[256];
GetKeyboardState(kbd);
const int BUFFER_LENGTH = 8; //Length of the buffer
WCHAR chars[BUFFER_LENGTH];
ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0);
tmpChar.SetUtf8((char*)chars);
}
break;
}
EWOL_DEBUG("kjhkjhkjhkjhkj = " << wParam);
if (tmpChar == 0) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
eSystem::SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown);
} else {
eSystem::SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown);
}
}
return 0;
/* **************************************************************************
* Mouse management
* **************************************************************************/
case WM_LBUTTONUP:
buttonIsDown = false;
case WM_LBUTTONDOWN:
mouseButtonId = 1;
pos.setValue(GET_X_LPARAM(lParam),
m_currentHeight-GET_Y_LPARAM(lParam));
inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0;
case WM_MBUTTONUP:
buttonIsDown = false;
case WM_MBUTTONDOWN:
mouseButtonId = 2;
pos.setValue(GET_X_LPARAM(lParam),
m_currentHeight-GET_Y_LPARAM(lParam));
inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0;
case WM_RBUTTONUP:
buttonIsDown = false;
case WM_RBUTTONDOWN:
mouseButtonId = 3;
pos.setValue(GET_X_LPARAM(lParam),
m_currentHeight-GET_Y_LPARAM(lParam));
inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0;
case WM_MOUSEWHEEL:
if (wParam & 0x200000) {
EWOL_DEBUG("event SCROOL UP");
mouseButtonId = 4;
} else{
EWOL_DEBUG("event SCROOL DOWN");
mouseButtonId = 5;
}
pos.setValue(GET_X_LPARAM(lParam),
m_currentHeight-GET_Y_LPARAM(lParam));
eSystem::SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y());
eSystem::SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y());
return 0;
case WM_MOUSEHOVER:
case WM_MOUSEMOVE:
pos.setValue(GET_X_LPARAM(lParam),
m_currentHeight-GET_Y_LPARAM(lParam));
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
if (true == inputIsPressed[iii]) {
EWOL_VERBOSE("Windows event: bt=" << iii << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
eSystem::SetMouseMotion(iii, (float)pos.x(), (float)pos.y());
return 0;
}
}
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
eSystem::SetMouseMotion(0, (float)pos.x(), (float)pos.y());
return 0;
default:
EWOL_DEBUG("event ..." << message );
return DefWindowProc( hWnd, message, wParam, lParam );
WindowsContext* interface = new WindowsContext(_argc, _argv);
if (NULL == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return -2;
}
int32_t retValue = interface->Run();
delete(interface);
interface = NULL;
return retValue;
}
// Enable OpenGL
void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
{
PIXELFORMATDESCRIPTOR pfd;
int format;
// get the device context (DC)
*hDC = GetDC( hWnd );
// set the pixel format for the DC
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
format = ChoosePixelFormat( *hDC, &pfd );
SetPixelFormat( *hDC, format, &pfd );
// create and enable the render context (RC)
*hRC = wglCreateContext( *hDC );
wglMakeCurrent( *hDC, *hRC );
}
// Disable OpenGL
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( hRC );
ReleaseDC( hWnd, hDC );
}
void guiInterface::ForceOrientation(ewol::orientation_te orientation)
{
// nothing to do ...
}
void guiInterface::GrabPointerEvents(bool isGrabbed, vec2 forcedPosition)
{
// nothing to do ...
}
void guiInterface::SetCursor(ewol::cursorDisplay_te newCursor)
{
// nothing to do ...
}

View File

@ -15,8 +15,8 @@
#include <etk/unicode.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/renderer/eContext.h>
#include <ewol/Dimension.h>
#include <unistd.h>
@ -50,7 +50,7 @@ bool hasDisplay = false;
#define X11_INFO EWOL_VERBOSE
#define X11_CRITICAL EWOL_VERBOSE
#endif
int64_t ewol::eSystem::GetTime(void)
int64_t ewol::GetTime(void)
{
struct timespec now;
int ret = clock_gettime(CLOCK_REALTIME, &now);
@ -102,7 +102,7 @@ extern "C" {
#undef __class__
#define __class__ "x11Interface"
class X11Interface : public ewol::eSystem
class X11Interface : public ewol::eContext
{
private:
ewol::SpecialKey m_guiKeyBoardMode;
@ -139,7 +139,8 @@ class X11Interface : public ewol::eSystem
Atom XAtomeDeleteWindows;
ewol::cursorDisplay_te m_currentCursor; //!< select the current cursor to display :
public:
X11Interface(void) :
X11Interface(int32_t _argc, const char* _argv[]) :
ewol::eContext(_argc, _argv),
m_display(NULL),
m_originX(0),
m_originY(0),
@ -210,7 +211,7 @@ class X11Interface : public ewol::eSystem
X11_INFO("Receive : ClientMessage");
if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) {
EWOL_INFO(" ==> Kill Requested ...");
eSystem::OS_Stop();
OS_Stop();
m_run = false;
}
}
@ -1195,11 +1196,11 @@ class X11Interface : public ewol::eSystem
return true;
}
/****************************************************************************************/
void SetTitle(etk::UString& title)
void SetTitle(const etk::UString& _title)
{
X11_INFO("X11: Set Title (START)");
XTextProperty tp;
etk::Char tmpChar = title.c_str();
etk::Char tmpChar = _title.c_str();
tp.value = (unsigned char *)((const char*)tmpChar);
tp.encoding = XA_WM_NAME;
tp.format = 8;
@ -1282,13 +1283,14 @@ class X11Interface : public ewol::eSystem
* @param std IO
* @return std IO
*/
int ewol::eSystem::main(int _argc, const char *_argv[])
int ewol::Run(int _argc, const char *_argv[])
{
X11Interface* interface = new X11Interface();
X11Interface* interface = new X11Interface(_argc, _argv);
if (NULL == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
return -2;
}
int32_t retValue = interface->Run();
delete(interface);
interface = NULL;

View File

@ -103,13 +103,13 @@ void ewol::eContext::ProcessEvents(void)
/*bool returnVal = */APP_Init(*this);
break;
case THREAD_RECALCULATE_SIZE:
eSystem::ForceRedrawAll();
ForceRedrawAll();
break;
case THREAD_RESIZE:
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
m_windowsSize = data.dimention;
ewol::dimension::SetPixelWindowsSize(m_windowsSize);
eSystem::ForceRedrawAll();
ForceRedrawAll();
break;
case THREAD_INPUT_MOTION:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
@ -220,9 +220,9 @@ void ewol::eContext::SetArchiveDir(int mode, const char* str)
ewol::eContext::eSystem(void) :
ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
m_previousDisplayTime(0),
m_managementInput(*this),
m_input(*this),
m_FpsSystemEvent( "Event ", false),
m_FpsSystemContext("Context ", false),
m_FpsSystem( "Draw ", true),
@ -230,9 +230,35 @@ ewol::eContext::eSystem(void) :
m_windowsCurrent(NULL),
m_windowsSize(320,480)
{
m_commandLine.Parse(_argc, _argv);
EWOL_INFO("==> Ewol System Init (BEGIN)");
// set the curent interface :
SetSystem();
LockContext();
// parse the debug level:
for(esize_t iii=m_commandLine.Size()-1 ; iii>=0 ; --iii) {
if (m_commandLine.Get(iii) == "-l0") {
GeneralDebugSetLevel(etk::LOG_LEVEL_NONE);
} else if (m_commandLine.Get(iii) == "-l1") {
GeneralDebugSetLevel(etk::LOG_LEVEL_CRITICAL);
} else if (m_commandLine.Get(iii) == "-l2") {
GeneralDebugSetLevel(etk::LOG_LEVEL_ERROR);
} else if (m_commandLine.Get(iii) == "-l3") {
GeneralDebugSetLevel(etk::LOG_LEVEL_WARNING);
} else if (m_commandLine.Get(iii) == "-l4") {
GeneralDebugSetLevel(etk::LOG_LEVEL_INFO);
} else if (m_commandLine.Get(iii) == "-l5") {
GeneralDebugSetLevel(etk::LOG_LEVEL_DEBUG);
} else if( m_commandLine.Get(iii) == "-l6"
|| m_commandLine.Get(iii) == "-l7"
|| m_commandLine.Get(iii) == "-l8"
|| m_commandLine.Get(iii) == "-l9") {
GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE);
} else {
continue;
}
m_commandLine.Remove(iii);
}
EWOL_INFO("v:" << ewol::GetVersion());
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute());
// TODO : Remove this ...
@ -253,15 +279,15 @@ ewol::eContext::eSystem(void) :
ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
#endif
// release the curent interface :
ReleaseSystem();
UnLockContext();
EWOL_INFO("==> Ewol System Init (END)");
}
ewol::eContext::~eSystem(void)
ewol::eContext::~eContext(void)
{
EWOL_INFO("==> Ewol System Un-Init (BEGIN)");
// set the curent interface :
SetSystem();
LockContext();
// call application to uninit
APP_UnInit(*this);
if (NULL!=m_windowsCurrent) {
@ -271,7 +297,7 @@ ewol::eContext::~eSystem(void)
m_windowsCurrent = NULL;
m_msgSystem.Clean();
// release the curent interface :
ReleaseSystem();
UnLockContext();
EWOL_INFO("==> Ewol System Un-Init (END)");
}
@ -419,7 +445,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
//! Event management section ...
{
// set the curent interface :
SetSystem();
LockContext();
ProcessEvents();
// call all the widget that neded to do something periodicly
//! ewol::widgetManager::PeriodicCall(currentTime);
@ -437,7 +463,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
//! bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
needRedraw = m_widgetManager.IsDrawingNeeded();
// release the curent interface :
ReleaseSystem();
UnLockContext();
}
bool hasDisplayDone = false;
//! Drawing section :
@ -480,7 +506,7 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
}
/*
void ewol::eSystem::OnObjectRemove(ewol::EObject * removeObject)
void ewol::eContext::OnObjectRemove(ewol::EObject * removeObject)
{
m_managementInput.OnObjectRemove(removeObject);
}
@ -500,8 +526,13 @@ void ewol::eContext::OS_OpenGlContextDestroy(void)
void ewol::eContext::SetWindows(ewol::Windows* _windows)
{
// Remove current Focus :
m_widgetManager.FocusSetDefault(NULL);
m_widgetManager.FocusRelease();
// set the new pointer as windows system
m_windowsCurrent = _windows;
// Set the new default Focus :
m_widgetManager.FocusSetDefault(_windows);
// request all the widget redrawing
ForceRedrawAll();
}

View File

@ -21,6 +21,7 @@
#include <ewol/renderer/ConfigFont.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/commandLine.h>
// TODO : Remove this from here ...
@ -76,8 +77,18 @@ class eSystemMessage {
namespace ewol
{
typedef enum {
SCREEN_ORIENTATION_AUTO = 0,
SCREEN_ORIENTATION_LANDSCAPE,
SCREEN_ORIENTATION_PORTRAIT,
} orientation_te;
class eContext
{
private:
ewol::CommandLine m_commandLine; //!< Start command line information
public:
ewol::CommandLine& GetCmd(void) { return m_commandLine; };
private:
ewol::ConfigFont m_configFont; //!< global font configuration
public:
@ -95,7 +106,7 @@ namespace ewol
public:
ewol::ResourceManager& GetResourcesManager(void) { return m_resourceManager; };
public:
eContext(void);
eContext(int32_t _argc=0, const char* _argv[]=NULL);
virtual ~eContext(void);
protected:
/**
@ -277,7 +288,7 @@ namespace ewol
* @brief Set the new title of the windows
* @param[in] title New desired title
*/
virtual void SetTitle(etk::UString& _title) { };
virtual void SetTitle(const etk::UString& _title) { };
/**
* @brief Force the screen orientation (availlable on portable elements ...
* @param[in] _orientation Selected orientation.
@ -332,8 +343,8 @@ namespace ewol
//!< must be define in CPP by the application ... this are the main init and unInit of the Application
// return false if an error occured
bool APP_Init(ewol::eSystem& _system);
void APP_UnInit(ewol::eSystem& _system);
bool APP_Init(ewol::eContext& _context);
void APP_UnInit(ewol::eContext& _context);
#endif

View File

@ -15,9 +15,9 @@
#include <ewol/renderer/EObject.h>
#include <ewol/renderer/EObjectManager.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/eSystemInput.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/eContext.h>
#include <ewol/renderer/eInput.h>
#include <ewol/resources/Texture.h>
#include <ewol/widget/Widget.h>
#include <ewol/widget/Windows.h>

View File

@ -76,7 +76,7 @@ namespace ewol
ewol::Widget* destWidget,
int32_t realInputId);
private:
ewol::eContext& m_system;
ewol::eContext& m_context;
public:
eInput(ewol::eContext& _context);
~eInput(void);

View File

@ -21,7 +21,7 @@ ewol::Colored3DObject::Colored3DObject(etk::UString _genName) :
etk::UString tmpString("DATA:simple3D.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::ResourceManager::Keep(tmpString, m_GLprogram) ) {
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetUniform("EW_color");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
@ -31,7 +31,7 @@ ewol::Colored3DObject::Colored3DObject(etk::UString _genName) :
ewol::Colored3DObject::~Colored3DObject(void)
{
// remove dynamics dependencies :
ewol::ResourceManager::Release(m_GLprogram);
ewol::resource::Release(m_GLprogram);
}

View File

@ -33,7 +33,7 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
//EWOL_DEBUG(m_name << " " << m_light);
if (true == ewol::ResourceManager::Keep(_shaderName, m_GLprogram) ) {
if (true == ewol::resource::Keep(_shaderName, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
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");
}
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
ewol::ResourceManager::Keep("w-fff", m_verticesVBO);
ewol::resource::Keep("w-fff", m_verticesVBO);
// load the curent file :
etk::UString tmpName = _fileName.ToLower();
@ -68,8 +68,8 @@ ewol::Mesh::Mesh(const etk::UString& _fileName, const etk::UString& _shaderName)
ewol::Mesh::~Mesh(void)
{
// remove dynamics dependencies :
ewol::ResourceManager::Release(m_GLprogram);
ewol::ResourceManager::Release(m_verticesVBO);
ewol::resource::Release(m_GLprogram);
ewol::resource::Release(m_verticesVBO);
if (m_functionFreeShape!=NULL) {
m_functionFreeShape(m_pointerShape);
m_pointerShape = NULL;

View File

@ -18,7 +18,7 @@
#include <ewol/resources/VirtualBufferObject.h>
#include <ewol/Light.h>
#include <ewol/Material.h>
#include <ewol/resources/physicsShape/PhysicsShape.h>
#include <ewol/physicsShape/PhysicsShape.h>
// 3 "float" elements
#define MESH_VBO_VERTICES (0)
// 2 "float" elements

View File

@ -37,14 +37,14 @@ ewol::Program::Program(const etk::UString& filename) :
// remove extention ...
tmpFilename.Remove(tmpFilename.Size()-4, 4);
ewol::Shader* tmpShader = NULL;
if (false == ewol::ResourceManager::Keep(tmpFilename+"vert", tmpShader)) {
if (false == ewol::resource::Keep(tmpFilename+"vert", tmpShader)) {
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
return;
} else {
EWOL_DEBUG("Add shader on program : "<< tmpFilename << "vert");
m_shaderList.PushBack(tmpShader);
}
if (false == ewol::ResourceManager::Keep(tmpFilename+"frag", tmpShader)) {
if (false == ewol::resource::Keep(tmpFilename+"frag", tmpShader)) {
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
return;
} else {
@ -81,7 +81,7 @@ ewol::Program::Program(const etk::UString& filename) :
// get it with relative position :
etk::UString tmpFilename = file.GetRelativeFolder() + tmpData;
ewol::Shader* tmpShader = NULL;
if (false == ewol::ResourceManager::Keep(tmpFilename, tmpShader)) {
if (false == ewol::resource::Keep(tmpFilename, tmpShader)) {
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
} else {
EWOL_DEBUG("Add shader on program : "<< tmpFilename);
@ -99,7 +99,7 @@ ewol::Program::Program(const etk::UString& filename) :
ewol::Program::~Program(void)
{
for (int32_t iii=0; iii<m_shaderList.Size(); iii++) {
ewol::ResourceManager::Release(m_shaderList[iii]);
ewol::resource::Release(m_shaderList[iii]);
m_shaderList[iii] = 0;
}
m_shaderList.Clear();

View File

@ -179,10 +179,10 @@ void ewol::ResourceManager::LocalAdd(ewol::Resource* object)
}
// return the type of the resource ...
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
{
EWOL_VERBOSE("KEEP : TexturedFont : file : \"" << filename << "\"");
object = static_cast<ewol::TexturedFont*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
object = static_cast<ewol::TexturedFont*>(ewol::GetContext().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -192,15 +192,15 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::TexturedFon
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
ewol::GetContext().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::FontBase*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object)
{
EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\"");
object = static_cast<ewol::FontBase*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
object = static_cast<ewol::FontBase*>(ewol::GetContext().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -210,14 +210,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::FontBase*&
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
ewol::GetContext().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Program*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object)
{
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
object = static_cast<ewol::Program*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
object = static_cast<ewol::Program*>(ewol::GetContext().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -227,14 +227,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Program*& o
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
ewol::GetContext().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Shader*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object)
{
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << filename << "\"");
object = static_cast<ewol::Shader*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
object = static_cast<ewol::Shader*>(ewol::GetContext().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -244,11 +244,11 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::Shader*& ob
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
ewol::GetContext().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::ResourceManager::Keep(ewol::Texture*& object)
bool ewol::resource::Keep(ewol::Texture*& object)
{
// this element create a new one every time ....
object = new ewol::Texture("");
@ -256,15 +256,15 @@ bool ewol::ResourceManager::Keep(ewol::Texture*& object)
EWOL_ERROR("allocation error of a resource : ??TEX??");
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
ewol::GetContext().GetResourcesManager().LocalAdd(object);
return true;
}
bool ewol::ResourceManager::Keep(ewol::Colored3DObject*& _object)
bool ewol::resource::Keep(ewol::Colored3DObject*& _object)
{
EWOL_VERBOSE("KEEP : direct Colored3DObject");
etk::UString filename = "?metaObject?Colored3DObject";
_object = static_cast<ewol::Colored3DObject*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
_object = static_cast<ewol::Colored3DObject*>(ewol::GetContext().GetResourcesManager().LocalKeep(filename));
if (NULL != _object) {
return true;
}
@ -274,7 +274,7 @@ bool ewol::ResourceManager::Keep(ewol::Colored3DObject*& _object)
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
ewol::GetContext().GetResourcesManager().LocalAdd(_object);
return true;
}
#ifdef __TARGET_OS__Android
@ -297,7 +297,7 @@ static int32_t nextP2(int32_t _value)
}
#endif
bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
bool ewol::resource::Keep(const etk::UString& _filename, ewol::TextureFile*& _object, ivec2 _size)
{
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
if (_filename == "") {
@ -306,7 +306,7 @@ bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFil
EWOL_ERROR("allocation error of a resource : ??TEX??");
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
ewol::GetContext().GetResourcesManager().LocalAdd(_object);
return true;
}
if (_size.x()==0) {
@ -337,7 +337,7 @@ bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFil
}
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
_object = static_cast<ewol::TextureFile*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(TmpFilename));
_object = static_cast<ewol::TextureFile*>(ewol::GetContext().GetResourcesManager().LocalKeep(TmpFilename));
if (NULL != _object) {
return true;
}
@ -348,14 +348,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& _filename, ewol::TextureFil
EWOL_ERROR("allocation error of a resource : " << _filename);
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
ewol::GetContext().GetResourcesManager().LocalAdd(_object);
return true;
}
bool ewol::ResourceManager::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
bool ewol::resource::Keep(const etk::UString& _meshName, ewol::Mesh*& _object)
{
_object = static_cast<ewol::Mesh*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(_meshName));
_object = static_cast<ewol::Mesh*>(ewol::GetContext().GetResourcesManager().LocalKeep(_meshName));
if (NULL != _object) {
return true;
}
@ -364,12 +364,12 @@ bool ewol::ResourceManager::Keep(const etk::UString& _meshName, ewol::Mesh*& _ob
EWOL_ERROR("allocation error of a resource : ??Mesh??" << _meshName);
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
ewol::GetContext().GetResourcesManager().LocalAdd(_object);
return true;
}
bool ewol::ResourceManager::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object)
bool ewol::resource::Keep(const etk::UString& _accesMode, ewol::VirtualBufferObject*& _object)
{
// this element create a new one every time ....
_object = new ewol::VirtualBufferObject(_accesMode);
@ -377,14 +377,14 @@ bool ewol::ResourceManager::Keep(const etk::UString& _accesMode, ewol::VirtualBu
EWOL_ERROR("allocation error of a resource : ??VBO??");
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(_object);
ewol::GetContext().GetResourcesManager().LocalAdd(_object);
return true;
}
bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
{
EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\"");
object = static_cast<ewol::ConfigFile*>(ewol::eSystem::GetSystem().GetResourcesManager().LocalKeep(filename));
object = static_cast<ewol::ConfigFile*>(ewol::GetContext().GetResourcesManager().LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -394,7 +394,7 @@ bool ewol::ResourceManager::Keep(const etk::UString& filename, ewol::ConfigFile*
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
return false;
}
ewol::eSystem::GetSystem().GetResourcesManager().LocalAdd(object);
ewol::GetContext().GetResourcesManager().LocalAdd(object);
return true;
}
@ -434,68 +434,68 @@ void ewol::ResourceManager::Release(ewol::Resource*& object)
}
void ewol::ResourceManager::Release(ewol::TexturedFont*& object)
void ewol::resource::Release(ewol::TexturedFont*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::FontBase*& object)
void ewol::resource::Release(ewol::FontBase*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::Program*& object)
void ewol::resource::Release(ewol::Program*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::Shader*& object)
void ewol::resource::Release(ewol::Shader*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::Texture*& object)
void ewol::resource::Release(ewol::Texture*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::TextureFile*& object)
void ewol::resource::Release(ewol::TextureFile*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
//EWOL_INFO("RELEASE : TextureFile : nb=" << object2->GetCounter());
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::Mesh*& object)
void ewol::resource::Release(ewol::Mesh*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::ConfigFile*& object)
void ewol::resource::Release(ewol::ConfigFile*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::Colored3DObject*& object)
void ewol::resource::Release(ewol::Colored3DObject*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}
void ewol::ResourceManager::Release(ewol::VirtualBufferObject*& object)
void ewol::resource::Release(ewol::VirtualBufferObject*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
ewol::eSystem::GetSystem().GetResourcesManager().Release(object2);
ewol::GetContext().GetResourcesManager().Release(object2);
object = NULL;
}

View File

@ -62,63 +62,71 @@ namespace ewol
* @brief This is to inform the resources manager that we have no more openGl context ...
*/
void ContextHasBeenDestroyed(void);
private:
public:
// internal API to extent eResources in extern Soft
ewol::Resource* LocalKeep(const etk::UString& filename);
void LocalAdd(ewol::Resource* object);
public:
/**
* @brief Load the specify resources type
* @param[in] filename The filename of the resources
* @param[in,out] object The resources that might be instanciate.
* @return true if the resource has been loaded corectly.
* @return false An error occured ...
* @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...
*/
static bool Keep(const etk::UString& filename, ewol::TexturedFont*& object);
static bool Keep(const etk::UString& filename, ewol::FontBase*& object);
static bool Keep(const etk::UString& filename, ewol::Program*& object);
static bool Keep(const etk::UString& filename, ewol::Shader*& object);
static bool Keep(ewol::Texture*& object); // no name needed here ...
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);
static bool Keep(const etk::UString& meshName, ewol::Mesh*& object);
static bool Keep(const etk::UString& filename, ewol::ConfigFile*& object);
static bool Keep(ewol::Colored3DObject*& object);
// must became :
/*
ewol::Font* KeepFont(const etk::UString& _filename);
ewol::Program* KeepProgram(const etk::UString& _filename);
ewol::Shader* KeepShader(const etk::UString& _filename);
ewol::Texture* KeepTexture(void);
ewol::Texture* KeepTexture(const etk::UString& _filename, const ivec2& size=ivec2(-1,-1));
void AddTextureResourceCreator(pf* _plop, const etk::UString& _ext);
ewol::Audio* KeepAudio(const etk::UString& _filename, bool _inRam=false);
void AddAudioResourceCreator(pf* _plop, const etk::UString& _ext);
ewol::VirtualBufferObject* KeepVBO(const etk::UString& _accesMode);
ewol::Mesh* KeepMesh(const etk::UString& _filename);
ewol::ConfigFile* KeepConfigFile(const etk::UString& _filename);
ewol::Colored3DObject* Keep3DObject(void);
void Release(ewol::Resource*& object);
*/
/**
* @brief Release a resources and free it if the Last release is call.
* @param[in,out] object element to realease ==> is return at NULL value.
*/
void Release(ewol::Resource*& object);
static void Release(ewol::TexturedFont*& object);
static void Release(ewol::FontBase*& object);
static void Release(ewol::Program*& 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);
};
namespace resource
{
/**
* @brief Load the specify resources type
* @param[in] filename The filename of the resources
* @param[in,out] object The resources that might be instanciate.
* @return true if the resource has been loaded corectly.
* @return false An error occured ...
* @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...
*/
bool Keep(const etk::UString& filename, ewol::TexturedFont*& object);
bool Keep(const etk::UString& filename, ewol::FontBase*& object);
bool Keep(const etk::UString& filename, ewol::Program*& object);
bool Keep(const etk::UString& filename, ewol::Shader*& object);
bool Keep(ewol::Texture*& object); // no name needed here ...
bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size=ivec2(-1,-1));
bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object);
bool Keep(const etk::UString& meshName, ewol::Mesh*& object);
bool Keep(const etk::UString& filename, ewol::ConfigFile*& object);
bool Keep(ewol::Colored3DObject*& object);
// must became :
/*
ewol::Font* KeepFont(const etk::UString& _filename);
ewol::Program* KeepProgram(const etk::UString& _filename);
ewol::Shader* KeepShader(const etk::UString& _filename);
ewol::Texture* KeepTexture(void);
ewol::Texture* KeepTexture(const etk::UString& _filename, const ivec2& size=ivec2(-1,-1));
void AddTextureResourceCreator(pf* _plop, const etk::UString& _ext);
ewol::Audio* KeepAudio(const etk::UString& _filename, bool _inRam=false);
void AddAudioResourceCreator(pf* _plop, const etk::UString& _ext);
ewol::VirtualBufferObject* KeepVBO(const etk::UString& _accesMode);
ewol::Mesh* KeepMesh(const etk::UString& _filename);
ewol::ConfigFile* KeepConfigFile(const etk::UString& _filename);
ewol::Colored3DObject* Keep3DObject(void);
void Release(ewol::Resource*& object);
*/
/**
* @brief Release a resources and free it if the Last release is call.
* @param[in,out] object element to realease ==> is return at NULL value.
*/
void Release(ewol::Resource*& object);
void Release(ewol::TexturedFont*& object);
void Release(ewol::FontBase*& object);
void Release(ewol::Program*& object);
void Release(ewol::Shader*& object);
void Release(ewol::Texture*& object);
void Release(ewol::TextureFile*& object);
void Release(ewol::VirtualBufferObject*& object);
void Release(ewol::Mesh*& object);
void Release(ewol::ConfigFile*& object);
void Release(ewol::Colored3DObject*& object);
};
};

View File

@ -11,6 +11,7 @@
#include <ewol/renderer/openGL.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/resources/Texture.h>
#include <ewol/renderer/eContext.h>
#undef __class__
#define __class__ "Texture"
@ -104,7 +105,7 @@ void ewol::Texture::RemoveContextToLate(void)
void ewol::Texture::Flush(void)
{
// request to the manager to be call at the next update ...
ewol::resource::Update(this);
ewol::GetContext().GetResourcesManager().Update(this);
}

View File

@ -112,14 +112,14 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
m_size = tmpSize;
etk::Vector<etk::UString> folderList;
if (true==ewol::eSystem::GetSystem().GetFontDefault().GetUseExternal()) {
if (true==ewol::GetContext().GetFontDefault().GetUseExternal()) {
#if defined(__TARGET_OS__Android)
folderList.PushBack("/system/fonts");
#elif defined(__TARGET_OS__Linux)
folderList.PushBack("/usr/share/fonts/truetype");
#endif
}
folderList.PushBack(ewol::eSystem::GetSystem().GetFontDefault().GetFolder());
folderList.PushBack(ewol::GetContext().GetFontDefault().GetFolder());
for (int32_t folderID=0; folderID<folderList.Size() ; folderID++) {
etk::FSNode myFolder(folderList[folderID]);
// find the real Font name :

View File

@ -10,6 +10,7 @@
#include <ewol/debug.h>
#include <ewol/resources/ResourceManager.h>
#include <ewol/resources/VirtualBufferObject.h>
#include <ewol/renderer/eContext.h>
#undef __class__
#define __class__ "VirtualBufferObject"
@ -93,7 +94,7 @@ void ewol::VirtualBufferObject::Reload(void)
void ewol::VirtualBufferObject::Flush(void)
{
// request to the manager to be call at the next update ...
ewol::resource::Update(this);
ewol::GetContext().GetResourcesManager().Update(this);
}
void ewol::VirtualBufferObject::PushOnBuffer(int32_t id, const vec3& data)

View File

@ -9,7 +9,6 @@
#include <ewol/ewol.h>
#include <ewol/widget/Button.h>
#include <ewol/renderer/eSystem.h>
#undef __class__
#define __class__ "Button"

View File

@ -14,7 +14,6 @@
#include <ewol/widget/meta/ColorChooser.h>
#include <ewol/widget/Windows.h>
#include <ewol/ewol.h>
#include <ewol/renderer/eSystem.h>
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";

View File

@ -10,8 +10,7 @@
#include <ewol/widget/Entry.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/ewol.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/eContext.h>
const char * const ewolEventEntryCut = "ewol-widget-entry-event-internal-cut";
@ -556,7 +555,7 @@ void widget::Entry::OnGetFocus(void)
{
m_displayCursor = true;
ChangeStatusIn(STATUS_SELECTED);
GetSystem().KeyboardShow();
ShowKeyboard();
MarkToRedraw();
}
@ -565,7 +564,7 @@ void widget::Entry::OnLostFocus(void)
{
m_displayCursor = false;
ChangeStatusIn(STATUS_NORMAL);
GetSystem().KeyboardHide();
HideKeyboard();
MarkToRedraw();
}

View File

@ -8,7 +8,7 @@
#include <ewol/widget/Mesh.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/resources/ResourceManager.h>
extern const char * const ewolEventMeshPressed = "ewol-mesh-Pressed";

View File

@ -11,7 +11,7 @@
#include <etk/types.h>
#include <ewol/widget/Widget.h>
#include <ewol/renderer/resources/Mesh.h>
#include <ewol/resources/Mesh.h>
extern const char * const ewolEventMeshPressed;

View File

@ -11,7 +11,7 @@
#include <ewol/widget/WidgetManager.h>
#include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/eContext.h>
#undef __class__
#define __class__ "DrawProperty"
@ -695,7 +695,7 @@ bool ewol::Widget::OnEventShortCut(ewol::SpecialKey& _special, uniChar_t _unicod
void ewol::Widget::GrabCursor(void)
{
if (false == m_grabCursor) {
GetSystem().InputEventGrabPointer(this);
GetContext().InputEventGrabPointer(this);
m_grabCursor = true;
}
}
@ -703,7 +703,7 @@ void ewol::Widget::GrabCursor(void)
void ewol::Widget::UnGrabCursor(void)
{
if (true==m_grabCursor) {
GetSystem().InputEventUnGrabPointer();
GetContext().InputEventUnGrabPointer();
m_grabCursor = false;
}
}
@ -720,7 +720,7 @@ void ewol::Widget::SetCursor(ewol::cursorDisplay_te _newCursor)
{
EWOL_DEBUG("Change Cursor in " << _newCursor);
m_cursorDisplay = _newCursor;
GetSystem().SetCursor(m_cursorDisplay);
GetContext().SetCursor(m_cursorDisplay);
}
ewol::cursorDisplay_te ewol::Widget::GetCursor(void)
@ -857,17 +857,29 @@ bool ewol::Widget::OnGetConfig(const char* _config, etk::UString& _result) const
void ewol::Widget::RequestUpdateSize(void)
{
GetSystem().RequestUpdateSize();
GetContext().RequestUpdateSize();
}
ewol::WidgetManager& ewol::Widget::GetWidgetManager(void)
{
return GetSystem().GetWidgetManager();
return GetContext().GetWidgetManager();
}
ewol::Windows* ewol::Widget::GetWindows(void)
{
return GetSystem().GetWindows();
return GetContext().GetWindows();
}
void ewol::Widget::ShowKeyboard(void)
{
GetContext().KeyboardShow();
}
void ewol::Widget::HideKeyboard(void)
{
GetContext().KeyboardHide();
}

View File

@ -418,12 +418,20 @@ namespace ewol {
* @return false : the event must not be repeated.
*/
virtual bool GetKeyboardRepeate(void) { return m_allowRepeateKeyboardEvent; };
protected:
/**
* @brief Set the keyboard repeating event supporting.
* @param[in] _state The repeating status (true: enable, false disable).
*/
virtual void SetKeyboardRepeate(bool _state) { m_allowRepeateKeyboardEvent = _state; };
/**
* @brief Display the virtual keyboard (if needed)
*/
virtual void ShowKeyboard(void);
/**
* @brief Hide the virtual keyboard (if needed)
*/
virtual void HideKeyboard(void);
// ----------------------------------------------------------------------------------------------------------------
// -- Periodic call Area
// ----------------------------------------------------------------------------------------------------------------

View File

@ -10,7 +10,7 @@
#include <etk/UString.h>
#include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/eSystem.h>
#include <ewol/renderer/eContext.h>
#include <ewol/widget/Widget.h>
#include <ewol/widget/Windows.h>
#include <ewol/widget/WidgetManager.h>
@ -205,7 +205,7 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
// Regenerate the size calculation :
CalculateSize(m_size);
// TODO : it is dansgerous to access directly to the system ...
GetSystem().ResetIOEvent();
GetContext().ResetIOEvent();
}
@ -241,5 +241,5 @@ void ewol::Windows::SetTitle(const etk::UString& _title)
{
// TODO : Remove this ...
etk::UString title = _title;
GetSystem().SetTitle(title);
GetContext().SetTitle(title);
}

View File

@ -28,7 +28,7 @@ def Create(target):
'ewol/renderer/EMessage.cpp',
'ewol/renderer/EObject.cpp',
'ewol/renderer/EObjectManager.cpp',
'ewol/renderer/EObjectMessageMultiCast.cpp',
'ewol/renderer/EMultiCast.cpp',
'ewol/renderer/openGL.cpp',
'ewol/renderer/ConfigFont.cpp',
'ewol/renderer/EventInput.cpp',
@ -37,7 +37,7 @@ def Create(target):
'ewol/renderer/eContext.cpp',
'ewol/renderer/eInput.cpp'])
# renderer :
# resources :
myModule.AddSrcFile([
'ewol/resources/Shader.cpp',
'ewol/resources/Program.cpp',
@ -49,15 +49,18 @@ def Create(target):
'ewol/resources/Texture.cpp',
'ewol/resources/Colored3DObject.cpp',
'ewol/resources/Image.cpp',
'ewol/resources/physicsShape/PhysicsShape.cpp',
'ewol/resources/physicsShape/PhysicsBox.cpp',
'ewol/resources/physicsShape/PhysicsCapsule.cpp',
'ewol/resources/physicsShape/PhysicsCone.cpp',
'ewol/resources/physicsShape/PhysicsConvexHull.cpp',
'ewol/resources/physicsShape/PhysicsCylinder.cpp',
'ewol/resources/physicsShape/PhysicsSphere.cpp',
'ewol/resources/ResourceManager.cpp'])
# physical shape parser
myModule.AddSrcFile([
'ewol/physicsShape/PhysicsShape.cpp',
'ewol/physicsShape/PhysicsBox.cpp',
'ewol/physicsShape/PhysicsCapsule.cpp',
'ewol/physicsShape/PhysicsCone.cpp',
'ewol/physicsShape/PhysicsConvexHull.cpp',
'ewol/physicsShape/PhysicsCylinder.cpp',
'ewol/physicsShape/PhysicsSphere.cpp'])
# Audio system
myModule.AddSrcFile([
'ewol/renderer/audio/audio.cpp',
@ -164,7 +167,7 @@ def Create(target):
#endif
#ifeq ("$(CONFIG___EWOL_LINUX_GUI_MODE_X11__)","y")
myModule.AddSrcFile('ewol/renderer/os/gui.X11.cpp')
myModule.AddSrcFile('ewol/renderer/X11/Context.cpp')
#endif
#ifeq ("$(CONFIG___EWOL_LINUX_GUI_MODE_DIRECT_FB__)","y")
#myModule.CompileFlags_CC('-I/usr/local/include/directfb')
@ -179,18 +182,18 @@ def Create(target):
myModule.AddExportflag_LD("-landroid")
java_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/../../ewol/sources/android/src/"
cpp_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/ewol/renderer/os/"
cpp_tmp_dir = lutinTools.GetCurrentPath(__file__) + "/ewol/renderer/Android/"
java_tmp_src = java_tmp_dir + "org/ewol/EwolConstants"
lutinMultiprocess.RunCommand("javac " + java_tmp_src + ".java")
lutinMultiprocess.RunCommand("cd " + java_tmp_dir + " && javah org.ewol.EwolConstants")
lutinTools.CopyFile(java_tmp_dir + "org_ewol_EwolConstants.h", cpp_tmp_dir + "org_ewol_EwolConstants.h", True)
lutinTools.RemoveFile(java_tmp_src + ".class")
myModule.AddSrcFile("ewol/renderer/os/gui.Android.cpp")
myModule.AddSrcFile("ewol/renderer/Android/Context.cpp")
elif target.name=="Windows":
myModule.AddModuleDepend("glew")
myModule.AddSrcFile("ewol/renderer/os/gui.Windows.cpp")
myModule.AddSrcFile("ewol/renderer/Windows/Context.cpp")
elif target.name=="MacOs":
myModule.AddExportflag_LD([
"-framework Cocoa",
@ -198,10 +201,10 @@ def Create(target):
"-framework QuartzCore",
"-framework AppKit"])
myModule.AddSrcFile([
"ewol/renderer/os/gui.MacOs.cpp",
"ewol/renderer/os/gui.MacOs.Interface.mm",
"ewol/renderer/os/gui.MacOs.AppDelegate.mm",
"ewol/renderer/os/gui.MacOs.OpenglView.mm"])
"ewol/renderer/MacOs/Context.cpp",
"ewol/renderer/MacOs/Interface.mm",
"ewol/renderer/MacOs/AppDelegate.mm",
"ewol/renderer/MacOs/OpenglView.mm"])
else:
debug.error("unknow mode...")