[DEV] coding style step 1

This commit is contained in:
Edouard DUPIN 2013-10-07 22:09:13 +02:00
parent d9177e4565
commit 9e540f286e
186 changed files with 6956 additions and 7007 deletions

2
external/agg vendored

@ -1 +1 @@
Subproject commit 64280cda086d931f7af6ac4ce29e181ceee8f45b
Subproject commit 3970e6969827ec485bdf260f003653f27d1e8749

View File

@ -8,33 +8,27 @@
#include <date/date.h>
int32_t date::GetYear(void)
{
int32_t date::getYear(void) {
return BUILD_YEAR;
}
int32_t date::GetMonth(void)
{
int32_t date::getMonth(void) {
return BUILD_MONTH;
}
int32_t date::GetDay(void)
{
int32_t date::getDay(void) {
return BUILD_DAY;
}
int32_t date::GetHour(void)
{
int32_t date::getHour(void) {
return BUILD_HOUR;
}
int32_t date::GetMinute(void)
{
int32_t date::getMinute(void) {
return BUILD_MINUTE;
}
int32_t date::GetSecond(void)
{
int32_t date::getSecond(void) {
return BUILD_SECOND;
}

View File

@ -11,14 +11,13 @@
#include <stdint.h>
namespace date
{
int32_t GetYear(void);
int32_t GetMonth(void);
int32_t GetDay(void);
int32_t GetHour(void);
int32_t GetMinute(void);
int32_t GetSecond(void);
namespace date {
int32_t getYear(void);
int32_t getMonth(void);
int32_t getDay(void);
int32_t getHour(void);
int32_t getMinute(void);
int32_t getSecond(void);
};

2
external/egami vendored

@ -1 +1 @@
Subproject commit 9ab5eea1f349fdae52932508d108d2e954813bad
Subproject commit 11956be90c71c30c77b7c487ff16b077db22a49d

2
external/ege vendored

@ -1 +1 @@
Subproject commit c5b072f457d6c4fc7775fc0bd062e60ad37ef450
Subproject commit 319b4552d1d90522b87b3c6913d716cd033d4a2c

2
external/ejson vendored

@ -1 +1 @@
Subproject commit 299ca3e6b2edf15cc8156b97d9e59b3d3c3a4fa7
Subproject commit a788a3c450585c42dd59cf8e3813bd1a4a241c5e

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 32c4469c127fed6ff4f3c9a7031eb7e76f72c43b
Subproject commit ce05b596afbc485c55071f4fd7b162e932c3f410

2
external/etk vendored

@ -1 +1 @@
Subproject commit dfcb78c081c6d975cf88dcb2e4cd1b0ada289c67
Subproject commit 63906e9b7726c0ad630e12409843d7381febaf24

2
external/exml vendored

@ -1 +1 @@
Subproject commit 75ef4d184ade2791d1db3b3d0f40b8ae46aa7f45
Subproject commit 33d1e95085e090eec9860213ba97a1616442d159

View File

@ -12,7 +12,7 @@
#undef __class__
#define __class__ "Dimension"
// TODO : Set this in a super class acced in a statin fuction...
// TODO : set this in a super class acced in a statin fuction...
// ratio in milimeter :
static bool isInit = false;
static vec2 ratio(9999999,888888);
@ -31,51 +31,51 @@ static const float millimeterToCentimeter = 10.0f;
static const float millimeterToKilometer = 1000000.0f;
void ewol::dimension::Init(void)
void ewol::dimension::init(void)
{
if (true==isInit) {
if (true == isInit) {
return;
}
ewol::Dimension conversion(vec2(72,72), ewol::Dimension::Inch);
ratio = conversion.GetMillimeter();
ratio = conversion.getMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.Set(vec2(200,200), ewol::Dimension::Pixel);
windowsSize.set(vec2(200,200), ewol::Dimension::Pixel);
isInit = true;
}
void ewol::dimension::UnInit(void)
void ewol::dimension::unInit(void)
{
isInit = false;
ratio.setValue(9999999,888888);
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
windowsSize.Set(vec2(9999999,88888), ewol::Dimension::Pixel);
windowsSize.set(vec2(9999999,88888), ewol::Dimension::Pixel);
}
void ewol::dimension::SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type)
void ewol::dimension::setPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type)
{
ewol::dimension::Init();
ewol::dimension::init();
EWOL_INFO("Set a new screen ratio for the screen : ratio=" << _ratio << " type=" << _type);
ewol::Dimension conversion(_ratio, _type);
EWOL_INFO(" ==> " << conversion);
ratio = conversion.GetMillimeter();
EWOL_INFO(" == > " << conversion);
ratio = conversion.getMillimeter();
invRatio.setValue(1.0f/ratio.x(),1.0f/ratio.y());
EWOL_INFO("Set a new screen ratio for the screen : ratioMm=" << ratio);
}
void ewol::dimension::SetPixelWindowsSize(const vec2& _size)
void ewol::dimension::setPixelWindowsSize(const vec2& _size)
{
windowsSize = _size;
EWOL_VERBOSE("Set a new Windows property size " << windowsSize << "px");
}
vec2 ewol::dimension::GetWindowsSize(ewol::Dimension::distance_te _type)
vec2 ewol::dimension::getWindowsSize(ewol::Dimension::distance_te _type)
{
return windowsSize.Get(_type);
return windowsSize.get(_type);
}
float ewol::dimension::GetWindowsDiag(ewol::Dimension::distance_te _type)
float ewol::dimension::getWindowsDiag(ewol::Dimension::distance_te _type)
{
vec2 size = ewol::dimension::GetWindowsSize(_type);
vec2 size = ewol::dimension::getWindowsSize(_type);
return size.length();
}
@ -94,45 +94,45 @@ ewol::Dimension::Dimension(const vec2& _size, ewol::Dimension::distance_te _type
m_data(0,0),
m_type(ewol::Dimension::Pixel)
{
Set(_size, _type);
set(_size, _type);
}
void ewol::Dimension::Set(etk::UString _config)
void ewol::Dimension::set(etk::UString _config)
{
m_data.setValue(0,0);
m_type = ewol::Dimension::Pixel;
distance_te type = ewol::Dimension::Pixel;
if (_config.EndWith("%",false)==true) {
if (_config.endWith("%",false) == true) {
type = ewol::Dimension::Pourcent;
_config.Remove(_config.Size()-1, 1);
} else if (_config.EndWith("px",false)==true) {
_config.remove(_config.size()-1, 1);
} else if (_config.endWith("px",false) == true) {
type = ewol::Dimension::Pixel;
_config.Remove(_config.Size()-2, 2);
} else if (_config.EndWith("ft",false)==true) {
_config.remove(_config.size()-2, 2);
} else if (_config.endWith("ft",false) == true) {
type = ewol::Dimension::foot;
_config.Remove(_config.Size()-2, 2);
} else if (_config.EndWith("in",false)==true) {
_config.remove(_config.size()-2, 2);
} else if (_config.endWith("in",false) == true) {
type = ewol::Dimension::Inch;
_config.Remove(_config.Size()-2, 2);
} else if (_config.EndWith("km",false)==true) {
_config.remove(_config.size()-2, 2);
} else if (_config.endWith("km",false) == true) {
type = ewol::Dimension::Kilometer;
_config.Remove(_config.Size()-2, 2);
} else if (_config.EndWith("mm",false)==true) {
_config.remove(_config.size()-2, 2);
} else if (_config.endWith("mm",false) == true) {
type = ewol::Dimension::Millimeter;
_config.Remove(_config.Size()-2, 2);
} else if (_config.EndWith("cm",false)==true) {
_config.remove(_config.size()-2, 2);
} else if (_config.endWith("cm",false) == true) {
type = ewol::Dimension::Centimeter;
_config.Remove(_config.Size()-2, 2);
} else if (_config.EndWith("m",false)==true) {
_config.remove(_config.size()-2, 2);
} else if (_config.endWith("m",false) == true) {
type = ewol::Dimension::Meter;
_config.Remove(_config.Size()-1, 1);
_config.remove(_config.size()-1, 1);
} else {
EWOL_CRITICAL("Can not parse dimention : \"" << _config << "\"");
return;
}
vec2 tmp = _config;
Set(tmp, type);
EWOL_VERBOSE(" config dimention : \"" << _config << "\" ==> " << *this );
set(tmp, type);
EWOL_VERBOSE(" config dimention : \"" << _config << "\" == > " << *this );
}
ewol::Dimension::~Dimension(void)
@ -143,9 +143,9 @@ ewol::Dimension::~Dimension(void)
ewol::Dimension::operator etk::UString(void) const
{
etk::UString str;
str = Get(GetType());
str = get(getType());
switch(GetType()) {
switch(getType()) {
case ewol::Dimension::Pourcent:
str += "%";
break;
@ -174,31 +174,31 @@ ewol::Dimension::operator etk::UString(void) const
return str;
}
vec2 ewol::Dimension::Get(ewol::Dimension::distance_te _type) const
vec2 ewol::Dimension::get(ewol::Dimension::distance_te _type) const
{
switch(_type) {
case ewol::Dimension::Pourcent:
return GetPourcent();
return getPourcent();
case ewol::Dimension::Pixel:
return GetPixel();
return getPixel();
case ewol::Dimension::Meter:
return GetMeter();
return getMeter();
case ewol::Dimension::Centimeter:
return GetCentimeter();
return getCentimeter();
case ewol::Dimension::Millimeter:
return GetMillimeter();
return getMillimeter();
case ewol::Dimension::Kilometer:
return GetKilometer();
return getKilometer();
case ewol::Dimension::Inch:
return GetInch();
return getInch();
case ewol::Dimension::foot:
return GetFoot();
return getFoot();
}
}
void ewol::Dimension::Set(const vec2& _size, ewol::Dimension::distance_te _type)
void ewol::Dimension::set(const vec2& _size, ewol::Dimension::distance_te _type)
{
// Set min max on input to limit error :
// set min max on input to limit error :
vec2 size(etk_avg(0.0f,_size.x(),9999999.0f),
etk_avg(0.0f,_size.y(),9999999.0f));
switch(_type) {
@ -207,7 +207,7 @@ void ewol::Dimension::Set(const vec2& _size, ewol::Dimension::distance_te _type)
vec2 size2(etk_avg(0.0f,_size.x(),100.0f),
etk_avg(0.0f,_size.y(),100.0f));
m_data = vec2(size2.x()*0.01f, size2.y()*0.01f);
//EWOL_VERBOSE("Set % : " << size2 << " ==> " << m_data);
//EWOL_VERBOSE("Set % : " << size2 << " == > " << m_data);
}
break;
case ewol::Dimension::Pixel:
@ -235,23 +235,23 @@ void ewol::Dimension::Set(const vec2& _size, ewol::Dimension::distance_te _type)
m_type = _type;
}
vec2 ewol::Dimension::GetPixel(void) const
vec2 ewol::Dimension::getPixel(void) const
{
if (m_type!=ewol::Dimension::Pourcent) {
return m_data;
} else {
vec2 windDim = windowsSize.GetPixel();
vec2 windDim = windowsSize.getPixel();
vec2 res = vec2(windDim.x()*m_data.x(), windDim.y()*m_data.y());
//EWOL_DEBUG("Get % : " << m_data << " / " << windDim << "==> " << res);
//EWOL_DEBUG("Get % : " << m_data << " / " << windDim << " == > " << res);
return res;
}
}
vec2 ewol::Dimension::GetPourcent(void) const
vec2 ewol::Dimension::getPourcent(void) const
{
if (m_type!=ewol::Dimension::Pourcent) {
vec2 windDim = windowsSize.GetPixel();
//EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " ==> " << windDim << "px"); // ==> infinite loop ...
vec2 windDim = windowsSize.getPixel();
//EWOL_DEBUG(" windows dimention : " /*<< windowsSize*/ << " == > " << windDim << "px"); // ==> infinite loop ...
//printf(" windows dimention : %f,%f", windDim.x(),windDim.y());
//printf(" data : %f,%f", m_data.x(),m_data.y());
return vec2((m_data.x()/windDim.x())*100.0f, (m_data.y()/windDim.y())*100.0f);
@ -259,34 +259,34 @@ vec2 ewol::Dimension::GetPourcent(void) const
return vec2(m_data.x()*100.0f, m_data.y()*100.0f);;
}
vec2 ewol::Dimension::GetMeter(void) const
vec2 ewol::Dimension::getMeter(void) const
{
return ewol::Dimension::GetMillimeter()*millimeterToMeter;
return ewol::Dimension::getMillimeter()*millimeterToMeter;
}
vec2 ewol::Dimension::GetCentimeter(void) const
vec2 ewol::Dimension::getCentimeter(void) const
{
return ewol::Dimension::GetMillimeter()*millimeterToCentimeter;
return ewol::Dimension::getMillimeter()*millimeterToCentimeter;
}
vec2 ewol::Dimension::GetMillimeter(void) const
vec2 ewol::Dimension::getMillimeter(void) const
{
return ewol::Dimension::GetPixel()*invRatio;
return ewol::Dimension::getPixel()*invRatio;
}
vec2 ewol::Dimension::GetKilometer(void) const
vec2 ewol::Dimension::getKilometer(void) const
{
return ewol::Dimension::GetMillimeter()*millimeterToKilometer;
return ewol::Dimension::getMillimeter()*millimeterToKilometer;
}
vec2 ewol::Dimension::GetInch(void) const
vec2 ewol::Dimension::getInch(void) const
{
return ewol::Dimension::GetMillimeter()*millimeterToInch;
return ewol::Dimension::getMillimeter()*millimeterToInch;
}
vec2 ewol::Dimension::GetFoot(void) const
vec2 ewol::Dimension::getFoot(void) const
{
return ewol::Dimension::GetMillimeter()*millimeterToFoot;
return ewol::Dimension::getMillimeter()*millimeterToFoot;
}
etk::CCout& ewol::operator <<(etk::CCout &os, const ewol::Dimension::distance_te& obj)
@ -322,6 +322,6 @@ etk::CCout& ewol::operator <<(etk::CCout &os, const ewol::Dimension::distance_te
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Dimension& _obj)
{
_os << _obj.Get(_obj.GetType()) << _obj.GetType();
_os << _obj.get(_obj.getType()) << _obj.getType();
return _os;
}

View File

@ -50,12 +50,12 @@ namespace ewol
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const etk::UString& _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { Set(_config); };
Dimension(const etk::UString& _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { set(_config); };
/**
* @brief Constructor
* @param[in] _config dimension configuration.
*/
Dimension(const char* _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { Set(_config); };
Dimension(const char* _config) : m_data(0,0),m_type(ewol::Dimension::Pixel) { set(_config); };
/**
* @brief Destructor
*/
@ -67,65 +67,65 @@ namespace ewol
operator etk::UString(void) const;
/**
* @brief Get the current dimention in requested type
* @brief get the current dimention in requested type
* @param[in] _type Type of unit requested.
* @return dimention requested.
*/
vec2 Get(ewol::Dimension::distance_te _type) const;
vec2 get(ewol::Dimension::distance_te _type) const;
/**
* @brief Set the current dimention in requested type
* @brief set the current dimention in requested type
* @param[in] _size Dimention to set
* @param[in] _type Type of unit requested.
*/
void Set(const vec2& _size, ewol::Dimension::distance_te _type);
void set(const vec2& _size, ewol::Dimension::distance_te _type);
private:
/**
* @brief Set the current dimention in requested type
* @brief set the current dimention in requested type
* @param[in] _config dimension configuration.
*/
void Set(etk::UString _config);
void set(etk::UString _config);
public:
/**
* @brief Get the current dimention in pixel
* @brief get the current dimention in pixel
* @return dimention in Pixel
*/
vec2 GetPixel(void) const;
vec2 getPixel(void) const;
/**
* @brief Get the current dimention in Pourcent
* @brief get the current dimention in Pourcent
* @return dimention in Pourcent
*/
vec2 GetPourcent(void) const;
vec2 getPourcent(void) const;
/**
* @brief Get the current dimention in Meter
* @brief get the current dimention in Meter
* @return dimention in Meter
*/
vec2 GetMeter(void) const;
vec2 getMeter(void) const;
/**
* @brief Get the current dimention in Centimeter
* @brief get the current dimention in Centimeter
* @return dimention in Centimeter
*/
vec2 GetCentimeter(void) const;
vec2 getCentimeter(void) const;
/**
* @brief Get the current dimention in Millimeter
* @brief get the current dimention in Millimeter
* @return dimention in Millimeter
*/
vec2 GetMillimeter(void) const;
vec2 getMillimeter(void) const;
/**
* @brief Get the current dimention in Kilometer
* @brief get the current dimention in Kilometer
* @return dimention in Kilometer
*/
vec2 GetKilometer(void) const;
vec2 getKilometer(void) const;
/**
* @brief Get the current dimention in Inch
* @brief get the current dimention in Inch
* @return dimention in Inch
*/
vec2 GetInch(void) const;
vec2 getInch(void) const;
/**
* @brief Get the current dimention in Foot
* @brief get the current dimention in Foot
* @return dimention in Foot
*/
vec2 GetFoot(void) const;
vec2 getFoot(void) const;
/*****************************************************
* = assigment
*****************************************************/
@ -139,7 +139,7 @@ namespace ewol
/*****************************************************
* == operator
*****************************************************/
bool operator== (const Dimension& _obj) const {
bool operator == (const Dimension& _obj) const {
if( m_data == _obj.m_data
&& m_type == _obj.m_type) {
return true;
@ -160,7 +160,7 @@ namespace ewol
* @breif get the dimension type
* @return the type
*/
ewol::Dimension::distance_te GetType(void) const { return m_type; };
ewol::Dimension::distance_te getType(void) const { return m_type; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension::distance_te& _obj);
etk::CCout& operator <<(etk::CCout& _os, const ewol::Dimension& _obj);
@ -171,35 +171,35 @@ namespace ewol
/**
* @brief basic init
*/
void Init(void);
void init(void);
/**
* @brief basic un-init
*/
void UnInit(void);
void unInit(void);
/**
* @brief Set the Milimeter ratio for calculation
* @brief set the Milimeter ratio for calculation
* @param[in] Ratio Milimeter ration for the screen calculation interpolation
* @param[in] type Unit type requested.
* @note: same as @ref SetPixelPerInch (internal manage convertion)
* @note: same as @ref setPixelPerInch (internal manage convertion)
*/
void SetPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type);
void setPixelRatio(const vec2& _ratio, ewol::Dimension::distance_te _type);
/**
* @brief Set the current Windows Size
* @param[in] size Size of the current windows in pixel.
* @brief set the current Windows size
* @param[in] size size of the current windows in pixel.
*/
void SetPixelWindowsSize(const vec2& _size);
void setPixelWindowsSize(const vec2& _size);
/**
* @brief Get the Windows Size in the request unit
* @brief get the Windows size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
vec2 GetWindowsSize(ewol::Dimension::distance_te _type);
vec2 getWindowsSize(ewol::Dimension::distance_te _type);
/**
* @brief Get the Windows diagonal size in the request unit
* @brief get the Windows diagonal size in the request unit
* @param[in] type Unit type requested.
* @return the requested size
*/
float GetWindowsDiag(ewol::Dimension::distance_te _type);
float getWindowsDiag(ewol::Dimension::distance_te _type);
};
};

View File

@ -29,25 +29,25 @@ ewol::Light::~Light(void)
}
void ewol::Light::Link(ewol::Program* prog, const etk::UString& baseName)
void ewol::Light::link(ewol::Program* prog, const etk::UString& baseName)
{
if (NULL == prog) {
return;
}
m_GL_direction = prog->GetUniform(baseName+".direction");
m_GL_halfplane = prog->GetUniform(baseName+".halfplane");
m_GL_ambientColor = prog->GetUniform(baseName+".ambientColor");
m_GL_diffuseColor = prog->GetUniform(baseName+".diffuseColor");
m_GL_specularColor = prog->GetUniform(baseName+".specularColor");
m_GL_direction = prog->getUniform(baseName+".direction");
m_GL_halfplane = prog->getUniform(baseName+".halfplane");
m_GL_ambientColor = prog->getUniform(baseName+".ambientColor");
m_GL_diffuseColor = prog->getUniform(baseName+".diffuseColor");
m_GL_specularColor = prog->getUniform(baseName+".specularColor");
}
void ewol::Light::Draw(ewol::Program* prog)
void ewol::Light::draw(ewol::Program* prog)
{
prog->Uniform3(m_GL_direction, m_direction);
prog->Uniform3(m_GL_halfplane, m_halfplane);
prog->Uniform4(m_GL_ambientColor, m_ambientColor);
prog->Uniform4(m_GL_diffuseColor, m_diffuseColor);
prog->Uniform4(m_GL_specularColor, m_specularColor);
prog->uniform3(m_GL_direction, m_direction);
prog->uniform3(m_GL_halfplane, m_halfplane);
prog->uniform4(m_GL_ambientColor, m_ambientColor);
prog->uniform4(m_GL_diffuseColor, m_diffuseColor);
prog->uniform4(m_GL_specularColor, m_specularColor);
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::Light& _obj)

View File

@ -35,21 +35,21 @@ namespace ewol
public:
Light(void);
~Light(void);
void Link(ewol::Program* prog, const etk::UString& baseName);
void Draw(ewol::Program* prog);
void SetDirection(const vec3& val) {
void link(ewol::Program* prog, const etk::UString& baseName);
void draw(ewol::Program* prog);
void setDirection(const vec3& val) {
m_direction = val;
}
void SetHalfPlane(const vec3& val) {
void setHalfPlane(const vec3& val) {
m_halfplane = val;
}
void SetAmbientColor(const vec4& val) {
void setAmbientColor(const vec4& val) {
m_ambientColor = val;
}
void SetDiffuseColor(const vec4& val) {
void setDiffuseColor(const vec4& val) {
m_diffuseColor = val;
}
void SetSpecularColor(const vec4& val) {
void setSpecularColor(const vec4& val) {
m_specularColor = val;
}

View File

@ -21,16 +21,16 @@ ewol::MaterialGlId::MaterialGlId(void) :
}
void ewol::MaterialGlId::Link(ewol::Program* _prog, const etk::UString& _baseName)
void ewol::MaterialGlId::link(ewol::Program* _prog, const etk::UString& _baseName)
{
if (NULL == _prog) {
return;
}
m_GL_ambientFactor = _prog->GetUniform(_baseName+".ambientFactor");
m_GL_diffuseFactor = _prog->GetUniform(_baseName+".diffuseFactor");
m_GL_specularFactor = _prog->GetUniform(_baseName+".specularFactor");
m_GL_shininess = _prog->GetUniform(_baseName+".shininess");
m_GL_texture0 = _prog->GetUniform("EW_texID");
m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor");
m_GL_diffuseFactor = _prog->getUniform(_baseName+".diffuseFactor");
m_GL_specularFactor = _prog->getUniform(_baseName+".specularFactor");
m_GL_shininess = _prog->getUniform(_baseName+".shininess");
m_GL_texture0 = _prog->getUniform("EW_texID");
}
ewol::Material::Material(void) :
@ -45,27 +45,27 @@ ewol::Material::Material(void) :
ewol::Material::~Material(void)
{
if(NULL!=m_texture0) {
ewol::TextureFile::Release(m_texture0);
ewol::TextureFile::release(m_texture0);
}
}
void ewol::Material::Draw(ewol::Program* _prog, const MaterialGlId& _glID)
void ewol::Material::draw(ewol::Program* _prog, const MaterialGlId& _glID)
{
_prog->Uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->Uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
_prog->Uniform4(_glID.m_GL_specularFactor, m_specularFactor);
_prog->Uniform1f(_glID.m_GL_shininess, m_shininess);
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
_prog->uniform1f(_glID.m_GL_shininess, m_shininess);
if (NULL != m_texture0) {
_prog->SetTexture0(_glID.m_GL_texture0, m_texture0->GetId());
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getId());
}
}
void ewol::Material::SetTexture0(const etk::UString& _filename)
void ewol::Material::setTexture0(const etk::UString& _filename)
{
ivec2 tmpSize(256, 256);
// prevent overloard error :
ewol::TextureFile* tmpCopy = m_texture0;
m_texture0 = ewol::TextureFile::Keep(_filename, tmpSize);
m_texture0 = ewol::TextureFile::keep(_filename, tmpSize);
if (NULL == m_texture0 ) {
EWOL_ERROR("Can not load specific texture : " << _filename);
// retreave previous texture:
@ -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::TextureFile::Release(tmpCopy);
ewol::TextureFile::release(tmpCopy);
}
}

View File

@ -27,7 +27,7 @@ namespace ewol
int32_t m_GL_shininess;
int32_t m_GL_texture0;
MaterialGlId(void);
void Link(ewol::Program* _prog, const etk::UString& _baseName);
void link(ewol::Program* _prog, const etk::UString& _baseName);
};
class Material
{
@ -43,26 +43,26 @@ namespace ewol
public:
Material(void);
~Material(void);
void Draw(ewol::Program* _prog, const MaterialGlId& _glID);
void SetAmbientFactor(const vec4& _val) {
void draw(ewol::Program* _prog, const MaterialGlId& _glID);
void setAmbientFactor(const vec4& _val) {
m_ambientFactor = _val;
}
void SetDiffuseFactor(const vec4& _val) {
void setDiffuseFactor(const vec4& _val) {
m_diffuseFactor = _val;
}
void SetSpecularFactor(const vec4& _val) {
void setSpecularFactor(const vec4& _val) {
m_specularFactor = _val;
}
void SetShininess(float _val) {
void setShininess(float _val) {
m_shininess = _val;
}
void SetTexture0(const etk::UString& _filename);
void setTexture0(const etk::UString& _filename);
void SetImageSize(const ivec2& _newSize) { if (m_texture0==NULL){return;} m_texture0->SetImageSize(_newSize); };
void setImageSize(const ivec2& _newSize) { if (m_texture0 == NULL){return;} m_texture0->setImageSize(_newSize); };
// get the reference on this image to draw nomething on it ...
egami::Image* Get(void) { if (m_texture0==NULL){return NULL;} return &m_texture0->Get(); };
// Flush the data to send it at the OpenGl system
void Flush(void) { if (m_texture0==NULL){return;} m_texture0->Flush(); };
egami::Image* get(void) { if (m_texture0 == NULL){return NULL;} return &m_texture0->get(); };
// flush the data to send it at the openGl system
void flush(void) { if (m_texture0 == NULL){return;} m_texture0->flush(); };
};
};

View File

@ -44,7 +44,7 @@ static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1]
etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const ewol::clipBoard::clipboardListe_te _obj)
{
if (_obj>=0 && _obj <ewol::clipBoard::clipboardCount) {
if (_obj >= 0 && _obj <ewol::clipBoard::clipboardCount) {
_os << clipboardDescriptionString[_obj];
} else {
_os << "[ERROR]";
@ -53,28 +53,28 @@ etk::CCout& ewol::clipBoard::operator <<(etk::CCout& _os, const ewol::clipBoard:
}
void ewol::clipBoard::Init(void)
void ewol::clipBoard::init(void)
{
EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) {
mesCopy[i].Clear();
mesCopy[i].clear();
}
}
void ewol::clipBoard::UnInit(void)
void ewol::clipBoard::unInit(void)
{
EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::clipboardCount; i++) {
mesCopy[i].Clear();
mesCopy[i].clear();
}
}
void ewol::clipBoard::Set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data)
void ewol::clipBoard::set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data)
{
// check if ID is correct
if(0 == _data.Size()) {
if(0 == _data.size()) {
EWOL_INFO("request a copy of nothing");
return;
} else
@ -84,17 +84,17 @@ void ewol::clipBoard::Set(ewol::clipBoard::clipboardListe_te _clipboardID, const
return;
}
ewol::clipBoard::SetSystem(_clipboardID, _data);
ewol::clipBoard::setSystem(_clipboardID, _data);
if( ewol::clipBoard::clipboardStd == _clipboardID
|| ewol::clipBoard::clipboardSelection == _clipboardID) {
ewol::GetContext().ClipBoardSet(_clipboardID);
ewol::getContext().clipBoardSet(_clipboardID);
EWOL_TODO("Set ClipBoard");
}
}
void ewol::clipBoard::Request(ewol::clipBoard::clipboardListe_te _clipboardID)
void ewol::clipBoard::request(ewol::clipBoard::clipboardListe_te _clipboardID)
{
if(_clipboardID >= ewol::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error");
@ -103,17 +103,17 @@ void ewol::clipBoard::Request(ewol::clipBoard::clipboardListe_te _clipboardID)
if( ewol::clipBoard::clipboardStd == _clipboardID
|| ewol::clipBoard::clipboardSelection == _clipboardID) {
ewol::GetContext().ClipBoardGet(_clipboardID);
ewol::getContext().clipBoardGet(_clipboardID);
EWOL_TODO("Get ClipBoard");
} else {
// generate an event on the main thread ...
ewol::GetContext().OS_ClipBoardArrive(_clipboardID);
ewol::getContext().OS_ClipBoardArrive(_clipboardID);
EWOL_TODO("ClipBoard arrive");
}
}
void ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data)
void ewol::clipBoard::setSystem(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data)
{
if(_clipboardID >= ewol::clipBoard::clipboardCount) {
EWOL_WARNING("request ClickBoard id error");
@ -124,7 +124,7 @@ void ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardListe_te _clipboardID,
}
const etk::UString& ewol::clipBoard::Get(ewol::clipBoard::clipboardListe_te _clipboardID)
const etk::UString& ewol::clipBoard::get(ewol::clipBoard::clipboardListe_te _clipboardID)
{
static const etk::UString emptyString("");
if(_clipboardID >= ewol::clipBoard::clipboardCount) {

View File

@ -17,16 +17,16 @@ namespace ewol {
namespace clipBoard
{
typedef enum {
clipboard0, //!< Internal clipboard 0
clipboard1, //!< Internal clipboard 1
clipboard2, //!< Internal clipboard 2
clipboard3, //!< Internal clipboard 3
clipboard4, //!< Internal clipboard 4
clipboard5, //!< Internal clipboard 5
clipboard6, //!< Internal clipboard 6
clipboard7, //!< Internal clipboard 7
clipboard8, //!< Internal clipboard 8
clipboard9, //!< Internal clipboard 9
clipboard0, //!< internal clipboard 0
clipboard1, //!< internal clipboard 1
clipboard2, //!< internal clipboard 2
clipboard3, //!< internal clipboard 3
clipboard4, //!< internal clipboard 4
clipboard5, //!< internal clipboard 5
clipboard6, //!< internal clipboard 6
clipboard7, //!< internal clipboard 7
clipboard8, //!< internal clipboard 8
clipboard9, //!< internal clipboard 9
clipboardStd, //!< External clipboard represent the Copy/Cut/Past buffer
clipboardSelection, //!< External or internal clipboard depending on the OS, represent the middle button
clipboardCount, //!< Total number of clipboard
@ -38,11 +38,11 @@ namespace ewol {
etk::CCout& operator <<(etk::CCout& _os, const ewol::clipBoard::clipboardListe_te _obj);
/**
* @brief Set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change
* @brief set the string data on a specific clipboard. The Gui system is notify that the clipboard "SELECTION" and "COPY" are change
* @param[in] _clipboardID Select the specific ID of the clipboard
* @param[in] _data The string that might be send to the clipboard
*/
void Set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data);
void set(ewol::clipBoard::clipboardListe_te _clipboardID, const etk::UString& _data);
/**
* @brief Call system to request the current clipboard.
* @note Due to some system that manage the clipboard request asynchronous (like X11) and ewol managing the system with only one thread,
@ -50,33 +50,33 @@ namespace ewol {
* notification of the arrival of this buffer id
* @param[in] _clipboardID the needed clipboard ID
*/
void Request(ewol::clipBoard::clipboardListe_te _clipboardID);
void request(ewol::clipBoard::clipboardListe_te _clipboardID);
/**
* @brief Set the ewol internal buffer (no notification at the GUI). This fuction might be use by the
* @brief set the ewol internal buffer (no notification at the GUI). This fuction might be use by the
* Gui abstraction to set the buffer we receive. The end user must not use it.
* @param[in] _clipboardID selected clipboard ID
* @param[in] _data new buffer data
*/
void SetSystem(ewol::clipBoard::clipboardListe_te _clipboardID,const etk::UString& _data);
void setSystem(ewol::clipBoard::clipboardListe_te _clipboardID,const etk::UString& _data);
/**
* @brief Get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in
* the widget : @ref OnEventClipboard ==> we can nothe this function is the only one which permit it.
* @brief get the ewol internal buffer of the curent clipboard. The end user can use it when he receive the event in
* the widget : @ref onEventClipboard == > we can nothe this function is the only one which permit it.
* @note if we call this fuction withoutcallin @ref ewol::clipBoard::Request, we only get the previous clipboard
* @param[in] _clipboardID selected clipboard ID
* @return the requested buffer
*/
const etk::UString& Get(ewol::clipBoard::clipboardListe_te _clipboardID);
const etk::UString& get(ewol::clipBoard::clipboardListe_te _clipboardID);
// internal section
/**
* @brief Initialize the clipboard system (done by ewol)
* @brief initialize the clipboard system (done by ewol)
*/
void Init(void);
void init(void);
/**
* @brief Un-Initialize the clipboard system (done by ewol)
*/
void UnInit(void);
void unInit(void);
};
};

View File

@ -10,37 +10,37 @@
#include <ewol/commandLine.h>
#include <etk/Vector.h>
void ewol::CommandLine::Parse(int32_t _argc, const char* _argv[])
void ewol::CommandLine::parse(int32_t _argc, const char* _argv[])
{
for( int32_t i=1 ; i<_argc; i++) {
EWOL_INFO("commandLine : \"" << _argv[i] << "\"" );
m_listArgs.PushBack(_argv[i]);
m_listArgs.pushBack(_argv[i]);
}
}
esize_t ewol::CommandLine::Size(void)
esize_t ewol::CommandLine::size(void)
{
return m_listArgs.Size();
return m_listArgs.size();
}
const etk::UString& ewol::CommandLine::Get(int32_t _id)
const etk::UString& ewol::CommandLine::get(int32_t _id)
{
static const etk::UString errorArg("");
if (_id<0 && _id>=m_listArgs.Size()) {
if (_id<0 && _id >= m_listArgs.size()) {
return errorArg;
}
return m_listArgs[_id];
}
void ewol::CommandLine::Add(const etk::UString& _newElement)
void ewol::CommandLine::add(const etk::UString& _newElement)
{
m_listArgs.PushBack(_newElement);
m_listArgs.pushBack(_newElement);
}
void ewol::CommandLine::Remove(esize_t _id)
void ewol::CommandLine::remove(esize_t _id)
{
m_listArgs.Remove(_id);
m_listArgs.remove(_id);
}

View File

@ -22,27 +22,27 @@ namespace ewol
/**
* @brief Parse the command line parameters
*/
void Parse(int32_t _argc, const char* _argv[]);
void parse(int32_t _argc, const char* _argv[]);
/**
* @brief Get the number of element in the Command Line
* @brief get the number of element in the Command line
* @return the number of element
*/
esize_t Size(void);
esize_t size(void);
/**
* @brief Get an element with a specific ID
* @brief get an element with a specific ID
* @return _id The cmdLine Id element
*/
const etk::UString& Get(int32_t _id);
const etk::UString& get(int32_t _id);
/**
* @brief Add one element at the Command Line
* @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);
void add(const etk::UString& _newElement);
/**
* @brief Remove an element
* @brief remove an element
* @param[in] _id Id of the element
*/
void Remove(esize_t _id);
void remove(esize_t _id);
};
};

View File

@ -23,35 +23,35 @@ ewol::Area::Area(const ivec2& _size) :
m_GLtexID(-1),
m_resource(NULL)
{
m_resource = ewol::Texture::Keep();
m_resource->SetImageSize(_size);
m_resource->Flush();
LoadProgram();
m_resource = ewol::Texture::keep();
m_resource->setImageSize(_size);
m_resource->flush();
loadProgram();
}
ewol::Area::~Area(void)
{
ewol::Texture::Release(m_resource);
ewol::Program::Release(m_GLprogram);
ewol::Texture::release(m_resource);
ewol::Program::release(m_GLprogram);
}
void ewol::Area::LoadProgram(void)
void ewol::Area::loadProgram(void)
{
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep("DATA:textured3D.prog");
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
if (NULL != m_GLprogram) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->getUniform("EW_texID");
}
}
void ewol::Area::Draw(bool _disableDepthTest)
void ewol::Area::draw(bool _disableDepthTest)
{
if (m_coord.Size()<=0) {
if (m_coord.size() <= 0) {
//EWOL_WARNING("Nothink to draw...");
return;
}
@ -59,83 +59,83 @@ void ewol::Area::Draw(bool _disableDepthTest)
// this is a normale case ... the user can choice to have no image ...
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply;
m_GLprogram->Use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// TextureID
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
// Texture :
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
m_GLprogram->sendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
// color :
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size());
m_GLprogram->UnUse();
ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->unUse();
}
void ewol::Area::Clear(void)
void ewol::Area::clear(void)
{
// call upper class
ewol::Compositing::Clear();
// Reset Buffer :
m_coord.Clear();
m_coordTex.Clear();
m_coordColor.Clear();
// Reset temporal variables :
ewol::Compositing::clear();
// reset Buffer :
m_coord.clear();
m_coordTex.clear();
m_coordColor.clear();
// reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0);
}
void ewol::Area::Print(const ivec2& _size)
void ewol::Area::print(const ivec2& _size)
{
vec3 point(0,0,0);
vec2 tex(0,1);
point.setX(m_position.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(1,1);
point.setX(m_position.x() + _size.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(1,0);
point.setX(m_position.x() + _size.x());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(0,0);
point.setX(m_position.x());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(0,1);
point.setX(m_position.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
}

View File

@ -34,9 +34,9 @@ namespace ewol
etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
private:
/**
* @brief Load the openGL program and get all the ID needed
* @brief load the openGL program and get all the ID needed
*/
void LoadProgram(void);
void loadProgram(void);
public:
/**
* @brief generic constructor
@ -49,38 +49,38 @@ namespace ewol
~Area(void);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
* @brief draw All the refistered text in the current element on openGL
*/
void Draw(bool _disableDepthTest=true);
void draw(bool _disableDepthTest=true);
/**
* @brief Clear alll the registered element in the current element
* @brief clear alll the registered element in the current element
*/
void Clear(void);
void clear(void);
/**
* @brief Get the current display position (sometime needed in the gui control)
* @brief get the current display position (sometime needed in the gui control)
* @return the current position.
*/
const vec3& GetPos(void) { return m_position; };
const vec3& getPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); };
void setPos(const vec3& _pos) { m_position = _pos; };
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set relative position for the next text writen
* @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); };
void setRelPos(const vec3& _pos) { m_position += _pos; };
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Add a compleate of the image to display with the requested size
* @param[in] _size Size of the output image
* @brief add a compleate of the image to display with the requested size
* @param[in] _size size of the output image
*/
void Print(const ivec2& _size);
void print(const ivec2& _size);
egami::Image& Get(void) { return m_resource->Get(); };
void Flush(void) { m_resource->Flush(); };
egami::Image& get(void) { return m_resource->get(); };
void flush(void) { m_resource->flush(); };
};
};

View File

@ -25,37 +25,37 @@ ewol::Compositing::~Compositing(void)
}
void ewol::Compositing::ResetMatrix(void)
void ewol::Compositing::resetMatrix(void)
{
m_matrixApply.Identity();
m_matrixApply.identity();
}
void ewol::Compositing::Translate(const vec3& _vect)
void ewol::Compositing::translate(const vec3& _vect)
{
m_matrixApply *= etk::matTranslate(_vect);
}
void ewol::Compositing::Rotate(const vec3& _vect, float _angle)
void ewol::Compositing::rotate(const vec3& _vect, float _angle)
{
m_matrixApply *= etk::matRotate(_vect, _angle);
}
void ewol::Compositing::Scale(const vec3& _vect)
void ewol::Compositing::scale(const vec3& _vect)
{
m_matrixApply *= etk::matScale(_vect);
}
void ewol::Compositing::Clear(void)
void ewol::Compositing::clear(void)
{
m_matrixApply.Identity();
m_matrixApply.identity();
}
void ewol::Compositing::SetMatrix(const mat4& _mat)
void ewol::Compositing::setMatrix(const mat4& _mat)
{
m_matrixApply = _mat;
}

View File

@ -31,35 +31,35 @@ namespace ewol
/**
* @brief Virtal pure function that request the draw of all openGl elements
*/
virtual void Draw(bool _disableDepthTest=true)=0;
virtual void draw(bool _disableDepthTest=true)=0;
/**
* @brief Clear alll tre registered element in the current element
* @brief clear alll tre registered element in the current element
*/
virtual void Clear(void);
virtual void clear(void);
/**
* @brief Reset to the eye matrix the openGL mouving system
* @brief reset to the eye matrix the openGL mouving system
*/
virtual void ResetMatrix(void);
virtual void resetMatrix(void);
/**
* @brief Translate the current display of this element
* @brief translate the current display of this element
* @param[in] _vect The translation vector to apply at the transformation matrix
*/
virtual void Translate(const vec3& _vect);
virtual void translate(const vec3& _vect);
/**
* @brief Rotate the curent display of this element
* @brief rotate the curent display of this element
* @param[in] _vect The rotation vector to apply at the transformation matrix
*/
virtual void Rotate(const vec3& _vect, float _angle);
virtual void rotate(const vec3& _vect, float _angle);
/**
* @brief Scale the current diaplsy of this element
* @brief scale the current diaplsy of this element
* @param[in] _vect The scaling vector to apply at the transformation matrix
*/
virtual void Scale(const vec3& _vect);
virtual void scale(const vec3& _vect);
/**
* @brief set the transformation matrix
* @param[in] _mat The new matrix.
*/
virtual void SetMatrix(const mat4& _mat);
virtual void setMatrix(const mat4& _mat);
};
};

View File

@ -14,62 +14,62 @@
static void generatePolyGone(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output )
{
if (input.Size()<3) {
if (input.size()<3) {
return;
}
// TODO : Regenerate a linear poligone generation
for (int32_t iii=1; iii<input.Size()-1; iii++) {
output.PushBack(input[0]);
output.PushBack(input[iii]);
output.PushBack(input[iii+1]);
for (int32_t iii=1; iii<input.size()-1; iii++) {
output.pushBack(input[0]);
output.pushBack(input[iii]);
output.pushBack(input[iii+1]);
}
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
//EWOL_DEBUG("generate Plygone : " << input.size() << " == > " << output.size() );
}
static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & output, float sx, float sy, float ex, float ey)
{
// with Sutherland-Hodgman-Algorithm
if (input.Size() <0) {
if (input.size() <0) {
return;
}
//int32_t sizeInit=input.Size();
//int32_t sizeInit=input.size();
// last element :
vec2 destPoint;
vec2 lastElement = input[input.Size()-1];
vec2 lastElement = input[input.size()-1];
bool inside = true;
if (lastElement.x < sx) {
inside = false;
}
//EWOL_DEBUG("generate an crop : ");
for(int32_t iii=0; iii<input.Size(); iii++) {
for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].x < sx) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//EWOL_DEBUG("element IN == > OUT ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb;
destPoint.x = sx;
output.PushBack(destPoint);
output.pushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
//EWOL_DEBUG("element OUT == > OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
//EWOL_DEBUG("element IN == > IN ");
output.pushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//EWOL_DEBUG("element OUT == > IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb;
destPoint.x = sx;
output.PushBack(destPoint);
output.PushBack(input[iii]);
output.pushBack(destPoint);
output.pushBack(input[iii]);
}
inside = true;
}
@ -78,43 +78,43 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
lastElement.y = input[iii].y;
}
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() << "intermediate (1)");
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " == > " << output.size() << "intermediate (1)");
input = output;
output.Clear();
lastElement = input[input.Size()-1];
output.clear();
lastElement = input[input.size()-1];
inside = true;
if (lastElement.y < sy) {
inside = false;
}
for(int32_t iii=0; iii<input.Size(); iii++) {
for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].y < sy) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//EWOL_DEBUG("element IN == > OUT ");
//new point intersection ...
//x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy;
destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint);
output.pushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
//EWOL_DEBUG("element OUT == > OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
//EWOL_DEBUG("element IN == > IN ");
output.pushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//EWOL_DEBUG("element OUT == > IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy;
destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint);
output.PushBack(input[iii]);
output.pushBack(destPoint);
output.pushBack(input[iii]);
}
inside = true;
}
@ -124,42 +124,42 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
}
input = output;
output.Clear();
lastElement = input[input.Size()-1];
output.clear();
lastElement = input[input.size()-1];
inside = true;
if (lastElement.x > ex) {
inside = false;
}
//EWOL_DEBUG("generate an crop : ");
for(int32_t iii=0; iii<input.Size(); iii++) {
for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].x > ex) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//EWOL_DEBUG("element IN == > OUT ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb;
destPoint.x = ex;
output.PushBack(destPoint);
output.pushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
//EWOL_DEBUG("element OUT == > OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
//EWOL_DEBUG("element IN == > IN ");
output.pushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//EWOL_DEBUG("element OUT == > IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb;
destPoint.x = ex;
output.PushBack(destPoint);
output.PushBack(input[iii]);
output.pushBack(destPoint);
output.pushBack(input[iii]);
}
inside = true;
}
@ -169,41 +169,41 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
}
input = output;
output.Clear();
lastElement = input[input.Size()-1];
output.clear();
lastElement = input[input.size()-1];
inside = true;
if (lastElement.y > ey) {
inside = false;
}
for(int32_t iii=0; iii<input.Size(); iii++) {
for(int32_t iii=0; iii<input.size(); iii++) {
if(input[iii].y > ey) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//EWOL_DEBUG("element IN == > OUT ");
//new point intersection ...
//x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey;
destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint);
output.pushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
//EWOL_DEBUG("element OUT == > OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
//EWOL_DEBUG("element IN == > IN ");
output.pushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//EWOL_DEBUG("element OUT == > IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey;
destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint);
output.PushBack(input[iii]);
output.pushBack(destPoint);
output.pushBack(input[iii]);
}
inside = true;
}
@ -213,7 +213,7 @@ static void SutherlandHodgman(etk::Vector<vec2 > & input, etk::Vector<vec2 > & o
}
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() );
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " == > " << output.size() );
}
#endif
@ -231,7 +231,7 @@ ewol::Drawing::Drawing(void) :
m_thickness(0.0),
m_triElement(0)
{
LoadProgram();
loadProgram();
for (int32_t iii=0; iii<3; iii++) {
m_triangle[iii] = m_position;
m_tricolor[iii] = m_color;
@ -241,23 +241,23 @@ ewol::Drawing::Drawing(void) :
ewol::Drawing::~Drawing(void)
{
UnLoadProgram();
unLoadProgram();
}
void ewol::Drawing::GenerateTriangle(void)
void ewol::Drawing::generateTriangle(void)
{
m_triElement = 0;
m_coord.PushBack(m_triangle[0]);
m_coordColor.PushBack(m_tricolor[0]);
m_coord.PushBack(m_triangle[1]);
m_coordColor.PushBack(m_tricolor[1]);
m_coord.PushBack(m_triangle[2]);
m_coordColor.PushBack(m_tricolor[2]);
m_coord.pushBack(m_triangle[0]);
m_coordColor.pushBack(m_tricolor[0]);
m_coord.pushBack(m_triangle[1]);
m_coordColor.pushBack(m_tricolor[1]);
m_coord.pushBack(m_triangle[2]);
m_coordColor.pushBack(m_tricolor[2]);
}
void ewol::Drawing::InternalSetColor(const etk::Color<>& _color)
void ewol::Drawing::internalSetColor(const etk::Color<>& _color)
{
if (m_triElement < 1) {
m_tricolor[0] = _color;
@ -271,72 +271,72 @@ void ewol::Drawing::InternalSetColor(const etk::Color<>& _color)
}
void ewol::Drawing::SetPoint(const vec3& _point)
void ewol::Drawing::setPoint(const vec3& _point)
{
m_triangle[m_triElement] = _point;
m_triElement++;
if (m_triElement>=3) {
GenerateTriangle();
if (m_triElement >= 3) {
generateTriangle();
}
}
void ewol::Drawing::ResetCount(void)
void ewol::Drawing::resetCount(void)
{
m_triElement = 0;
}
void ewol::Drawing::UnLoadProgram(void)
void ewol::Drawing::unLoadProgram(void)
{
ewol::Program::Release(m_GLprogram);
ewol::Program::release(m_GLprogram);
}
void ewol::Drawing::LoadProgram(void)
void ewol::Drawing::loadProgram(void)
{
// remove previous loading ... in case
UnLoadProgram();
unLoadProgram();
// oad the new ...
m_GLprogram = ewol::Program::Keep("DATA:color3.prog");
m_GLprogram = ewol::Program::keep("DATA:color3.prog");
// get the shader resource :
if (NULL != m_GLprogram ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
}
}
void ewol::Drawing::Draw(bool _disableDepthTest)
void ewol::Drawing::draw(bool _disableDepthTest)
{
if (m_coord.Size()<=0) {
if (m_coord.size() <= 0) {
// TODO : a remÚtre ...
//EWOL_WARNING("Nothink to draw...");
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply;
m_GLprogram->Use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
// color :
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size());
m_GLprogram->UnUse();
ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->unUse();
}
void ewol::Drawing::Clear(void)
void ewol::Drawing::clear(void)
{
// call upper class
ewol::Compositing::Clear();
// Reset Buffer :
m_coord.Clear();
m_coordColor.Clear();
// Reset temporal variables :
ewol::Compositing::clear();
// reset Buffer :
m_coord.clear();
m_coordColor.clear();
// reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0);
m_clippingPosStart = vec3(0.0, 0.0, 0.0);
@ -352,7 +352,7 @@ void ewol::Drawing::Clear(void)
}
}
void ewol::Drawing::SetClipping(const vec3& _pos, const vec3& _posEnd)
void ewol::Drawing::setClipping(const vec3& _pos, const vec3& _posEnd)
{
// note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) {
@ -380,7 +380,7 @@ void ewol::Drawing::SetClipping(const vec3& _pos, const vec3& _posEnd)
}
void ewol::Drawing::SetThickness(float _thickness)
void ewol::Drawing::setThickness(float _thickness)
{
m_thickness = _thickness;
// thickness must be positive
@ -389,16 +389,16 @@ void ewol::Drawing::SetThickness(float _thickness)
}
}
void ewol::Drawing::AddVertex(void)
void ewol::Drawing::addVertex(void)
{
InternalSetColor(m_color);
SetPoint(m_position);
internalSetColor(m_color);
setPoint(m_position);
}
void ewol::Drawing::LineTo(const vec3& _dest)
void ewol::Drawing::lineTo(const vec3& _dest)
{
ResetCount();
InternalSetColor(m_color);
resetCount();
internalSetColor(m_color);
EWOL_VERBOSE("DrawLine : " << m_position << " to " << _dest);
if (m_position.x() == _dest.x() && m_position.y() == _dest.y() && m_position.z() == _dest.z()) {
EWOL_WARNING("Try to draw an line width 0");
@ -420,21 +420,21 @@ void ewol::Drawing::LineTo(const vec3& _dest)
float offsety = sin(teta-M_PI/2) * (m_thickness/2);
float offsetx = cos(teta-M_PI/2) * (m_thickness/2);
SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) );
SetPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) );
SetPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) );
setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, m_position.z()) );
setPoint(vec3(m_position.x() + offsetx, m_position.y() + offsety, m_position.z()) );
setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, m_position.z()) );
SetPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) );
SetPoint(vec3(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) );
SetPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) );
setPoint(vec3(_dest.x() + offsetx, _dest.y() + offsety, _dest.z()) );
setPoint(vec3(_dest.x() - offsetx, _dest.y() - offsety, _dest.z()) );
setPoint(vec3(m_position.x() - offsetx, m_position.y() - offsety, _dest.z()) );
// update the system position :
m_position = _dest;
}
void ewol::Drawing::Rectangle(const vec3& _dest)
void ewol::Drawing::rectangle(const vec3& _dest)
{
ResetCount();
InternalSetColor(m_color);
resetCount();
internalSetColor(m_color);
/* Bitmap position
* xA xB
* yC *------*
@ -476,23 +476,23 @@ void ewol::Drawing::Rectangle(const vec3& _dest)
|| dxA >= dxB) {
return;
}
SetPoint(vec3(dxA, dyD, 0) );
SetPoint(vec3(dxA, dyC, 0) );
SetPoint(vec3(dxB, dyC, 0) );
setPoint(vec3(dxA, dyD, 0) );
setPoint(vec3(dxA, dyC, 0) );
setPoint(vec3(dxB, dyC, 0) );
SetPoint(vec3(dxB, dyC, 0) );
SetPoint(vec3(dxB, dyD, 0) );
SetPoint(vec3(dxA, dyD, 0) );
setPoint(vec3(dxB, dyC, 0) );
setPoint(vec3(dxB, dyD, 0) );
setPoint(vec3(dxA, dyD, 0) );
}
void ewol::Drawing::Cube(const vec3& _dest)
void ewol::Drawing::cube(const vec3& _dest)
{
}
void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
void ewol::Drawing::circle(float _radius, float _angleStart, float _angleStop)
{
ResetCount();
resetCount();
if (_radius<0) {
_radius *= -1;
@ -508,9 +508,9 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
// display background :
if (m_colorBg.a()!=0) {
InternalSetColor(m_colorBg);
internalSetColor(m_colorBg);
for (int32_t iii=0; iii<nbOcurence; iii++) {
SetPoint(vec3(m_position.x(),
setPoint(vec3(m_position.x(),
m_position.y(),
0) );
@ -518,7 +518,7 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
float offsety = sin(angleOne) * _radius;
float offsetx = cos(angleOne) * _radius;
SetPoint(vec3(m_position.x() + offsetx,
setPoint(vec3(m_position.x() + offsetx,
m_position.y() + offsety,
0) );
@ -526,18 +526,18 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
offsety = sin(angleTwo) * _radius;
offsetx = cos(angleTwo) * _radius;
SetPoint(vec3(m_position.x() + offsetx,
setPoint(vec3(m_position.x() + offsetx,
m_position.y() + offsety,
0) );
}
}
// show if we have a border :
if( m_thickness==0
|| m_color.a()==0) {
if( m_thickness == 0
|| m_color.a() == 0) {
return;
}
InternalSetColor(m_color);
internalSetColor(m_color);
for (int32_t iii=0; iii<nbOcurence; iii++) {
float angleOne = _angleStart + (_angleStop* iii / nbOcurence) ;
@ -552,13 +552,13 @@ void ewol::Drawing::Circle(float _radius, float _angleStart, float _angleStop)
float offsetInt2y = sin(angleTwo) * (_radius-m_thickness/2);
float offsetInt2x = cos(angleTwo) * (_radius-m_thickness/2);
SetPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
SetPoint(vec3(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0));
SetPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
setPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
setPoint(vec3(m_position.x() + offsetExtx, m_position.y() + offsetExty, 0));
setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
SetPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
SetPoint(vec3(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0));
SetPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
setPoint(vec3(m_position.x() + offsetExt2x, m_position.y() + offsetExt2y, 0));
setPoint(vec3(m_position.x() + offsetInt2x, m_position.y() + offsetInt2y, 0));
setPoint(vec3(m_position.x() + offsetIntx, m_position.y() + offsetInty, 0));
}
}

View File

@ -47,13 +47,13 @@ namespace ewol
~Drawing(void);
private:
/**
* @brief Load the openGL program and get all the ID needed
* @brief load the openGL program and get all the ID needed
*/
void LoadProgram(void);
void loadProgram(void);
/**
* @brief Un-Load the openGL program and get all the ID needed
*/
void UnLoadProgram(void);
void unLoadProgram(void);
float m_thickness; //!< when drawing line and other things
int32_t m_triElement; //!< special counter of the single dot generated
vec3 m_triangle[3]; //!< Register every system with a combinaison of tiangle
@ -62,122 +62,122 @@ namespace ewol
/**
* @brief Lunch the generation of triangle
*/
void GenerateTriangle(void);
void generateTriangle(void);
/**
* @brief in case of some error the count can be reset
*/
void ResetCount(void);
void resetCount(void);
/**
* @brief Set the Color of the current triangle drawing
* @brief set the Color of the current triangle drawing
* @param[in] _color Color to current dots generated
*/
void InternalSetColor(const etk::Color<>& _color);
void internalSetColor(const etk::Color<>& _color);
/**
* @brief internal add of the specific point
* @param[in] _point The requeste dpoint to add
*/
void SetPoint(const vec3& point);
void setPoint(const vec3& point);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
* @brief draw All the refistered text in the current element on openGL
*/
void Draw(bool _disableDepthTest=true);
void draw(bool _disableDepthTest=true);
/**
* @brief Clear alll tre registered element in the current element
* @brief clear alll tre registered element in the current element
*/
void Clear(void);
void clear(void);
/**
* @brief Get the current display position (sometime needed in the gui control)
* @brief get the current display position (sometime needed in the gui control)
* @return the current position.
*/
const vec3& GetPos(void) { return m_position; };
const vec3& getPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(), _pos.y(), 0)); };
void setPos(const vec3& _pos) { m_position = _pos; };
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(), _pos.y(), 0)); };
/**
* @brief Set relative position for the next text writen
* @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(), _pos.y(), 0)); };
void setRelPos(const vec3& _pos) { m_position += _pos; };
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(), _pos.y(), 0)); };
/**
* @brief Set the Color of the current foreground font
* @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print)
*/
void SetColor(const etk::Color<>& _color) { m_color = _color; };
void setColor(const etk::Color<>& _color) { m_color = _color; };
/**
* @brief Set the background color of the font (for selected Text (not the global BG))
* @brief set the background color of the font (for selected Text (not the global BG))
* @param[in] _color Color to set on background (for next print)
*/
void SetColorBg(const etk::Color<>& _color) { m_colorBg = _color; };
void setColorBg(const etk::Color<>& _color) { m_colorBg = _color; };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in]_ pos Start position of the clipping
* @param[in] _width Width size of the clipping
*/
void SetClippingWidth(const vec3& _pos, const vec3& _width) { SetClipping(_pos, _pos+_width); };
inline void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2)); };
void setClippingWidth(const vec3& _pos, const vec3& _width) { setClipping(_pos, _pos+_width); };
inline void setClippingWidth(const vec2& _pos, const vec2& _width) { setClippingWidth(vec3(_pos.x(),_pos.y(),-1), vec3(_width.x(),_width.y(), 2)); };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping
*/
void SetClipping(const vec3& _pos, const vec3& _posEnd);
inline void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1)); };
void setClipping(const vec3& _pos, const vec3& _posEnd);
inline void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(), 1)); };
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief enable/Disable the clipping (without lose the current clipping position)
* @brief _newMode The new status of the clipping
*/
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
void setClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
/**
* @brief Specify the line thickness for the next elements
* @param[in] _thickness The thickness disired for the next print
*/
void SetThickness(float _thickness);
void setThickness(float _thickness);
/**
* @brief Add a point reference at the current position (this is a vertex reference at the current position
* @brief add a point reference at the current position (this is a vertex reference at the current position
*/
void AddVertex(void);
void addVertex(void);
/**
* @brief Draw a line to a specific position
* @brief draw a line to a specific position
* @param[in] _dest Position of the end of the line.
*/
void LineTo(const vec3& _dest);
inline void LineTo(const vec2& _dest) { LineTo(vec3(_dest.x(), _dest.y(), 0)); };
void lineTo(const vec3& _dest);
inline void lineTo(const vec2& _dest) { lineTo(vec3(_dest.x(), _dest.y(), 0)); };
/**
* @brief Relative drawing a line (spacial vector)
* @param[in] _vect Vector of the curent line.
*/
void LineRel(const vec3& _vect) { LineTo(m_position+_vect); };
inline void LineRel(const vec2& _vect) { LineRel(vec3(_vect.x(), _vect.y(), 0)); };
void lineRel(const vec3& _vect) { lineTo(m_position+_vect); };
inline void lineRel(const vec2& _vect) { lineRel(vec3(_vect.x(), _vect.y(), 0)); };
/**
* @brief Draw a 2D rectangle to the position requested.
* @brief draw a 2D rectangle to the position requested.
* @param[in] _dest Position the the end of the rectangle
*/
void Rectangle(const vec3& _dest);
inline void Rectangle(const vec2& _dest) { Rectangle(vec3(_dest.x(), _dest.y(), 0)); };
void rectangle(const vec3& _dest);
inline void rectangle(const vec2& _dest) { rectangle(vec3(_dest.x(), _dest.y(), 0)); };
/**
* @brief Draw a 2D rectangle to the requested size.
* @brief draw a 2D rectangle to the requested size.
* @param[in] _size size of the rectangle
*/
void RectangleWidth(const vec3& _size) { Rectangle(m_position+_size); };
inline void RectangleWidth(const vec2& _size) { RectangleWidth(vec3(_size.x(), _size.y(), 0)); };
void rectangleWidth(const vec3& _size) { rectangle(m_position+_size); };
inline void rectangleWidth(const vec2& _size) { rectangleWidth(vec3(_size.x(), _size.y(), 0)); };
/**
* @brief Draw a 3D rectangle to the position requested.
* @brief draw a 3D rectangle to the position requested.
* @param[in] _dest Position the the end of the rectangle
*/
void Cube(const vec3& _dest);
void cube(const vec3& _dest);
/**
* @brief Draw a 2D circle with the specify rafdius parameter.
* @brief draw a 2D circle with the specify rafdius parameter.
* @param[in] _radius Distence to the dorder
* @param[in] _angleStart start angle of this circle ([0..2PI] otherwithe ==> disable)
* @param[in] _angleStop stop angle of this circle ([0..2PI] otherwithe ==> disable)
* @param[in] _angleStart start angle of this circle ([0..2PI] otherwithe == > disable)
* @param[in] _angleStop stop angle of this circle ([0..2PI] otherwithe == > disable)
*/
void Circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
void circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
};
};

View File

@ -27,33 +27,33 @@ ewol::Image::Image(const etk::UString& _imageName) :
m_GLtexID(-1),
m_resource(NULL)
{
SetSource(_imageName);
LoadProgram();
setSource(_imageName);
loadProgram();
}
ewol::Image::~Image(void)
{
ewol::TextureFile::Release(m_resource);
ewol::Program::Release(m_GLprogram);
ewol::TextureFile::release(m_resource);
ewol::Program::release(m_GLprogram);
}
void ewol::Image::LoadProgram(void)
void ewol::Image::loadProgram(void)
{
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep("DATA:textured3D.prog");
m_GLprogram = ewol::Program::keep("DATA:textured3D.prog");
if (NULL!=m_GLprogram) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->getUniform("EW_texID");
}
}
void ewol::Image::Draw(bool _disableDepthTest)
void ewol::Image::draw(bool _disableDepthTest)
{
if (m_coord.Size()<=0) {
if (m_coord.size() <= 0) {
//EWOL_WARNING("Nothink to draw...");
return;
}
@ -61,41 +61,41 @@ void ewol::Image::Draw(bool _disableDepthTest)
// this is a normale case ... the user can choice to have no image ...
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
if (_disableDepthTest == true) {
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST);
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
} else {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST);
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
}
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix()*m_matrixApply;
m_GLprogram->Use();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
mat4 tmpMatrix = ewol::openGL::getMatrix()*m_matrixApply;
m_GLprogram->use();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// TextureID
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
m_GLprogram->setTexture0(m_GLtexID, m_resource->getId());
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &m_coord[0], 4*sizeof(btScalar));
// Texture :
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
m_GLprogram->sendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
// color :
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
m_GLprogram->sendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, m_coord.Size());
m_GLprogram->UnUse();
ewol::openGL::drawArrays(GL_TRIANGLES, 0, m_coord.size());
m_GLprogram->unUse();
}
void ewol::Image::Clear(void)
void ewol::Image::clear(void)
{
// call upper class
ewol::Compositing::Clear();
// Reset Buffer :
m_coord.Clear();
m_coordTex.Clear();
m_coordColor.Clear();
// Reset temporal variables :
ewol::Compositing::clear();
// reset Buffer :
m_coord.clear();
m_coordTex.clear();
m_coordColor.clear();
// reset temporal variables :
m_position = vec3(0.0, 0.0, 0.0);
m_clippingPosStart = vec3(0.0, 0.0, 0.0);
m_clippingPosStop = vec3(0.0, 0.0, 0.0);
@ -104,7 +104,7 @@ void ewol::Image::Clear(void)
m_angle = 0.0;
}
void ewol::Image::SetClipping(const vec3& _pos, vec3 _posEnd)
void ewol::Image::setClipping(const vec3& _pos, vec3 _posEnd)
{
// note the internal system all time request to have a bounding all time in the same order
if (_pos.x() <= _posEnd.x()) {
@ -131,61 +131,61 @@ void ewol::Image::SetClipping(const vec3& _pos, vec3 _posEnd)
m_clippingEnable = true;
}
void ewol::Image::SetAngle(float _angle)
void ewol::Image::setAngle(float _angle)
{
m_angle = _angle;
}
void ewol::Image::Print(const vec2& _size)
void ewol::Image::print(const vec2& _size)
{
PrintPart(_size, vec2(0,0), vec2(1,1));
printPart(_size, vec2(0,0), vec2(1,1));
}
void ewol::Image::PrintPart(const vec2& _size,
void ewol::Image::printPart(const vec2& _size,
const vec2& _sourcePosStart,
const vec2& _sourcePosStop)
{
if (m_angle==0.0f) {
if (m_angle == 0.0f) {
vec3 point = m_position;
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
point.setX(m_position.x() + _size.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
point.setX(m_position.x() + _size.x());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
point.setX(m_position.x());
point.setY(m_position.y() + _size.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
point.setX(m_position.x());
point.setY(m_position.y());
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
return;
}
vec3 center = m_position + vec3(_size.x(),_size.y(),0)/2.0f;
@ -196,73 +196,73 @@ void ewol::Image::PrintPart(const vec2& _size,
point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
point.setValue(limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
point.setValue(limitedSize.x(), limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
point.setValue(-limitedSize.x(), limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotate(vec3(0,0,1), m_angle) + center;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
m_coord.pushBack(point);
m_coordTex.pushBack(tex);
m_coordColor.pushBack(m_color);
}
void ewol::Image::SetSource(const etk::UString& _newFile, const vec2& _size)
void ewol::Image::setSource(const etk::UString& _newFile, const vec2& _size)
{
Clear();
clear();
// remove old one
ewol::TextureFile::Release(m_resource);
ewol::TextureFile::release(m_resource);
ivec2 tmpSize(_size.x(),_size.y());
// note that no image can be loaded...
if (_newFile != "") {
// link to new One
m_resource = ewol::TextureFile::Keep(_newFile, tmpSize);
// link to new one
m_resource = ewol::TextureFile::keep(_newFile, tmpSize);
if (NULL == m_resource) {
EWOL_ERROR("Can not get Image resource");
}
}
}
bool ewol::Image::HasSources(void)
bool ewol::Image::hasSources(void)
{
return m_resource!=NULL;
}
vec2 ewol::Image::GetRealSize(void)
vec2 ewol::Image::getRealSize(void)
{
if (NULL==m_resource) {
if (NULL == m_resource) {
return vec2(0,0);
}
return m_resource->GetRealSize();
return m_resource->getRealSize();
}

View File

@ -39,9 +39,9 @@ namespace ewol
etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
private:
/**
* @brief Load the openGL program and get all the ID needed
* @brief load the openGL program and get all the ID needed
*/
void LoadProgram(void);
void loadProgram(void);
public:
/**
* @brief generic constructor
@ -54,92 +54,92 @@ namespace ewol
virtual ~Image(void);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
* @param[in] _disableDepthTest Disable the Depth test for display
* @brief draw All the refistered text in the current element on openGL
* @param[in] _disableDepthTest disable the Depth test for display
*/
void Draw(bool _disableDepthTest=true);
void draw(bool _disableDepthTest=true);
/**
* @brief Clear alll tre registered element in the current element
* @brief clear alll tre registered element in the current element
*/
void Clear(void);
void clear(void);
/**
* @brief Get the current display position (sometime needed in the gui control)
* @brief get the current display position (sometime needed in the gui control)
* @return the current position.
*/
const vec3& GetPos(void) { return m_position; };
const vec3& getPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(const vec3& _pos) { m_position = _pos; };
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); };
void setPos(const vec3& _pos) { m_position = _pos; };
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set relative position for the next text writen
* @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(const vec3& _pos) { m_position += _pos; };
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); };
void setRelPos(const vec3& _pos) { m_position += _pos; };
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set the Color of the current foreground font
* @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print)
*/
void SetColor(const etk::Color<>& _color) { m_color = _color; };
void setColor(const etk::Color<>& _color) { m_color = _color; };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping
*/
void SetClippingWidth(const vec3& _pos, vec3 _width) { SetClipping(_pos, _pos+_width); };
inline void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClippingWidth(vec3(_pos.x(),_pos.y(),0), vec3(_width.x(),_width.y(),0)); };
void setClippingWidth(const vec3& _pos, vec3 _width) { setClipping(_pos, _pos+_width); };
inline void setClippingWidth(const vec2& _pos, const vec2& _width) { setClippingWidth(vec3(_pos.x(),_pos.y(),0), vec3(_width.x(),_width.y(),0)); };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping
*/
void SetClipping(const vec3& _pos, vec3 _posEnd);
inline void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),0), vec3(_posEnd.x(),_posEnd.y(),0)); };
void setClipping(const vec3& _pos, vec3 _posEnd);
inline void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),0), vec3(_posEnd.x(),_posEnd.y(),0)); };
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief enable/Disable the clipping (without lose the current clipping position)
* @brief _newMode The new status of the clipping
*/
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
void setClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
/**
* @brief Set a unique rotation of this element (not set in the Rotate Generic system)
* @brief set a unique rotation of this element (not set in the rotate Generic system)
* @param[in] _angle Angle to set in radiant.
*/
void SetAngle(float _angleRad);
void setAngle(float _angleRad);
/**
* @brief Add a compleate of the image to display with the requested size
* @param[in] _size Size of the output image
* @brief add a compleate of the image to display with the requested size
* @param[in] _size size of the output image
*/
void Print(const ivec2& _size) { Print(vec2(_size.x(),_size.y())); };
void Print(const vec2& _size);
void print(const ivec2& _size) { print(vec2(_size.x(),_size.y())); };
void print(const vec2& _size);
/**
* @brief Add a part of the image to display with the requested size
* @param[in] _size Size of the output image
* @brief add a part of the image to display with the requested size
* @param[in] _size size of the output image
* @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image).
* @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
*/
void PrintPart(const vec2& _size,
void printPart(const vec2& _size,
const vec2& _sourcePosStart,
const vec2& _sourcePosStop);
/**
* @brief Change the image Source ==> can not be done to display 2 images at the same time ...
* @brief change the image Source == > can not be done to display 2 images at the same time ...
* @param[in] _newFile New file of the Image
* @param[in] _size for the image when Verctorial image loading is requested
*/
void SetSource(const etk::UString& _newFile, int32_t _size=32) { SetSource(_newFile, vec2(_size,_size)); };
void SetSource(const etk::UString& _newFile, const vec2& _size);
void setSource(const etk::UString& _newFile, int32_t _size=32) { setSource(_newFile, vec2(_size,_size)); };
void setSource(const etk::UString& _newFile, const vec2& _size);
/**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources.
*/
bool HasSources(void);
bool hasSources(void);
/**
* @brief Get the source image registered size in the file (<0 when multiple size image)
* @brief get the source image registered size in the file (<0 when multiple size image)
* @return tre image registered size
*/
vec2 GetRealSize(void);
vec2 getRealSize(void);
};
};

View File

@ -39,111 +39,111 @@ ewol::Shaper::Shaper(const etk::UString& _shaperName) :
m_stateNew(0),
m_stateTransition(1.0)
{
LoadProgram();
UpdateVertex();
loadProgram();
updateVertex();
}
ewol::Shaper::~Shaper(void)
{
UnLoadProgram();
unLoadProgram();
}
void ewol::Shaper::UnLoadProgram(void)
void ewol::Shaper::unLoadProgram(void)
{
ewol::Program::Release(m_GLprogram);
ewol::TextureFile::Release(m_resourceTexture);
ewol::ConfigFile::Release(m_config);
ewol::Program::release(m_GLprogram);
ewol::TextureFile::release(m_resourceTexture);
ewol::ConfigFile::release(m_config);
}
void ewol::Shaper::LoadProgram(void)
void ewol::Shaper::loadProgram(void)
{
if (m_name=="") {
if (m_name == "") {
EWOL_DEBUG("no Shaper set for loading resources ...");
return;
}
m_config = ewol::ConfigFile::Keep(m_name);
m_config = ewol::ConfigFile::keep(m_name);
if (NULL != m_config) {
m_confIdPaddingX = m_config->Request("PaddingX");
m_confIdPaddingY = m_config->Request("PaddingY");
m_confIdChangeTime = m_config->Request("ChangeTime");
m_confProgramFile = m_config->Request("program");
m_confImageFile = m_config->Request("image");
m_confIdPaddingX = m_config->request("PaddingX");
m_confIdPaddingY = m_config->request("PaddingY");
m_confIdChangeTime = m_config->request("ChangeTime");
m_confProgramFile = m_config->request("program");
m_confImageFile = m_config->request("image");
}
etk::UString basicShaderFile = m_config->GetString(m_confProgramFile);
etk::UString basicShaderFile = m_config->getString(m_confProgramFile);
if (basicShaderFile!="") {
// Get the relative position of the current file ...
// get the relative position of the current file ...
etk::FSNode file(m_name);
etk::UString tmpFilename = file.GetRelativeFolder() + basicShaderFile;
etk::UString tmpFilename = file.getRelativeFolder() + basicShaderFile;
EWOL_DEBUG("Shaper try load shader : " << tmpFilename << " with base : " << basicShaderFile);
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep(tmpFilename);
m_GLprogram = ewol::Program::keep(tmpFilename);
if (NULL !=m_GLprogram) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
// Widget property ==> for the Vertex shader
m_GLPropertySize = m_GLprogram->GetUniform("EW_widgetProperty.size");
m_GLPropertyOrigin = m_GLprogram->GetUniform("EW_widgetProperty.origin");
m_GLPropertyInsidePos = m_GLprogram->GetUniform("EW_widgetProperty.insidePos");
m_GLPropertyInsideSize = m_GLprogram->GetUniform("EW_widgetProperty.insideSize");
// status property ==> for the fragment shader
m_GLStateOld = m_GLprogram->GetUniform("EW_status.stateOld");
m_GLStateNew = m_GLprogram->GetUniform("EW_status.stateNew");
m_GLStateTransition = m_GLprogram->GetUniform("EW_status.transition");
m_GLPosition = m_GLprogram->getAttribute("EW_coord2d");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
// Widget property == > for the Vertex shader
m_GLPropertySize = m_GLprogram->getUniform("EW_widgetProperty.size");
m_GLPropertyOrigin = m_GLprogram->getUniform("EW_widgetProperty.origin");
m_GLPropertyInsidePos = m_GLprogram->getUniform("EW_widgetProperty.insidePos");
m_GLPropertyInsideSize = m_GLprogram->getUniform("EW_widgetProperty.insideSize");
// status property == > for the fragment shader
m_GLStateOld = m_GLprogram->getUniform("EW_status.stateOld");
m_GLStateNew = m_GLprogram->getUniform("EW_status.stateNew");
m_GLStateTransition = m_GLprogram->getUniform("EW_status.transition");
// for the texture ID :
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
m_GLtexID = m_GLprogram->getUniform("EW_texID");
}
etk::UString basicImageFile = m_config->GetString(m_confImageFile);
etk::UString basicImageFile = m_config->getString(m_confImageFile);
if (basicImageFile != "") {
tmpFilename = file.GetRelativeFolder() + basicImageFile;
tmpFilename = file.getRelativeFolder() + basicImageFile;
ivec2 size(64,64);
m_resourceTexture = ewol::TextureFile::Keep(tmpFilename, size);
m_resourceTexture = ewol::TextureFile::keep(tmpFilename, size);
}
}
}
void ewol::Shaper::Draw(bool _disableDepthTest)
void ewol::Shaper::draw(bool _disableDepthTest)
{
if (m_config == NULL) {
// this is a normale case ... the user can choice to have no config basic file ...
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
//glScalef(m_scaling.x, m_scaling.y, 1.0);
m_GLprogram->Use();
m_GLprogram->use();
// set Matrix : translation/positionMatrix
mat4 tmpMatrix = ewol::openGL::GetMatrix();
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
mat4 tmpMatrix = ewol::openGL::getMatrix();
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position :
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, m_coord);
m_GLprogram->sendAttribute(m_GLPosition, 2/*x,y*/, m_coord);
// all entry parameters :
m_GLprogram->Uniform2(m_GLPropertySize, m_propertySize);
m_GLprogram->Uniform2(m_GLPropertyOrigin, m_propertyOrigin);
m_GLprogram->Uniform2(m_GLPropertyInsidePos, m_propertyInsidePosition);
m_GLprogram->Uniform2(m_GLPropertyInsideSize, m_propertyInsideSize);
m_GLprogram->Uniform1i(m_GLStateOld, m_stateOld);
m_GLprogram->Uniform1i(m_GLStateNew, m_stateNew);
m_GLprogram->Uniform1f(m_GLStateTransition, m_stateTransition);
m_GLprogram->uniform2(m_GLPropertySize, m_propertySize);
m_GLprogram->uniform2(m_GLPropertyOrigin, m_propertyOrigin);
m_GLprogram->uniform2(m_GLPropertyInsidePos, m_propertyInsidePosition);
m_GLprogram->uniform2(m_GLPropertyInsideSize, m_propertyInsideSize);
m_GLprogram->uniform1i(m_GLStateOld, m_stateOld);
m_GLprogram->uniform1i(m_GLStateNew, m_stateNew);
m_GLprogram->uniform1f(m_GLStateTransition, m_stateTransition);
if (NULL!=m_resourceTexture) {
// TextureID
m_GLprogram->SetTexture0(m_GLtexID, m_resourceTexture->GetId());
m_GLprogram->setTexture0(m_GLtexID, m_resourceTexture->getId());
}
// Request the draw of the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, 6);
m_GLprogram->UnUse();
ewol::openGL::drawArrays(GL_TRIANGLES, 0, 6);
m_GLprogram->unUse();
}
void ewol::Shaper::Clear(void)
void ewol::Shaper::clear(void)
{
// nothing to do ...
}
bool ewol::Shaper::ChangeStatusIn(int32_t _newStatusId)
bool ewol::Shaper::changeStatusIn(int32_t _newStatusId)
{
if (_newStatusId != m_stateNew) {
m_nextStatusRequested = _newStatusId;
@ -156,11 +156,11 @@ bool ewol::Shaper::ChangeStatusIn(int32_t _newStatusId)
return false;
}
bool ewol::Shaper::PeriodicCall(const ewol::EventTime& _event)
bool ewol::Shaper::periodicCall(const ewol::EventTime& _event)
{
//EWOL_DEBUG("call=" << _event);
// start :
if (m_stateTransition>=1.0) {
if (m_stateTransition >= 1.0) {
m_stateOld = m_stateNew;
if( m_nextStatusRequested != -1
&& m_nextStatusRequested != m_stateOld) {
@ -186,9 +186,9 @@ bool ewol::Shaper::PeriodicCall(const ewol::EventTime& _event)
m_nextStatusRequested = -1;
}
}
float timeRelativity = m_config->GetFloat(m_confIdChangeTime)/1000.0;
m_stateTransition += _event.GetDeltaCall()/timeRelativity;
//m_stateTransition += _event.GetDeltaCall();
float timeRelativity = m_config->getFloat(m_confIdChangeTime)/1000.0;
m_stateTransition += _event.getDeltaCall()/timeRelativity;
//m_stateTransition += _event.getDeltaCall();
m_stateTransition = etk_avg(0.0f, m_stateTransition, 1.0f);
//EWOL_DEBUG("relative=" << timeRelativity << " Transition : " << m_stateTransition);
}
@ -196,9 +196,9 @@ bool ewol::Shaper::PeriodicCall(const ewol::EventTime& _event)
}
void ewol::Shaper::UpdateVertex(void)
void ewol::Shaper::updateVertex(void)
{
// set coord ==> must be a static VBO ...
// set coord == > must be a static VBO ...
m_coord[0].setValue( m_propertyOrigin.x(),
m_propertyOrigin.y()+m_propertySize.y());
m_coord[1].setValue( m_propertyOrigin.x(),
@ -214,54 +214,54 @@ void ewol::Shaper::UpdateVertex(void)
m_propertyOrigin.y()+m_propertySize.y());
}
void ewol::Shaper::SetOrigin(const vec2& _newOri)
void ewol::Shaper::setOrigin(const vec2& _newOri)
{
if (m_propertyOrigin != _newOri) {
m_propertyOrigin = _newOri;
UpdateVertex();
updateVertex();
}
}
void ewol::Shaper::SetSize(const vec2& _newSize)
void ewol::Shaper::setSize(const vec2& _newSize)
{
if (m_propertySize != _newSize) {
m_propertySize = _newSize;
UpdateVertex();
updateVertex();
}
}
void ewol::Shaper::SetInsideSize(const vec2& _newInsideSize)
void ewol::Shaper::setInsideSize(const vec2& _newInsideSize)
{
m_propertyInsideSize = _newInsideSize;
}
void ewol::Shaper::SetInsidePos(const vec2& _newInsidePos)
void ewol::Shaper::setInsidePos(const vec2& _newInsidePos)
{
m_propertyInsidePosition = _newInsidePos;
}
vec2 ewol::Shaper::GetPadding(void)
vec2 ewol::Shaper::getPadding(void)
{
vec2 padding(0,0);
if (m_config!=NULL) {
padding.setValue(m_config->GetFloat(m_confIdPaddingX),
m_config->GetFloat(m_confIdPaddingY));
padding.setValue(m_config->getFloat(m_confIdPaddingX),
m_config->getFloat(m_confIdPaddingY));
}
return padding;
}
void ewol::Shaper::SetSource(const etk::UString& _newFile)
void ewol::Shaper::setSource(const etk::UString& _newFile)
{
Clear();
UnLoadProgram();
clear();
unLoadProgram();
m_name = _newFile;
LoadProgram();
loadProgram();
}
bool ewol::Shaper::HasSources(void)
bool ewol::Shaper::hasSources(void)
{
return m_GLprogram!=NULL;
}

View File

@ -19,7 +19,7 @@ namespace ewol
/**
* @brief the Shaper system is a basic theme configuration for every widget, it corespond at a background display described by a pool of files
*/
// TODO : Load image
// TODO : load image
// TODO : Abstaraction between states (call by name and the system greate IDs
class Shaper : public ewol::Compositing
{
@ -30,9 +30,9 @@ namespace ewol
int32_t m_confIdPaddingX; //!< ConfigFile padding property X
int32_t m_confIdPaddingY; //!< ConfigFile padding property Y
int32_t m_confIdChangeTime; //!< ConfigFile padding transition time property
int32_t m_confProgramFile; //!< ConfigFile OpengGl program Name
int32_t m_confImageFile; //!< ConfigFile OpengGl program Name
// OpenGL shaders programs:
int32_t m_confProgramFile; //!< ConfigFile opengGl program Name
int32_t m_confImageFile; //!< ConfigFile opengGl program Name
// openGL shaders programs:
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
int32_t m_GLPosition; //!< openGL id on the element (vertex buffer)
int32_t m_GLMatrix; //!< openGL id on the element (transformation matrix)
@ -58,13 +58,13 @@ namespace ewol
vec2 m_coord[6]; //!< the double triangle coordonates
private:
/**
* @brief Load the openGL program and get all the ID needed
* @brief load the openGL program and get all the ID needed
*/
void LoadProgram(void);
void loadProgram(void);
/**
* @brief Un-Load the openGL program and get all the ID needed
*/
void UnLoadProgram(void);
void unLoadProgram(void);
public:
/**
* @brief generic constructor
@ -77,87 +77,87 @@ namespace ewol
~Shaper(void);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
* @brief draw All the refistered text in the current element on openGL
*/
void Draw(bool _disableDepthTest=true);
void draw(bool _disableDepthTest=true);
/**
* @brief Clear alll tre registered element in the current element
* @brief clear alll tre registered element in the current element
*/
void Clear(void);
void clear(void);
/**
* @brief change the current status in an other
* @param[in] _newStatusId the next new status requested
* @return true The widget must call this fuction periodicly (and redraw itself)
* @return false No need to request the periodic call.
*/
bool ChangeStatusIn(int32_t _newStatusId);
bool changeStatusIn(int32_t _newStatusId);
/**
* @brief Get the current displayed status of the shaper
* @brief get the current displayed status of the shaper
* @return The Status Id
*/
int32_t GetCurrentDisplayedStatus(void) { return m_stateNew; };
int32_t getCurrentDisplayedStatus(void) { return m_stateNew; };
/**
* @brief Get the next displayed status of the shaper
* @brief get the next displayed status of the shaper
* @return The next status Id (-1 if no status in next)
*/
int32_t GetNextDisplayedStatus(void) { return m_nextStatusRequested; };
int32_t getNextDisplayedStatus(void) { return m_nextStatusRequested; };
/**
* @brief Get the current trasion status
* @brief get the current trasion status
* @return value of the transition status (0.0f when no activity)
*/
float GetTransitionStatus(void) { return m_stateTransition; };
float getTransitionStatus(void) { return m_stateTransition; };
/**
* @brief Same as the widfget periodic call (this is for change display)
* @param[in] _event The current time of the call.
* @return true The widget must call this fuction periodicly (and redraw itself)
* @return false No need to request the periodic call.
*/
bool PeriodicCall(const ewol::EventTime& _event);
bool periodicCall(const ewol::EventTime& _event);
/**
* @brief Set the widget origin (needed fot the display)
* @brief set the widget origin (needed fot the display)
* @param[in] _newOri : the new widget origin
*/
void SetOrigin(const vec2& _newOri);
void setOrigin(const vec2& _newOri);
/**
* @brief Set the widget size (needed fot the display)
* @brief set the widget size (needed fot the display)
* @param[in] _newSize : the new widget size
*/
void SetSize(const vec2& _newSize);
void setSize(const vec2& _newSize);
/**
* @brief Set the internal widget size
* @brief set the internal widget size
* @param[in] _newInsidePos : the subelement size.
*/
void SetInsideSize(const vec2& _newInsideSize);
void setInsideSize(const vec2& _newInsideSize);
/**
* @brief Set the internal widget position
* @brief set the internal widget position
* @param[in] _newInsidePos : the subelement position
*/
void SetInsidePos(const vec2& _newInsidePos);
void setInsidePos(const vec2& _newInsidePos);
/**
* @brief Get the padding declared by the user in the config file
* @brief get the padding declared by the user in the config file
* @return the padding property
*/
vec2 GetPadding(void);
vec2 getPadding(void);
/**
* @brief Change the shaper Source
* @brief change the shaper Source
* @param[in] _newFile New file of the shaper
*/
void SetSource(const etk::UString& _newFile);
void setSource(const etk::UString& _newFile);
/**
* @brief Get the shaper file Source
* @brief get the shaper file Source
* @return the shapper file name
*/
const etk::UString& GetSource(void) const { return m_name; };
const etk::UString& getSource(void) const { return m_name; };
/**
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources.
*/
bool HasSources(void);
bool hasSources(void);
private:
/**
* @brief Update the internal vertex table.
* @brief update the internal vertex table.
*/
void UpdateVertex(void);
void updateVertex(void);
};
};

View File

@ -18,7 +18,7 @@ ewol::Sprite::Sprite(const etk::UString& _imageName, const ivec2& _nbSprite) :
m_unitarySpriteSize(0,0)
{
/*
vec2 imageSize = GetRealSize();
vec2 imageSize = getRealSize();
m_unitarySpriteSize.setValue(imageSize.x()/(float)m_nbSprite.x(),
imageSize.y()/(float)m_nbSprite.y());
*/
@ -28,15 +28,15 @@ ewol::Sprite::Sprite(const etk::UString& _imageName, const ivec2& _nbSprite) :
}
void ewol::Sprite::PrintSprite(const ivec2& _spriteID, const vec3& _size)
void ewol::Sprite::printSprite(const ivec2& _spriteID, const vec3& _size)
{
if( _spriteID.x()<0
|| _spriteID.y()<0
|| _spriteID.x()>=m_nbSprite.x()
|| _spriteID.y()>=m_nbSprite.y()) {
|| _spriteID.x() >= m_nbSprite.x()
|| _spriteID.y() >= m_nbSprite.y()) {
return;
}
PrintPart(vec2(_size.x(),_size.y()),
printPart(vec2(_size.x(),_size.y()),
vec2((float)(_spriteID.x() )*m_unitarySpriteSize.x(), (float)(_spriteID.y() )*m_unitarySpriteSize.y()),
vec2((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y()));
}

View File

@ -23,8 +23,8 @@ namespace ewol
public:
Sprite(const etk::UString& _imageName, const ivec2& _nbSprite);
virtual ~Sprite() {};
void PrintSprite(const ivec2& _spriteID, const vec2& _size) { PrintSprite(_spriteID, vec3(_size.x(), _size.y(),0)); };
void PrintSprite(const ivec2& _spriteID, const vec3& _size);
void printSprite(const ivec2& _spriteID, const vec2& _size) { printSprite(_spriteID, vec3(_size.x(), _size.y(),0)); };
void printSprite(const ivec2& _spriteID, const vec3& _size);
};
};

File diff suppressed because it is too large Load Diff

View File

@ -25,9 +25,9 @@ namespace ewol
class TextDecoration
{
public:
etk::Color<> m_colorBg; //!< Display background color
etk::Color<> m_colorFg; //!< Display foreground color
ewol::font::mode_te m_mode; //!< Display mode Regular/Bold/Italic/BoldItalic
etk::Color<> m_colorBg; //!< display background color
etk::Color<> m_colorFg; //!< display foreground color
ewol::font::mode_te m_mode; //!< display mode Regular/Bold/Italic/BoldItalic
TextDecoration(void)
{
m_colorBg = etk::color::blue;
@ -50,7 +50,7 @@ namespace ewol
private:
ewol::Drawing m_vectorialDraw; //!< This is used to draw background selection and other things ...
public:
ewol::Drawing& GetDrawing(void) { return m_vectorialDraw; };
ewol::Drawing& getDrawing(void) { return m_vectorialDraw; };
private:
int32_t m_nbCharDisplayed; //!< prevent some error in calculation size.
vec3 m_sizeDisplayStart; //!< The start windows of the display.
@ -68,7 +68,7 @@ namespace ewol
private:
ewol::font::mode_te m_mode; //!< font display property : Regular/Bold/Italic/BoldItalic
bool m_kerning; //!< Kerning enable or disable on the next elements displayed
bool m_distanceField; //!< Texture in distance Field mode ==> maybe move this in the font property.
bool m_distanceField; //!< Texture in distance Field mode == > maybe move this in the font property.
uniChar_t m_previousCharcode; //!< we remember the previous charcode to perform the kerning. @ref Kerning
private:
float m_startTextpos; //!< start position of the Alignement (when \n the text return at this position)
@ -83,7 +83,7 @@ namespace ewol
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
private:
int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection)
int32_t m_cursorPos; //!< Cursor position (default no cursor ==> -100)
int32_t m_cursorPos; //!< Cursor position (default no cursor == > -100)
private:
ewol::TexturedFont* m_font; //!< Font resources
private: // Text
@ -92,14 +92,14 @@ namespace ewol
etk::Vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
private:
/**
* @brief Load the openGL program and get all the ID needed
* @brief load the openGL program and get all the ID needed
*/
void LoadProgram(void);
void loadProgram(void);
public:
/**
* @brief generic constructor
* @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=-1);
/**
@ -108,126 +108,126 @@ namespace ewol
~Text(void);
public:
// Derived function
virtual void Translate(const vec3& _vect);
virtual void translate(const vec3& _vect);
// Derived function
virtual void Rotate(const vec3& _vect, float _angle);
virtual void rotate(const vec3& _vect, float _angle);
// Derived function
virtual void Scale(const vec3& _vect);
virtual void scale(const vec3& _vect);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
* @brief draw All the refistered text in the current element on openGL
*/
void Draw(bool _disableDepthTest=true);
void Draw(const mat4& _transformationMatrix, bool _enableDepthTest=false);
void draw(bool _disableDepthTest=true);
void draw(const mat4& _transformationMatrix, bool _enableDepthTest=false);
/**
* @brief Clear all the registered element in the current element
* @brief clear all the registered element in the current element
*/
void Clear(void);
void clear(void);
/**
* @brief Clear all the intermediate result detween 2 prints
* @brief clear all the intermediate result detween 2 prints
*/
void Reset(void);
void reset(void);
/**
* @brief Get the current display position (sometime needed in the gui control)
* @brief get the current display position (sometime needed in the gui control)
* @return the current position.
*/
const vec3& GetPos(void) { return m_position; };
const vec3& getPos(void) { return m_position; };
/**
* @brief Set position for the next text writen
* @brief set position for the next text writen
* @param[in] _pos Position of the text (in 3D)
*/
void SetPos(const vec3& _pos);
inline void SetPos(const vec2& _pos) { SetPos(vec3(_pos.x(),_pos.y(),0)); };
void setPos(const vec3& _pos);
inline void setPos(const vec2& _pos) { setPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set relative position for the next text writen
* @brief set relative position for the next text writen
* @param[in] _pos ofset apply of the text (in 3D)
*/
void SetRelPos(const vec3& _pos);
inline void SetRelPos(const vec2& _pos) { SetRelPos(vec3(_pos.x(),_pos.y(),0)); };
void setRelPos(const vec3& _pos);
inline void setRelPos(const vec2& _pos) { setRelPos(vec3(_pos.x(),_pos.y(),0)); };
/**
* @brief Set the Color of the current foreground font
* @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print)
*/
void SetColor(const etk::Color<>& _color) { m_color = _color; };
void setColor(const etk::Color<>& _color) { m_color = _color; };
/**
* @brief Set the background color of the font (for selected Text (not the global BG))
* @brief set the background color of the font (for selected Text (not the global BG))
* @param[in] _color Color to set on background (for next print)
*/
void SetColorBg(const etk::Color<>& _color);
void setColorBg(const etk::Color<>& _color);
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping
* @param[in] _width Width size of the clipping
*/
void SetClippingWidth(const vec3& _pos, const vec3& _width) { SetClipping(_pos, _pos+_width); }
void SetClippingWidth(const vec2& _pos, const vec2& _width) { SetClipping(_pos, _pos+_width); };
void setClippingWidth(const vec3& _pos, const vec3& _width) { setClipping(_pos, _pos+_width); }
void setClippingWidth(const vec2& _pos, const vec2& _width) { setClipping(_pos, _pos+_width); };
/**
* @brief Request a clipping area for the text (next draw only)
* @param[in] _pos Start position of the clipping
* @param[in] _posEnd End position of the clipping
*/
void SetClipping(const vec3& _pos, const vec3& _posEnd);
void SetClipping(const vec2& _pos, const vec2& _posEnd) { SetClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); };
void setClipping(const vec3& _pos, const vec3& _posEnd);
void setClipping(const vec2& _pos, const vec2& _posEnd) { setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); };
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief enable/Disable the clipping (without lose the current clipping position)
* @brief _newMode The new status of the clipping
*/
// TODO : Rename SetClippingActivity
void SetClippingMode(bool _newMode);
// TODO : Rename setClippingActivity
void setClippingMode(bool _newMode);
/**
* @brief Specify the font size (this reset the internal element of the current text (system requirement)
* @param[in] _fontSize New font size
*/
void SetFontSize(int32_t _fontSize);
void setFontSize(int32_t _fontSize);
/**
* @brief Specify the font name (this reset the internal element of the current text (system requirement)
* @param[in] _fontName Current name of the selected font
*/
void SetFontName(const etk::UString& _fontName);
void setFontName(const etk::UString& _fontName);
/**
* @brief Specify the font property (this reset the internal element of the current text (system requirement)
* @param[in] fontName Current name of the selected font
* @param[in] fontSize New font size
*/
void SetFont(etk::UString _fontName, int32_t _fontSize);
void setFont(etk::UString _fontName, int32_t _fontSize);
/**
* @brief Specify the font mode for the next @ref Print
* @brief Specify the font mode for the next @ref print
* @param[in] mode The font mode requested
*/
void SetFontMode(ewol::font::mode_te _mode);
void setFontMode(ewol::font::mode_te _mode);
/**
* @brief Get the current font mode
* @brief get the current font mode
* @return The font mode applied
*/
ewol::font::mode_te GetFontMode(void);
ewol::font::mode_te getFontMode(void);
/**
* @brief Enable or disable the bold mode
* @brief enable or disable the bold mode
* @param[in] _status The new status for this display property
*/
void SetFontBold(bool _status);
void setFontBold(bool _status);
/**
* @brief Enable or disable the italic mode
* @brief enable or disable the italic mode
* @param[in] _status The new status for this display property
*/
void SetFontItalic(bool _status);
void setFontItalic(bool _status);
/**
* @brief Set the activation of the Kerning for the display (if it existed)
* @param[in] _newMode Enable/Diasable the kerning on this font.
* @brief set the activation of the Kerning for the display (if it existed)
* @param[in] _newMode enable/Diasable the kerning on this font.
*/
void SetKerningMode(bool _newMode);
void setKerningMode(bool _newMode);
/**
* @brief Request the distance field mode for this text display
* @param[in] _newMode Enable/Diasable the Distance Field on this font.
* @param[in] _newMode enable/Diasable the Distance Field on this font.
* @todo : not implemented for now
*/
void SetDistanceFieldMode(bool _newMode);
void setDistanceFieldMode(bool _newMode);
/**
* @brief Display a compleat string in the current element.
* @brief display a compleat string in the current element.
* @param[in] _text The string to display.
*/
void Print(const etk::UString& _text);
void print(const etk::UString& _text);
/**
* @brief Display a compleat string in the current element with the generic decoration specification. (basic html data)
* @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
* <pre>
* <br/>
* <br/><br/><br/>
@ -253,9 +253,9 @@ namespace ewol
* @param[in] _text The string to display.
* @TODO : implementation not done ....
*/
void PrintDecorated(const etk::UString& _text);
void printDecorated(const etk::UString& _text);
/**
* @brief Display a compleat string in the current element with the generic decoration specification. (basic html data)
* @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
* <pre>
* <html>
* <body>
@ -285,28 +285,28 @@ namespace ewol
* @param[in] _text The string to display.
* @TODO : implementation not done ....
*/
void PrintHTML(const etk::UString& _text);
void printHTML(const etk::UString& _text);
/**
* @brief Display a compleat string in the current element whith specific decorations (advence mode).
* @brief display a compleat string in the current element whith specific decorations (advence mode).
* @param[in] _text The string to display.
* @param[in] _decoration The text decoration for the text that might be display (if the vector is smaller, the last parameter is get)
*/
void Print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration);
void print(const etk::UString& _text, const etk::Vector<TextDecoration>& _decoration);
/**
* @brief Display the current char in the current element (note that the kerning is availlable if the position is not changed)
* @brief display the current char in the current element (note that the kerning is availlable if the position is not changed)
* @param[in] _charcode Char that might be dispalyed
*/
void Print(const uniChar_t& _charcode);
void print(const uniChar_t& _charcode);
/**
* @brief This Generate the line return ==> it return to the alignement position start and at the correct line position ==> it might be use to not know the line height
* @brief This generate the line return == > it return to the alignement position start and at the correct line position ==> it might be use to not know the line height
*/
void ForceLineReturn(void);
void forceLineReturn(void);
private:
/**
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
* @param[in] _element the exml element.
*/
void ParseHtmlNode(exml::Element* _element);
void parseHtmlNode(exml::Element* _element);
public:
/**
* @brief This generate the possibility to generate the big text property
@ -315,48 +315,48 @@ namespace ewol
* @param[in] _alignement mode of alignement for the Text.
* @note The text align in center change of line every display done (even if it was just a char)
*/
void SetTextAlignement(float _startTextpos, float _stopTextPos, ewol::Text::aligneMode_te _alignement=ewol::Text::alignDisable);
void setTextAlignement(float _startTextpos, float _stopTextPos, ewol::Text::aligneMode_te _alignement=ewol::Text::alignDisable);
/**
* @brief Disable the alignement system
* @brief disable the alignement system
*/
void DisableAlignement(void);
void disableAlignement(void);
/**
* @brief Get the current alignement property
* @brief get the current alignement property
* @return the curent alignement type
*/
ewol::Text::aligneMode_te GetAlignement(void);
ewol::Text::aligneMode_te getAlignement(void);
/**
* @brief Calculate a theoric text size
* @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSizeHTML(const etk::UString& _text);
vec3 calculateSizeHTML(const etk::UString& _text);
/**
* @brief Calculate a theoric text size
* @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSizeDecorated(const etk::UString& _text);
vec3 calculateSizeDecorated(const etk::UString& _text);
/**
* @brief Calculate a theoric text size
* @brief calculate a theoric text size
* @param[in] _text The string to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSize(const etk::UString& _text);
vec3 calculateSize(const etk::UString& _text);
/**
* @brief Calculate a theoric charcode size
* @brief calculate a theoric charcode size
* @param[in] _charcode The µUnicode value to calculate dimention.
* @return The theoric size used.
*/
vec3 CalculateSize(const uniChar_t& _charcode);
vec3 calculateSize(const uniChar_t& _charcode);
/**
* @brief Draw a cursor at the specify position
* @brief draw a cursor at the specify position
* @param[in] _isInsertMode True if the insert mode is activated
*/
void PrintCursor(bool _isInsertMode);
void printCursor(bool _isInsertMode);
private:
/**
* @brief Calculate the element number that is the first out the alignement range
* @brief calculate the element number that is the first out the alignement range
* (start at the specify ID, and use start pos with current one)
* @param[in] _text The string that might be parsed.
* @param[in] _start The first elemnt that might be used to calculate.
@ -365,7 +365,7 @@ namespace ewol
* @parma[out] _freespace This represent the number of pixel present in the right white space.
* @return true if the rifht has free space that can be use for jystify (return false if we find \n
*/
bool ExtrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
bool extrapolateLastId(const etk::UString& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
private:
// this section is reserved for HTML parsing and display:
etk::UString m_htmlCurrrentLine; //!< current line for HTML display
@ -375,37 +375,37 @@ namespace ewol
* @brief add a line with the current m_htmlDecoTmp decoration
* @param[in] _data The cuurent data to add.
*/
void HtmlAddData(const etk::UString& _data);
void htmlAddData(const etk::UString& _data);
/**
* @brief Draw the current line
* @brief draw the current line
*/
void HtmlFlush(void);
void htmlFlush(void);
public:
/**
* @brief Remove the cursor display
* @brief remove the cursor display
*/
void DisableCursor(void);
void disableCursor(void);
/**
* @brief Set a cursor at a specific position:
* @brief set a cursor at a specific position:
* @param[in] _cursorPos id of the cursor position
*/
void SetCursorPos(int32_t _cursorPos);
void setCursorPos(int32_t _cursorPos);
/**
* @brief Set a cursor at a specific position with his associated selection:
* @brief set a cursor at a specific position with his associated selection:
* @param[in] _cursorPos id of the cursor position
* @param[in] _selectionStartPos id of the starting of the selection
*/
void SetCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos);
void setCursorSelection(int32_t _cursorPos, int32_t _selectionStartPos);
/**
* @brief Change the selection color
* @brief change the selection color
* @param[in] _color New color for the Selection
*/
void SetSelectionColor(const etk::Color<>& _color);
void setSelectionColor(const etk::Color<>& _color);
/**
* @brief Change the cursor color
* @brief change the cursor color
* @param[in] _color New color for the Selection
*/
void SetCursorColor(const etk::Color<>& _color);
void setCursorColor(const etk::Color<>& _color);
};
};

View File

@ -35,7 +35,7 @@ static const char* cursorDescriptionString[ewol::cursorCount+1] = {
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::cursorDisplay_te _obj)
{
if (_obj>=0 && _obj <ewol::cursorCount) {
if (_obj >= 0 && _obj <ewol::cursorCount) {
_os << cursorDescriptionString[_obj];
} else {
_os << "[ERROR]";

View File

@ -19,7 +19,7 @@
#define __class__ "ewol"
etk::UString ewol::GetCompilationMode(void)
etk::UString ewol::getCompilationMode(void)
{
#ifdef MODE_RELEASE
return "Release";
@ -28,7 +28,7 @@ etk::UString ewol::GetCompilationMode(void)
#endif
}
etk::UString ewol::GetBoardType(void)
etk::UString ewol::getBoardType(void)
{
#ifdef __TARGET_OS__Linux
return "Linux";
@ -45,14 +45,14 @@ etk::UString ewol::GetBoardType(void)
#endif
}
etk::UString ewol::GetVersion(void)
etk::UString ewol::getVersion(void)
{
#define FIRST_YEAR (2011)
etk::UString tmpOutput = (date::GetYear()-FIRST_YEAR);
etk::UString tmpOutput = (date::getYear()-FIRST_YEAR);
tmpOutput += ".";
tmpOutput += date::GetMonth();
tmpOutput += date::getMonth();
tmpOutput += ".";
tmpOutput += date::GetDay();
tmpOutput += date::getDay();
return tmpOutput;
}

View File

@ -27,26 +27,26 @@ namespace ewol
*/
int32_t Run(int32_t _argc, const char* _argv[]);
/**
* @brief Get EWOL version
* @brief get EWOL version
* @return The string that describe ewol version
*/
etk::UString GetVersion(void);
etk::UString getVersion(void);
/**
* @brief Get current time in us...
* @brief get current time in us...
* @return The current time
* @note is implemented by the OS implementation cf renderer/X11/...
*/
int64_t GetTime(void);
int64_t getTime(void);
/**
* @brief Get compilation mode (release/debug)
* @brief get compilation mode (release/debug)
* @return the string of the mode of commpilation
*/
etk::UString GetCompilationMode(void);
etk::UString getCompilationMode(void);
/**
* @brief Get the board type (Android/Linux/MacOs/...)
* @brief get the board type (Android/Linux/MacOs/...)
* @return the string of the mode of commpilation
*/
etk::UString GetBoardType(void);
etk::UString getBoardType(void);
};
#endif

View File

@ -27,7 +27,7 @@ static const char* statusDescriptionString[ewol::keyEvent::statusCount+1] = {
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::status_te _obj)
{
if (_obj>=0 && _obj <ewol::keyEvent::statusCount) {
if (_obj >= 0 && _obj <ewol::keyEvent::statusCount) {
_os << statusDescriptionString[_obj];
} else {
_os << "[ERROR]";
@ -79,7 +79,7 @@ static const char* keyboardDescriptionString[ewol::keyEvent::keyboardCount+1] =
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::keyboard_te _obj)
{
if (_obj>=0 && _obj <ewol::keyEvent::keyboardCount) {
if (_obj >= 0 && _obj <ewol::keyEvent::keyboardCount) {
_os << keyboardDescriptionString[_obj];
} else {
_os << "[ERROR]";
@ -98,7 +98,7 @@ static const char* typeDescriptionString[ewol::keyEvent::typeCount+1] = {
etk::CCout& ewol::keyEvent::operator <<(etk::CCout& _os, const ewol::keyEvent::type_te _obj)
{
if (_obj>=0 && _obj < ewol::keyEvent::typeCount) {
if (_obj >= 0 && _obj < ewol::keyEvent::typeCount) {
_os << typeDescriptionString[_obj];
} else {
_os << "[ERROR]";
@ -112,41 +112,41 @@ ewol::SpecialKey::SpecialKey(void) :
}
bool ewol::SpecialKey::IsSetCapsLock(void) const
bool ewol::SpecialKey::isSetCapsLock(void) const
{
return capLock;
}
bool ewol::SpecialKey::IsSetShift(void) const
bool ewol::SpecialKey::isSetShift(void) const
{
return shift;
}
bool ewol::SpecialKey::IsSetCtrl(void) const
bool ewol::SpecialKey::isSetCtrl(void) const
{
return ctrl;
}
bool ewol::SpecialKey::IsSetMeta(void) const
bool ewol::SpecialKey::isSetMeta(void) const
{
return meta;
}
bool ewol::SpecialKey::IsSetAlt(void) const
bool ewol::SpecialKey::isSetAlt(void) const
{
return alt;
}
bool ewol::SpecialKey::IsSetAltGr(void) const
bool ewol::SpecialKey::isSetAltGr(void) const
{
return altGr;
}
bool ewol::SpecialKey::IsSetNumLock(void) const
bool ewol::SpecialKey::isSetNumLock(void) const
{
return numLock;
}
bool ewol::SpecialKey::IsSetInsert(void) const
bool ewol::SpecialKey::isSetInsert(void) const
{
return insert;
}

View File

@ -67,10 +67,10 @@ namespace ewol
keyboardPageDown, //!< page down key
keyboardStart, //!< Start key
keyboardEnd, //!< End key
keyboardPrint, //!< Print screen key.
keyboardPrint, //!< print screen key.
keyboardStopDefil, //!< Stop display key.
keyboardWait, //!< Wait key.
keyboardInsert, //!< Insert key.
keyboardInsert, //!< insert key.
keyboardF1, //!< F1 key.
keyboardF2, //!< F2 key.
keyboardF3, //!< F3 key.
@ -124,45 +124,45 @@ namespace ewol
*/
SpecialKey(void);
/**
* @brief Get the current CapLock Status
* @brief get the current CapLock Status
* @return The status value
*/
bool IsSetCapsLock(void) const;
bool isSetCapsLock(void) const;
/**
* @brief Get the current Shift key status
* @brief get the current Shift key status
* @return The status value
*/
bool IsSetShift(void) const;
bool isSetShift(void) const;
/**
* @brief Get the Current Control key status
* @brief get the Current Control key status
* @return The status value
*/
bool IsSetCtrl(void) const;
bool isSetCtrl(void) const;
/**
* @brief Get the current Meta key status (also named windows or apple key)
* @brief get the current Meta key status (also named windows or apple key)
* @return The status value
*/
bool IsSetMeta(void) const;
bool isSetMeta(void) const;
/**
* @brief Get the current Alt key status
* @brief get the current Alt key status
* @return The status value
*/
bool IsSetAlt(void) const;
bool isSetAlt(void) const;
/**
* @brief Get the current Alt-Gr key status
* @brief get the current Alt-Gr key status
* @return The status value
*/
bool IsSetAltGr(void) const;
bool isSetAltGr(void) const;
/**
* @brief Get the current Ver-num key status
* @brief get the current Ver-num key status
* @return The status value
*/
bool IsSetNumLock(void) const;
bool isSetNumLock(void) const;
/**
* @brief Get the current Intert key status
* @brief get the current Intert key status
* @return The status value
*/
bool IsSetInsert(void) const;
bool isSetInsert(void) const;
};
/**
* @brief Debug operator To display the curent element in a Human redeable information

View File

@ -10,12 +10,12 @@
bool ewol::PhysicsBox::Parse(const char* _line)
bool ewol::PhysicsBox::parse(const char* _line)
{
if (true== ewol::PhysicsShape::Parse(_line)) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0==strncmp(_line, "half-extents : ", 15) ) {
if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_DEBUG(" halfSize=" << m_size);
return true;

View File

@ -21,17 +21,17 @@ namespace ewol
PhysicsBox(void) {};
virtual ~PhysicsBox(void) {};
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::box; };
virtual type_te getType(void) { return ewol::PhysicsShape::box; };
private:
vec3 m_size; // Box size property in X, Y and Z
public:
const vec3& GetSize(void) const { return m_size; };
const vec3& getSize(void) const { return m_size; };
public:
virtual const PhysicsBox* ToBox(void) const { return this; };
virtual PhysicsBox* ToBox(void) { return this; };
virtual const PhysicsBox* toBox(void) const { return this; };
virtual PhysicsBox* toBox(void) { return this; };
};
};

View File

@ -10,17 +10,17 @@
bool ewol::PhysicsCapsule::Parse(const char* _line)
bool ewol::PhysicsCapsule::parse(const char* _line)
{
if (true== ewol::PhysicsShape::Parse(_line)) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0==strncmp(_line, "radius : ", 9) ) {
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius);
return true;
}
if(0==strncmp(_line, "height : ", 9) ) {
if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height );
EWOL_DEBUG(" height=" << m_height);
return true;

View File

@ -22,21 +22,21 @@ namespace ewol
PhysicsCapsule(void) {};
virtual ~PhysicsCapsule(void) {};
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::capsule; };
virtual type_te getType(void) { return ewol::PhysicsShape::capsule; };
private:
float m_radius;
public:
float GetRadius(void) const { return m_radius; };
float getRadius(void) const { return m_radius; };
private:
float m_height;
public:
float GetHeight(void) const { return m_height; };
float getHeight(void) const { return m_height; };
public:
virtual const PhysicsCapsule* ToCapsule(void) const { return this; };
virtual PhysicsCapsule* ToCapsule(void) { return this; };
virtual const PhysicsCapsule* toCapsule(void) const { return this; };
virtual PhysicsCapsule* toCapsule(void) { return this; };
};
};

View File

@ -10,17 +10,17 @@
bool ewol::PhysicsCone::Parse(const char* _line)
bool ewol::PhysicsCone::parse(const char* _line)
{
if (true== ewol::PhysicsShape::Parse(_line)) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0==strncmp(_line, "radius : ", 9) ) {
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius);
return true;
}
if(0==strncmp(_line, "height : ", 9) ) {
if(0 == strncmp(_line, "height : ", 9) ) {
sscanf(&_line[9], "%f", &m_height );
EWOL_DEBUG(" height=" << m_height);
return true;

View File

@ -22,21 +22,21 @@ namespace ewol
PhysicsCone(void) {};
virtual ~PhysicsCone(void) {};
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::cone; };
virtual type_te getType(void) { return ewol::PhysicsShape::cone; };
private:
float m_radius;
public:
float GetRadius(void) const { return m_radius; };
float getRadius(void) const { return m_radius; };
private:
float m_height;
public:
float GetHeight(void) const { return m_height; };
float getHeight(void) const { return m_height; };
public:
virtual const PhysicsCone* ToCone(void) const { return this; };
virtual PhysicsCone* ToCone(void) { return this; };
virtual const PhysicsCone* toCone(void) const { return this; };
virtual PhysicsCone* toCone(void) { return this; };
};
};

View File

@ -10,12 +10,12 @@
bool ewol::PhysicsConvexHull::Parse(const char* _line)
bool ewol::PhysicsConvexHull::parse(const char* _line)
{
if (true== ewol::PhysicsShape::Parse(_line)) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0==strncmp(_line, "points : ", 8) ) {
if(0 == strncmp(_line, "points : ", 8) ) {
//EWOL_DEBUG("convex hull point parsing " << _line);
char* base = (char*)(&_line[8]);
char* tmp= strchr(base, '|');
@ -23,20 +23,20 @@ bool ewol::PhysicsConvexHull::Parse(const char* _line)
while (tmp != NULL) {
*tmp = '\0';
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.PushBack(pos);
m_points.pushBack(pos);
base = tmp+1;
tmp= strchr(base, '|');
}
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
m_points.PushBack(pos);
m_points.pushBack(pos);
/*
for (int32_t iii=0; iii<m_points.Size(); iii++) {
for (int32_t iii=0; iii<m_points.size(); iii++) {
EWOL_DEBUG(" parsed " << m_points[iii]);
}
*/
return true;
}
if(0==strncmp(_line, "scale : ", 8) ) {
if(0 == strncmp(_line, "scale : ", 8) ) {
sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] );
EWOL_DEBUG(" scale=" << m_scale);
return true;

View File

@ -22,21 +22,21 @@ namespace ewol
PhysicsConvexHull(void) {};
virtual ~PhysicsConvexHull(void) {};
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::convexHull; };
virtual type_te getType(void) { return ewol::PhysicsShape::convexHull; };
private:
vec3 m_scale;
public:
vec3 GetScale(void) const { return m_scale; };
vec3 getScale(void) const { return m_scale; };
private:
etk::Vector<vec3> m_points;
public:
const etk::Vector<vec3>& GetPointList(void) const { return m_points; };
const etk::Vector<vec3>& getPointList(void) const { return m_points; };
public:
virtual const PhysicsConvexHull* ToConvexHull(void) const { return this; };
virtual PhysicsConvexHull* ToConvexHull(void) { return this; };
virtual const PhysicsConvexHull* toConvexHull(void) const { return this; };
virtual PhysicsConvexHull* toConvexHull(void) { return this; };
};
};

View File

@ -9,12 +9,12 @@
#include <ewol/physicsShape/PhysicsCylinder.h>
bool ewol::PhysicsCylinder::Parse(const char* _line)
bool ewol::PhysicsCylinder::parse(const char* _line)
{
if (true== ewol::PhysicsShape::Parse(_line)) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0==strncmp(_line, "half-extents : ", 15) ) {
if(0 == strncmp(_line, "half-extents : ", 15) ) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EWOL_DEBUG(" halfSize=" << m_size);
return true;

View File

@ -22,17 +22,17 @@ namespace ewol
PhysicsCylinder(void) {};
virtual ~PhysicsCylinder(void) {};
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::cylinder; };
virtual type_te getType(void) { return ewol::PhysicsShape::cylinder; };
private:
vec3 m_size;
public:
vec3 GetSize(void) const { return m_size; };
vec3 getSize(void) const { return m_size; };
public:
virtual const PhysicsCylinder* ToCylinder(void) const { return this; };
virtual PhysicsCylinder* ToCylinder(void) { return this; };
virtual const PhysicsCylinder* toCylinder(void) const { return this; };
virtual PhysicsCylinder* toCylinder(void) { return this; };
};
};

View File

@ -15,10 +15,10 @@
#include <ewol/physicsShape/PhysicsSphere.h>
ewol::PhysicsShape* ewol::PhysicsShape::Create(const etk::UString& _name)
ewol::PhysicsShape* ewol::PhysicsShape::create(const etk::UString& _name)
{
ewol::PhysicsShape* tmpp = NULL;
etk::UString name = _name.ToLower();
etk::UString name = _name.toLower();
if (name == "box") {
tmpp = new ewol::PhysicsBox();
} else if (name == "sphere") {
@ -35,23 +35,23 @@ ewol::PhysicsShape* ewol::PhysicsShape::Create(const etk::UString& _name)
EWOL_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL]");
return NULL;
}
if (tmpp==NULL) {
if (tmpp == NULL) {
EWOL_ERROR("Allocation error for physical element : '" << _name << "'");
}
return tmpp;
}
bool ewol::PhysicsShape::Parse(const char* _line)
bool ewol::PhysicsShape::parse(const char* _line)
{
if(0==strncmp(_line, "origin : ", 9) ) {
if(0 == strncmp(_line, "origin : ", 9) ) {
sscanf(&_line[9], "%f %f %f", &m_origin.m_floats[0], &m_origin.m_floats[1], &m_origin.m_floats[2] );
EWOL_DEBUG(" Origin=" << m_origin);
return true;
}
if(0==strncmp(_line, "rotate : ", 9) ) {
if(0 == strncmp(_line, "rotate : ", 9) ) {
sscanf(&_line[9], "%f %f %f %f", &m_quaternion.m_floats[0], &m_quaternion.m_floats[1], &m_quaternion.m_floats[2], &m_quaternion.m_floats[3] );
EWOL_DEBUG(" Rotate=" << m_quaternion);
EWOL_DEBUG(" rotate=" << m_quaternion);
return true;
}
return false;

View File

@ -28,7 +28,7 @@ namespace ewol
class PhysicsShape
{
public:
static PhysicsShape* Create(const etk::UString& _name);
static PhysicsShape* create(const etk::UString& _name);
public:
typedef enum {
unknow,
@ -43,44 +43,44 @@ namespace ewol
PhysicsShape(void) : m_quaternion(1,0,0,0), m_origin(0,0,0) {};
virtual ~PhysicsShape(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::unknow; };
virtual type_te getType(void) { return ewol::PhysicsShape::unknow; };
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
private:
vec4 m_quaternion;
public:
vec4 GetQuaternion(void) const { return m_quaternion; };
vec4 getQuaternion(void) const { return m_quaternion; };
private:
vec3 m_origin;
public:
vec3 GetOrigin(void) const { return m_origin; };
vec3 getOrigin(void) const { return m_origin; };
public:
bool IsBox(void) { return GetType()==ewol::PhysicsShape::box; };
bool IsCylinder(void) { return GetType()==ewol::PhysicsShape::cylinder; };
bool IsCapsule(void) { return GetType()==ewol::PhysicsShape::capsule; };
bool IsCone(void) { return GetType()==ewol::PhysicsShape::cone; };
bool IsConvexHull(void) { return GetType()==ewol::PhysicsShape::convexHull; };
bool IsSphere(void) { return GetType()==ewol::PhysicsShape::sphere; };
bool isBox(void) { return getType() == ewol::PhysicsShape::box; };
bool isCylinder(void) { return getType() == ewol::PhysicsShape::cylinder; };
bool isCapsule(void) { return getType() == ewol::PhysicsShape::capsule; };
bool isCone(void) { return getType() == ewol::PhysicsShape::cone; };
bool isConvexHull(void) { return getType() == ewol::PhysicsShape::convexHull; };
bool isSphere(void) { return getType() == ewol::PhysicsShape::sphere; };
virtual const PhysicsBox* ToBox(void) const { return NULL; };
virtual PhysicsBox* ToBox(void) { return NULL; };
virtual const PhysicsBox* toBox(void) const { return NULL; };
virtual PhysicsBox* toBox(void) { return NULL; };
virtual const PhysicsCylinder* ToCylinder(void) const { return NULL; };
virtual PhysicsCylinder* ToCylinder(void) { return NULL; };
virtual const PhysicsCylinder* toCylinder(void) const { return NULL; };
virtual PhysicsCylinder* toCylinder(void) { return NULL; };
virtual const PhysicsCapsule* ToCapsule(void) const { return NULL; };
virtual PhysicsCapsule* ToCapsule(void) { return NULL; };
virtual const PhysicsCapsule* toCapsule(void) const { return NULL; };
virtual PhysicsCapsule* toCapsule(void) { return NULL; };
virtual const PhysicsCone* ToCone(void) const { return NULL; };
virtual PhysicsCone* ToCone(void) { return NULL; };
virtual const PhysicsCone* toCone(void) const { return NULL; };
virtual PhysicsCone* toCone(void) { return NULL; };
virtual const PhysicsConvexHull* ToConvexHull(void) const { return NULL; };
virtual PhysicsConvexHull* ToConvexHull(void) { return NULL; };
virtual const PhysicsConvexHull* toConvexHull(void) const { return NULL; };
virtual PhysicsConvexHull* toConvexHull(void) { return NULL; };
virtual const PhysicsSphere* ToSphere(void) const { return NULL; };
virtual PhysicsSphere* ToSphere(void) { return NULL; };
virtual const PhysicsSphere* toSphere(void) const { return NULL; };
virtual PhysicsSphere* toSphere(void) { return NULL; };
};
};

View File

@ -10,12 +10,12 @@
bool ewol::PhysicsSphere::Parse(const char* _line)
bool ewol::PhysicsSphere::parse(const char* _line)
{
if (true== ewol::PhysicsShape::Parse(_line)) {
if (true == ewol::PhysicsShape::parse(_line)) {
return true;
}
if(0==strncmp(_line, "radius : ", 9) ) {
if(0 == strncmp(_line, "radius : ", 9) ) {
sscanf(&_line[9], "%f", &m_radius );
EWOL_DEBUG(" radius=" << m_radius);
return true;

View File

@ -22,17 +22,17 @@ namespace ewol
PhysicsSphere(void) {};
virtual ~PhysicsSphere(void) {};
public:
virtual bool Parse(const char* _line);
virtual void Display(void) {};
virtual bool parse(const char* _line);
virtual void display(void) {};
public:
virtual type_te GetType(void) { return ewol::PhysicsShape::sphere; };
virtual type_te getType(void) { return ewol::PhysicsShape::sphere; };
private:
float m_radius; // props["radius"] = obj.scale.x
public:
float GetRadius(void) const { return m_radius; };
float getRadius(void) const { return m_radius; };
private:
virtual const PhysicsSphere* ToSphere(void) const { return this; };
virtual PhysicsSphere* ToSphere(void) { return this; };
virtual const PhysicsSphere* toSphere(void) const { return this; };
virtual PhysicsSphere* toSphere(void) { return this; };
};
};

View File

@ -20,7 +20,7 @@
int64_t ewol::GetTime(void)
int64_t ewol::getTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
@ -68,7 +68,7 @@ class AndroidContext : public ewol::eContext
private:
bool SafeInitMethodID(jmethodID& _mid, jclass& _cls, char* _name, char* _sign)
{
_mid = m_JavaVirtualMachinePointer->GetMethodID(_cls, _name, _sign);
_mid = m_JavaVirtualMachinePointer->getMethodID(_cls, _name, _sign);
if(_mid == NULL) {
EWOL_ERROR("C->java : Can't find the method " << _name);
/* remove access on the virtual machine : */
@ -95,16 +95,16 @@ class AndroidContext : public ewol::eContext
{
EWOL_DEBUG("*******************************************");
if (m_javaApplicationType == appl_application) {
EWOL_DEBUG("** Set JVM Pointer (application) **");
EWOL_DEBUG("** set JVM Pointer (application) **");
} else {
EWOL_DEBUG("** Set JVM Pointer (LiveWallpaper) **");
EWOL_DEBUG("** set JVM Pointer (LiveWallpaper) **");
}
EWOL_DEBUG("*******************************************");
m_JavaVirtualMachinePointer = _env;
// get default needed all time elements :
if (NULL != m_JavaVirtualMachinePointer) {
EWOL_DEBUG("C->java : try load org/ewol/Ewol class");
m_javaClassEwol = m_JavaVirtualMachinePointer->FindClass("org/ewol/Ewol" );
m_javaClassEwol = m_JavaVirtualMachinePointer->findClass("org/ewol/Ewol" );
if (m_javaClassEwol == 0) {
EWOL_ERROR("C->java : Can't find org/ewol/Ewol class");
// remove access on the virtual machine :
@ -112,7 +112,7 @@ class AndroidContext : public ewol::eContext
return;
}
/* The object field extends Activity and implement EwolCallback */
m_javaClassEwolCallback = m_JavaVirtualMachinePointer->GetObjectClass(_objCallback);
m_javaClassEwolCallback = m_JavaVirtualMachinePointer->getObjectClass(_objCallback);
if(m_javaClassEwolCallback == NULL) {
EWOL_ERROR("C->java : Can't find org/ewol/EwolCallback class");
// remove access on the virtual machine :
@ -124,7 +124,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback,
"titleSet",
"(Ljava/lang/String;)V");
if (ret==false) {
if (ret == false) {
java_check_exception(_env);
return;
}
@ -132,7 +132,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback,
"stop",
"()V");
if (ret==false) {
if (ret == false) {
java_check_exception(_env);
return;
}
@ -141,7 +141,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback,
"eventNotifier",
"([Ljava/lang/String;)V");
if (ret==false) {
if (ret == false) {
java_check_exception(_env);
return;
}
@ -150,7 +150,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback,
"keyboardUpdate",
"(Z)V");
if (ret==false) {
if (ret == false) {
java_check_exception(_env);
return;
}
@ -159,7 +159,7 @@ class AndroidContext : public ewol::eContext
m_javaClassEwolCallback,
"orientationUpdate",
"(I)V");
if (ret==false) {
if (ret == false) {
java_check_exception(_env);
return;
}
@ -167,7 +167,7 @@ class AndroidContext : public ewol::eContext
m_javaObjectEwolCallback = _env->NewGlobalRef(_objCallback);
//javaObjectEwolCallbackAndActivity = objCallback;
m_javaDefaultClassString = m_JavaVirtualMachinePointer->FindClass("java/lang/String" );
m_javaDefaultClassString = m_JavaVirtualMachinePointer->findClass("java/lang/String" );
if (m_javaDefaultClassString == 0) {
EWOL_ERROR("C->java : Can't find java/lang/String" );
// remove access on the virtual machine :
@ -212,7 +212,7 @@ class AndroidContext : public ewol::eContext
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
// TODO : remove this 2 line when code will be writen
m_clipBoardOwnerStd = true;
switch (_clipboardID)
{
@ -223,7 +223,7 @@ class AndroidContext : public ewol::eContext
break;
case ewol::clipBoard::clipboardStd:
if (false == m_clipBoardOwnerStd) {
// Generate a request TO the OS
// 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
@ -266,7 +266,7 @@ class AndroidContext : public ewol::eContext
return false;
}
JNIEnv *JavaVirtualMachinePointer_tmp;
*_rstatus = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
*_rstatus = g_JavaVM->getEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (*_rstatus == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
@ -306,7 +306,7 @@ class AndroidContext : public ewol::eContext
void KeyboardHide(void) { SendJavaKeyboardUpdate(JNI_FALSE); };
// mode 0 : auto; 1 landscape, 2 portrait
void ForceOrientation(ewol::orientation_te _orientation)
void forceOrientation(ewol::orientation_te _orientation)
{
#ifndef __ANDROID_PERMISSION__SET_ORIENTATION__
EWOL_ERROR("C->java : call set orientation without Allow application to do it ... Break...");
@ -327,7 +327,7 @@ class AndroidContext : public ewol::eContext
#endif
}
void SetTitle(etk::UString& _title)
void setTitle(etk::UString& _title)
{
EWOL_DEBUG("C->java : send message to the java : \"" << _title << "\"");
if (m_javaApplicationType == appl_application) {
@ -419,7 +419,7 @@ static etk::Vector<AndroidContext*> s_listInstance;
extern "C"
{
// JNI OnLoad
// JNI onLoad
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* _jvm, void* _reserved)
{
// get the java virtual machine handle ...
@ -427,7 +427,7 @@ extern "C"
EWOL_DEBUG("JNI-> load the jvm ..." );
return JNI_VERSION_1_6;
}
// JNI OnUnLoad
// JNI onUnLoad
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* _vm, void *_reserved)
{
g_JavaVM = NULL;
@ -437,21 +437,21 @@ extern "C"
/* Call to initialize the graphics state */
void Java_org_ewol_Ewol_EWparamSetArchiveDir(JNIEnv* _env, jclass _cls, jint _id, jint _mode, jstring _myString)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
//EWOL_CRITICAL(" call with ID : " << _id);
// direct setting of the date in the string system ...
jboolean isCopy;
const char* str = _env->GetStringUTFChars(_myString, &isCopy);
s_listInstance[_id]->SetArchiveDir(_mode, str);
const char* str = _env->getStringUTFChars(_myString, &isCopy);
s_listInstance[_id]->setArchiveDir(_mode, str);
if (isCopy == JNI_TRUE) {
// from here str is reset ...
_env->ReleaseStringUTFChars(_myString, str);
_env->releaseStringUTFChars(_myString, str);
str = NULL;
}
}
@ -471,26 +471,26 @@ extern "C"
return -1;
}
if (NULL == tmpContext) {
EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.Size()-1));
EWOL_ERROR("Can not allocate the main context instance _id=" << (s_listInstance.size()-1));
return -1;
}
// for future case : all time this ...
s_listInstance.PushBack(tmpContext);
int32_t newID = s_listInstance.Size()-1;
s_listInstance.pushBack(tmpContext);
int32_t newID = s_listInstance.size()-1;
return newID;
}
void Java_org_ewol_Ewol_EWsetJavaVirtualMachineStop(JNIEnv* _env, jclass _cls, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Remove JVM Pointer **");
EWOL_DEBUG("** remove JVM Pointer **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
return;
}
if (NULL==s_listInstance[_id]) {
if (NULL == s_listInstance[_id]) {
EWOL_ERROR("the requested instance _id=" << (int32_t)_id << " is already removed ...");
return;
}
@ -500,12 +500,12 @@ extern "C"
}
void Java_org_ewol_Ewol_EWtouchEvent(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG(" ==> Touch Event");
if( _id>=s_listInstance.Size()
EWOL_DEBUG(" == > Touch Event");
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
java_check_exception(_env);
@ -514,28 +514,28 @@ extern "C"
void Java_org_ewol_Ewol_EWonCreate(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Create **");
EWOL_DEBUG("** Activity on Create **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
//s_listInstance[_id]->Init();
//s_listInstance[_id]->init();
}
void Java_org_ewol_Ewol_EWonStart(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Start **");
EWOL_DEBUG("** Activity on Start **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
//SendSystemMessage(" testmessages ... ");
@ -543,26 +543,26 @@ extern "C"
void Java_org_ewol_Ewol_EWonReStart(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Re-Start **");
EWOL_DEBUG("** Activity on Re-Start **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
}
void Java_org_ewol_Ewol_EWonResume(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Resume **");
EWOL_DEBUG("** Activity on resume **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_Resume();
@ -570,29 +570,29 @@ extern "C"
void Java_org_ewol_Ewol_EWonPause(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Pause **");
EWOL_DEBUG("** Activity on pause **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
// All the openGl has been destroyed ...
s_listInstance[_id]->GetResourcesManager().ContextHasBeenDestroyed();
s_listInstance[_id]->getResourcesManager().ContextHasBeenDestroyed();
s_listInstance[_id]->OS_Suspend();
}
void Java_org_ewol_Ewol_EWonStop(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Stop **");
EWOL_DEBUG("** Activity on Stop **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_Stop();
@ -600,13 +600,13 @@ extern "C"
void Java_org_ewol_Ewol_EWonDestroy(JNIEnv* _env, jobject _thiz, jint _id)
{
EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Activity On Destroy **");
EWOL_DEBUG("** Activity on Destroy **");
EWOL_DEBUG("*******************************************");
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
//s_listInstance[_id]->UnInit();
@ -619,11 +619,11 @@ extern "C"
* ********************************************************************************************** */
void Java_org_ewol_Ewol_EWinputEventMotion(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jfloat _x, jfloat _y )
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y));
@ -631,11 +631,11 @@ extern "C"
void Java_org_ewol_Ewol_EWinputEventState(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jboolean _isUp, jfloat _x, jfloat _y)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y));
@ -643,11 +643,11 @@ extern "C"
void Java_org_ewol_Ewol_EWmouseEventMotion(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jfloat _x, jfloat _y)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y));
@ -655,11 +655,11 @@ extern "C"
void Java_org_ewol_Ewol_EWmouseEventState(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID, jboolean _isUp, jfloat _x, jfloat _y)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y));
@ -667,11 +667,11 @@ extern "C"
void Java_org_ewol_Ewol_EWunknowEvent(JNIEnv* _env, jobject _thiz, jint _id, jint _pointerID)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
EWOL_DEBUG("Unknown IO event : " << _pointerID << " ???");
@ -679,11 +679,11 @@ extern "C"
void Java_org_ewol_Ewol_EWkeyboardEventMove(JNIEnv* _env, jobject _thiz, jint _id, jint _type, jboolean _isdown)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
EWOL_DEBUG("IO keyboard Move event : \"" << _type << "\" is down=" << _isdown);
@ -691,11 +691,11 @@ extern "C"
void Java_org_ewol_Ewol_EWkeyboardEventKey(JNIEnv* _env, jobject _thiz, jint _id, jint _uniChar, jboolean _isdown)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
EWOL_DEBUG("IO keyboard Key event : \"" << _uniChar << "\" is down=" << _isdown);
@ -704,48 +704,48 @@ extern "C"
void Java_org_ewol_Ewol_EWdisplayPropertyMetrics(JNIEnv* _env, jobject _thiz, jint _id, jfloat _ratioX, jfloat _ratioY)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
// set the internal system ratio properties ...
ewol::dimension::SetPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch);
ewol::dimension::setPixelRatio(vec2(_ratioX,_ratioY), ewol::Dimension::Inch);
}
// TODO : Set a return true or false if we want to grep this event ...
// TODO : set a return true or false if we want to grep this event ...
void Java_org_ewol_Ewol_EWkeyboardEventKeySystem(JNIEnv* _env, jobject _thiz, jint _id, jint _keyVal, jboolean _isdown)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
switch (_keyVal) {
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_UP:
EWOL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system \"VOLUME_UP\" is down=" << _isdown);
break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_VOLUME_DOWN:
EWOL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system \"VOLUME_DOWN\" is down=" << _isdown);
break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_MENU:
EWOL_DEBUG("IO keyboard Key System \"MENU\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system \"MENU\" is down=" << _isdown);
break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_CAMERA:
EWOL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system \"CAMERA\" is down=" << _isdown);
break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_HOME:
EWOL_DEBUG("IO keyboard Key System \"HOME\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system \"HOME\" is down=" << _isdown);
break;
case org_ewol_EwolConstants_EWOL_SYSTEM_KEY_POWER:
EWOL_DEBUG("IO keyboard Key System \"POWER\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system \"POWER\" is down=" << _isdown);
break;
default:
EWOL_DEBUG("IO keyboard Key System event : \"" << _keyVal << "\" is down=" << _isdown);
EWOL_DEBUG("IO keyboard Key system event : \"" << _keyVal << "\" is down=" << _isdown);
break;
}
}
@ -756,11 +756,11 @@ extern "C"
* ********************************************************************************************** */
void Java_org_ewol_Ewol_EWrenderInit(JNIEnv* _env, jobject _thiz, jint _id)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
@ -768,11 +768,11 @@ extern "C"
void Java_org_ewol_Ewol_EWrenderResize( JNIEnv* _env, jobject _thiz, jint _id, jint _w, jint _h )
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_Resize(vec2(_w, _h));
@ -781,11 +781,11 @@ extern "C"
// TODO : Return tur or foalse to not redraw when the under draw has not be done (processing gain of time)
void Java_org_ewol_Ewol_EWrenderDraw(JNIEnv* _env, jobject _thiz, jint _id)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_Draw(true);
@ -793,24 +793,24 @@ extern "C"
void Java_org_ewol_Ewol_EWaudioPlayback(JNIEnv* _env, void* _reserved, jint _id, jshortArray _location, jint _frameRate, jint _nbChannels)
{
if( _id>=s_listInstance.Size()
if( _id >= s_listInstance.size()
|| _id<0
|| NULL==s_listInstance[_id] ) {
|| NULL == s_listInstance[_id] ) {
EWOL_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : Generate error in java to stop the current instance
// TODO : generate error in java to stop the current instance
return;
}
// Get the short* pointer from the Java array
// get the short* pointer from the Java array
jboolean isCopy;
jshort* dst = _env->GetShortArrayElements(_location, &isCopy);
jshort* dst = _env->getShortArrayElements(_location, &isCopy);
if (NULL != dst) {
ewol::audio::GetData(dst, _frameRate, _nbChannels);
ewol::audio::getData(dst, _frameRate, _nbChannels);
}
//APPL_DEBUG("IO Audio event request: Frames=" << frameRate << " channels=" << nbChannels);
// TODO : Understand why it did not work corectly ...
//if (isCopy == JNI_TRUE) {
// Release the short* pointer
_env->ReleaseShortArrayElements(_location, dst, 0);
// release the short* pointer
_env->releaseShortArrayElements(_location, dst, 0);
//}
}
};

View File

@ -18,16 +18,16 @@ ewol::ConfigFont::ConfigFont(void) :
m_size(10),
m_useExternal(false)
{
ewol::FreeTypeInit();
ewol::freeTypeInit();
}
ewol::ConfigFont::~ConfigFont(void)
{
// UnInit FreeTypes
ewol::FreeTypeUnInit();
ewol::freeTypeUnInit();
}
void ewol::ConfigFont::Set(const etk::UString& _fontName, int32_t _size)
void ewol::ConfigFont::set(const etk::UString& _fontName, int32_t _size)
{
m_name = _fontName;
m_size = _size;

View File

@ -29,45 +29,45 @@ namespace ewol
* @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; };
void setFolder(const etk::UString& _folder) { m_folder = _folder; };
/**
* @brief Get the default font folder.
* @brief get the default font folder.
* @return The default font folder.
*/
const etk::UString& GetFolder(void) { return m_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.
* @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);
void set(const etk::UString& _fontName, int32_t _size);
/**
* @brief Get the current default font name
* @brief get the current default font name
* @raturn a reference on the font name string
*/
const etk::UString& GetName(void) { return m_name; };
const etk::UString& getName(void) { return m_name; };
/**
* @brief Get the default font size.
* @brief get the default font size.
* @return the font size.
*/
int32_t GetSize(void) { return m_size; };
int32_t getSize(void) { return m_size; };
private:
bool m_useExternal;
public:
/**
* @brief Set use of internal/external Font
* @brief set use of internal/external Font
* @param[in] _val true to enable search of internal data.
*/
void SetUseExternal(bool _val) { m_useExternal=_val; };
void setUseExternal(bool _val) { m_useExternal=_val; };
/**
* @brief Get the use of internal/external Font
* @brief get the use of internal/external Font
* @return true to enable search of internal data.
*/
bool GetUseExternal(void) { return m_useExternal; };
bool getUseExternal(void) { return m_useExternal; };
};
};

View File

@ -14,28 +14,28 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfig& _obj)
{
_os << "{";
_os << "config=\"" << _obj.GetConfig() << "\"";
_os << " data=\"" << _obj.GetData() << "\"}";
_os << "config=\"" << _obj.getConfig() << "\"";
_os << " data=\"" << _obj.getData() << "\"}";
return _os;
}
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj)
{
_os << "{";
if (NULL != _obj.GetConfig()) {
_os << "config=\"" << _obj.GetConfig() << "\"";
if (NULL != _obj.getConfig()) {
_os << "config=\"" << _obj.getConfig() << "\"";
}
if (NULL != _obj.GetType()) {
_os << " type=\"" << _obj.GetType() << "\"";
if (NULL != _obj.getType()) {
_os << " type=\"" << _obj.getType() << "\"";
}
if (NULL != _obj.GetControl()) {
_os << " ctrl=\"" << _obj.GetControl() << "\"";
if (NULL != _obj.getControl()) {
_os << " ctrl=\"" << _obj.getControl() << "\"";
}
if (NULL != _obj.GetDescription()) {
_os << " desc=\"" << _obj.GetDescription() << "\"";
if (NULL != _obj.getDescription()) {
_os << " desc=\"" << _obj.getDescription() << "\"";
}
if (NULL != _obj.GetDefault()) {
_os << " default=\"" << _obj.GetDefault() << "\"";
if (NULL != _obj.getDefault()) {
_os << " default=\"" << _obj.getDefault() << "\"";
}
_os << "}";
return _os;

View File

@ -23,16 +23,16 @@ namespace ewol {
m_config(_config),
m_data(_data)
{ };
void SetConfig(const char* _config) { m_config = _config; };
inline const char* GetConfig(void) const { return m_config; };
void SetData(const etk::UString& _data) { m_data = _data; };
inline const etk::UString& GetData(void) const { return m_data; };
void setConfig(const char* _config) { m_config = _config; };
inline const char* getConfig(void) const { return m_config; };
void setData(const etk::UString& _data) { m_data = _data; };
inline const etk::UString& getData(void) const { return m_data; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfig& _obj);
class EConfigElement {
private:
const char* m_config; //!< config properties (used for XML properties ==> only : "[0-9a-zA-Z\-]" ==> this is a regExp control.
const char* m_config; //!< config properties (used for XML properties == > only : "[0-9a-zA-Z\-]" ==> this is a regExp control.
const char* m_type; //!< type of the config[integer,float,string,reg-exp,list].
const char* m_control; //!< control the type of the type set ( integer:[0..256], regExp: "[0-9a-zA-Z]", list:[plop,plop2,plop3] )
const char* m_description; //!< description to help user to configure it.
@ -50,11 +50,11 @@ namespace ewol {
m_description(_description),
m_default(_default)
{ };
inline const char* GetConfig(void) const { return m_config; };
inline const char* GetType(void) const { return m_type; };
inline const char* GetControl(void) const { return m_control; };
inline const char* GetDescription(void) const { return m_description; };
inline const char* GetDefault(void) const { return m_default; };
inline const char* getConfig(void) const { return m_config; };
inline const char* getType(void) const { return m_type; };
inline const char* getControl(void) const { return m_control; };
inline const char* getDescription(void) const { return m_description; };
inline const char* getDefault(void) const { return m_default; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::EConfigElement& _obj);
};

View File

@ -14,12 +14,12 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EMessage& _obj)
{
_os << "{";
if (NULL != _obj.GetMessage()) {
_os << "msg=\"" << _obj.GetMessage() << "\"";
if (NULL != _obj.getMessage()) {
_os << "msg=\"" << _obj.getMessage() << "\"";
} else {
_os << "msg=\"NULL\"";
}
_os << " data=\"" << _obj.GetData() << "\"}";
_os << " data=\"" << _obj.getData() << "\"}";
return _os;
}

View File

@ -16,7 +16,7 @@ namespace ewol {
class EMessage {
private:
ewol::EObject* m_callerObject; //!< Caller class.
const char* m_event; //!< Event pointer ==> unique Id define by the system ...
const char* m_event; //!< Event pointer == > unique Id define by the system ...
etk::UString m_data; //!< compositing additionnal message Value.
public:
EMessage(ewol::EObject* _caller,
@ -26,12 +26,12 @@ namespace ewol {
m_event(_message),
m_data(_data)
{ };
void SetCaller(ewol::EObject* _caller) { m_callerObject = _caller; };
inline ewol::EObject* GetCaller(void) const { return m_callerObject; };
void SetMessage(const char* _message) { m_event = _message; };
inline const char* GetMessage(void) const { return m_event; };
void SetData(const etk::UString& _data) { m_data = _data; };
inline const etk::UString& GetData(void) const { return m_data; };
void setCaller(ewol::EObject* _caller) { m_callerObject = _caller; };
inline ewol::EObject* getCaller(void) const { return m_callerObject; };
void setMessage(const char* _message) { m_event = _message; };
inline const char* getMessage(void) const { return m_event; };
void setData(const etk::UString& _data) { m_data = _data; };
inline const etk::UString& getData(void) const { return m_data; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::EMessage& _obj);
};

View File

@ -22,11 +22,11 @@ ewol::EMultiCast::EMultiCast(void)
ewol::EMultiCast::~EMultiCast(void)
{
EWOL_INFO("EObject message Multi-Cast");
m_messageList.Clear();
m_messageList.clear();
}
void ewol::EMultiCast::Add(ewol::EObject* _object, const char* const _message)
void ewol::EMultiCast::add(ewol::EObject* _object, const char* const _message)
{
if (NULL == _object) {
EWOL_ERROR("Add with NULL object");
@ -36,42 +36,42 @@ void ewol::EMultiCast::Add(ewol::EObject* _object, const char* const _message)
EWOL_ERROR("Add with NULL Message");
return;
}
m_messageList.PushBack(MessageList(_message, _object));
EWOL_DEBUG("SendMulticast ADD listener :" << _object->GetId() << " on \"" << _message << "\"" );
m_messageList.pushBack(MessageList(_message, _object));
EWOL_DEBUG("SendMulticast ADD listener :" << _object->getId() << " on \"" << _message << "\"" );
}
void ewol::EMultiCast::Rm(ewol::EObject* _object)
void ewol::EMultiCast::rm(ewol::EObject* _object)
{
if (NULL == _object) {
EWOL_ERROR("Rm with NULL object");
return;
}
// send the message at all registered widget ...
for (int32_t iii=m_messageList.Size()-1; iii>=0; iii--) {
for (int32_t iii=m_messageList.size()-1; iii >= 0; iii--) {
if(m_messageList[iii].m_object == _object) {
EWOL_DEBUG("SendMulticast RM listener :" << _object->GetId());
EWOL_DEBUG("SendMulticast RM listener :" << _object->getId());
m_messageList[iii].m_message = NULL;
m_messageList[iii].m_object = NULL;
m_messageList.Erase(iii);
m_messageList.erase(iii);
}
}
}
void ewol::EMultiCast::Send(ewol::EObject* _object, const char* const _message, const etk::UString& _data)
void ewol::EMultiCast::send(ewol::EObject* _object, const char* const _message, const etk::UString& _data)
{
EWOL_VERBOSE("SendMulticast message \"" << _message << "\" data=\"" << _data << "\" to :");
// send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
for (int32_t iii=0; iii<m_messageList.size(); iii++) {
if( m_messageList[iii].m_message == _message
&& m_messageList[iii].m_object != _object)
{
if (NULL != m_messageList[iii].m_object) {
EWOL_VERBOSE(" id = " << m_messageList[iii].m_object->GetId() << " type=" << m_messageList[iii].m_object->GetObjectType());
EWOL_VERBOSE(" id = " << m_messageList[iii].m_object->getId() << " type=" << m_messageList[iii].m_object->getObjectType());
// generate event ... (create message before ...
ewol::EMessage tmpMsg(_object, m_messageList[iii].m_message, _data);
m_messageList[iii].m_object->OnReceiveMessage(tmpMsg);
m_messageList[iii].m_object->onReceiveMessage(tmpMsg);
}
}
}

View File

@ -30,10 +30,10 @@ namespace ewol {
public:
EMultiCast();
~EMultiCast(void);
void AnonymousSend(const char* const _messageId, const etk::UString& _data) { Send(NULL, _messageId, _data); };
void Send(ewol::EObject* _object, const char* const _message, const etk::UString& _data);
void Rm(ewol::EObject* _object);
void Add(ewol::EObject* _object, const char* const _message);
void anonymousSend(const char* const _messageId, const etk::UString& _data) { send(NULL, _messageId, _data); };
void send(ewol::EObject* _object, const char* const _message, const etk::UString& _data);
void rm(ewol::EObject* _object);
void add(ewol::EObject* _object, const char* const _message);
};
};

View File

@ -25,84 +25,84 @@ ewol::EObject::EObject(void) :
// note this is nearly atomic ... (but it is enough)
m_uniqueId = ss_globalUniqueId++;
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
GetEObjectManager().Add(this);
RegisterConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
getEObjectManager().add(this);
registerConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
}
ewol::EObject::~EObject(void)
{
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
GetEObjectManager().Rm(this);
GetMultiCast().Rm(this);
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
getEObjectManager().rm(this);
getMultiCast().rm(this);
for (int32_t iii=0; iii<m_externEvent.size(); iii++) {
if (NULL!=m_externEvent[iii]) {
delete(m_externEvent[iii]);
m_externEvent[iii] = NULL;
}
}
m_externEvent.Clear();
m_availlableEventId.Clear();
m_externEvent.clear();
m_availlableEventId.clear();
m_uniqueId = -1;
}
void ewol::EObject::AutoDestroy(void)
void ewol::EObject::autoDestroy(void)
{
GetEObjectManager().AutoRemove(this);
getEObjectManager().autoRemove(this);
}
void ewol::EObject::RemoveObject(void)
void ewol::EObject::removeObject(void)
{
GetEObjectManager().AutoRemove(this);
getEObjectManager().autoRemove(this);
}
void ewol::EObject::AddEventId(const char * _generateEventId)
void ewol::EObject::addEventId(const char * _generateEventId)
{
if (NULL != _generateEventId) {
m_availlableEventId.PushBack(_generateEventId);
m_availlableEventId.pushBack(_generateEventId);
}
}
void ewol::EObject::GenerateEventId(const char * _generateEventId, const etk::UString& _data)
void ewol::EObject::generateEventId(const char * _generateEventId, const etk::UString& _data)
{
int32_t nbObject = GetEObjectManager().GetNumberObject();
int32_t nbObject = getEObjectManager().getNumberObject();
// for every element registered ...
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
for (int32_t iii=0; iii<m_externEvent.size(); iii++) {
if (NULL!=m_externEvent[iii]) {
// if we find the event ...
if (m_externEvent[iii]->localEventId == _generateEventId) {
if (NULL != m_externEvent[iii]->destEObject) {
if (m_externEvent[iii]->overloadData.Size()<=0){
if (m_externEvent[iii]->overloadData.size() <= 0){
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, _data);
m_externEvent[iii]->destEObject->OnReceiveMessage(tmpMsg);
m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg);
} else {
// set the user requested data ...
ewol::EMessage tmpMsg(this, m_externEvent[iii]->destEventId, m_externEvent[iii]->overloadData);
m_externEvent[iii]->destEObject->OnReceiveMessage(tmpMsg);
m_externEvent[iii]->destEObject->onReceiveMessage(tmpMsg);
}
}
}
}
}
if (nbObject > GetEObjectManager().GetNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous");
if (nbObject > getEObjectManager().getNumberObject()) {
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->removeObject() which is asynchronous");
}
}
void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UString& _data)
void ewol::EObject::sendMultiCast(const char* const _messageId, const etk::UString& _data)
{
int32_t nbObject = GetEObjectManager().GetNumberObject();
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");
int32_t nbObject = getEObjectManager().getNumberObject();
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");
}
}
void ewol::EObject::RegisterMultiCast(const char* const _messageId)
void ewol::EObject::registerMultiCast(const char* const _messageId)
{
GetMultiCast().Add(this, _messageId);
getMultiCast().add(this, _messageId);
}
void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
void ewol::EObject::registerOnEvent(ewol::EObject * _destinationObject,
const char * _eventId,
const char * _eventIdgenerated,
const etk::UString& _overloadData)
@ -117,7 +117,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
}
// check if event existed :
bool findIt = false;
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) {
for(int32_t iii=0; iii<m_availlableEventId.size(); iii++) {
if (m_availlableEventId[iii] == _eventId) {
findIt = true;
break;
@ -125,7 +125,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
}
if (false == findIt) {
EWOL_DEBUG("Try to register with a NON direct string name");
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) {
for(int32_t iii=0; iii<m_availlableEventId.size(); iii++) {
if (0 == strncmp(m_availlableEventId[iii], _eventId, 1024)) {
findIt = true;
_eventIdgenerated = m_availlableEventId[iii];
@ -134,7 +134,7 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
}
}
if (false == findIt) {
EWOL_ERROR("Can not register event on this WidgetType=" << GetObjectType() << " event=\"" << _eventId << "\" ==> unknow event");
EWOL_ERROR("Can not register event on this WidgetType=" << getObjectType() << " event=\"" << _eventId << "\" == > unknow event");
return;
}
ewol::EventExtGen * tmpEvent = new ewol::EventExtGen();
@ -150,112 +150,112 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
} else {
tmpEvent->destEventId = _eventId;
}
m_externEvent.PushBack(tmpEvent);
m_externEvent.pushBack(tmpEvent);
}
void ewol::EObject::OnObjectRemove(ewol::EObject * _removeObject)
void ewol::EObject::onObjectRemove(ewol::EObject * _removeObject)
{
for(int32_t iii=m_externEvent.Size()-1; iii>=0; iii--) {
if (NULL==m_externEvent[iii]) {
m_externEvent.Erase(iii);
for(int32_t iii=m_externEvent.size()-1; iii >= 0; iii--) {
if (NULL == m_externEvent[iii]) {
m_externEvent.erase(iii);
} else if (m_externEvent[iii]->destEObject == _removeObject) {
m_externEvent.Erase(iii);
m_externEvent.erase(iii);
}
}
}
void ewol::EObject::RegisterConfig(const char* _config, const char* _type, const char* _control, const char* _description, const char* _default)
void ewol::EObject::registerConfig(const char* _config, const char* _type, const char* _control, const char* _description, const char* _default)
{
if (NULL == _config) {
EWOL_ERROR("Try to add NULL config");
return;
}
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) {
if (NULL != m_listConfig[iii].GetConfig()) {
if (0==strcmp(m_listConfig[iii].GetConfig(), _config) ) {
for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].getConfig()) {
if (0 == strcmp(m_listConfig[iii].getConfig(), _config) ) {
EWOL_ERROR("Try to add config already added : " << _config << " at pos=" << iii);
}
}
}
m_listConfig.PushBack(ewol::EConfigElement(_config, _type, _control, _description, _default));
m_listConfig.pushBack(ewol::EConfigElement(_config, _type, _control, _description, _default));
}
bool ewol::EObject::LoadXML(exml::Element* _node)
bool ewol::EObject::loadXML(exml::Element* _node)
{
if (NULL==_node) {
if (NULL == _node) {
return false;
}
bool errorOccured = true;
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) {
if (m_listConfig[iii].GetConfig() == NULL) {
for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (m_listConfig[iii].getConfig() == NULL) {
continue;
}
etk::UString value = _node->GetAttribute(m_listConfig[iii].GetConfig());
etk::UString value = _node->getAttribute(m_listConfig[iii].getConfig());
// check existance :
if (value.Size()==0) {
if (value.size() == 0) {
continue;
}
if (false==SetConfig(ewol::EConfig(m_listConfig[iii].GetConfig(), value) ) ) {
if (false == setConfig(ewol::EConfig(m_listConfig[iii].getConfig(), value) ) ) {
errorOccured = false;
}
}
return errorOccured;
}
bool ewol::EObject::StoreXML(exml::Element* _node) const
bool ewol::EObject::storeXML(exml::Element* _node) const
{
if (NULL==_node) {
if (NULL == _node) {
return false;
}
bool errorOccured = true;
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) {
if (m_listConfig[iii].GetConfig() == NULL) {
for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (m_listConfig[iii].getConfig() == NULL) {
continue;
}
etk::UString value = GetConfig(m_listConfig[iii].GetConfig());
if (NULL != m_listConfig[iii].GetDefault() ) {
if (value == m_listConfig[iii].GetDefault() ) {
etk::UString value = getConfig(m_listConfig[iii].getConfig());
if (NULL != m_listConfig[iii].getDefault() ) {
if (value == m_listConfig[iii].getDefault() ) {
// nothing to add on the XML :
continue;
}
}
// add attribute ... ==> note : Add special element when '"' element detected ...
_node->SetAttribute(m_listConfig[iii].GetConfig(), value);
// add attribute ... == > note : add special element when '"' element detected ...
_node->setAttribute(m_listConfig[iii].getConfig(), value);
}
return errorOccured;
}
bool ewol::EObject::OnSetConfig(const ewol::EConfig& _conf)
bool ewol::EObject::onSetConfig(const ewol::EConfig& _conf)
{
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} set config : " << _conf);
if (_conf.GetConfig() == ewol::EObject::configName) {
EWOL_VERBOSE("[" << GetId() << "] {" << GetObjectType() << "} Set config name : \"" << _conf.GetData() << "\"");
SetName(_conf.GetData());
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config : " << _conf);
if (_conf.getConfig() == ewol::EObject::configName) {
EWOL_VERBOSE("[" << getId() << "] {" << getObjectType() << "} set config name : \"" << _conf.getData() << "\"");
setName(_conf.getData());
return true;
}
return false;
}
bool ewol::EObject::OnGetConfig(const char* _config, etk::UString& _result) const
bool ewol::EObject::onGetConfig(const char* _config, etk::UString& _result) const
{
if (_config == ewol::EObject::configName) {
_result = GetName();
_result = getName();
return true;
}
return false;
};
bool ewol::EObject::SetConfig(const etk::UString& _config, const etk::UString& _value)
bool ewol::EObject::setConfig(const etk::UString& _config, const etk::UString& _value)
{
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) {
if (NULL != m_listConfig[iii].GetConfig()) {
if (_config == m_listConfig[iii].GetConfig() ) {
for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].getConfig()) {
if (_config == m_listConfig[iii].getConfig() ) {
// call config with standard parameter
return SetConfig(ewol::EConfig(m_listConfig[iii].GetConfig(), _value));
return setConfig(ewol::EConfig(m_listConfig[iii].getConfig(), _value));
}
}
}
@ -263,22 +263,22 @@ bool ewol::EObject::SetConfig(const etk::UString& _config, const etk::UString& _
return false;
}
etk::UString ewol::EObject::GetConfig(const char* _config) const
etk::UString ewol::EObject::getConfig(const char* _config) const
{
etk::UString res="";
if (NULL != _config) {
(void)OnGetConfig(_config, res);
(void)onGetConfig(_config, res);
}
return res;
};
etk::UString ewol::EObject::GetConfig(const etk::UString& _config) const
etk::UString ewol::EObject::getConfig(const etk::UString& _config) const
{
for(int32_t iii=0 ; iii<m_listConfig.Size() ; iii++) {
if (NULL != m_listConfig[iii].GetConfig()) {
if (_config == m_listConfig[iii].GetConfig() ) {
for(int32_t iii=0 ; iii<m_listConfig.size() ; iii++) {
if (NULL != m_listConfig[iii].getConfig()) {
if (_config == m_listConfig[iii].getConfig() ) {
// call config with standard parameter
return GetConfig(m_listConfig[iii].GetConfig());
return getConfig(m_listConfig[iii].getConfig());
}
}
}
@ -287,36 +287,36 @@ etk::UString ewol::EObject::GetConfig(const etk::UString& _config) const
}
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf)
bool ewol::EObject::setConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf)
{
ewol::EObject* object = GetEObjectManager().Get(_name);
ewol::EObject* object = getEObjectManager().get(_name);
if (object == NULL) {
return false;
}
return object->SetConfig(_conf);
return object->setConfig(_conf);
}
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value)
bool ewol::EObject::setConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value)
{
ewol::EObject* object = GetEObjectManager().Get(_name);
ewol::EObject* object = getEObjectManager().get(_name);
if (object == NULL) {
return false;
}
return object->SetConfig(_config, _value);
return object->setConfig(_config, _value);
}
ewol::EObjectManager& ewol::EObject::GetEObjectManager(void)
ewol::EObjectManager& ewol::EObject::getEObjectManager(void)
{
return ewol::GetContext().GetEObjectManager();
return ewol::getContext().getEObjectManager();
}
ewol::EMultiCast& ewol::EObject::GetMultiCast(void)
ewol::EMultiCast& ewol::EObject::getMultiCast(void)
{
return ewol::GetContext().GetEObjectManager().MultiCast();
return ewol::getContext().getEObjectManager().multiCast();
}
ewol::eContext& ewol::EObject::GetContext(void)
ewol::eContext& ewol::EObject::getContext(void)
{
return ewol::GetContext();
return ewol::getContext();
}

View File

@ -33,13 +33,12 @@ namespace ewol {
public:
const char* localEventId; //!< local event Id generation
ewol::EObject* destEObject; //!< destination widget that might be call
const char* destEventId; //!< Generated event ID on the distant widget
const char* destEventId; //!< generated event ID on the distant widget
etk::UString overloadData; //!< sometimes the user prefer to receive some specific data on an event (instead of the one sed by the widget)
};
/**
* @brief Basic message classes for ewol system
*
* this class mermit at every EObject to communicate between them.
*/
class EObject {
@ -49,7 +48,7 @@ namespace ewol {
protected:
bool m_static; //!< set this variable at true if this element must not be auto destroy (exemple : use static object)
private:
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed
int32_t m_uniqueId; //!< Object UniqueID == > TODO : Check if it use is needed
etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
public:
@ -64,85 +63,85 @@ namespace ewol {
virtual ~EObject(void);
/**
* @brief Get the static status of the EObject ==> mark at true if the user set the object mark as static allocated element ==> not auto remove element
* @return true if it might not be removed ==> usefull for conficuration class
* @brief get the static status of the EObject == > mark at true if the user set the object mark as static allocated element ==> not auto remove element
* @return true if it might not be removed == > usefull for conficuration class
*/
bool GetStatic(void){ return m_static; };
bool getStatic(void){ return m_static; };
/**
* @brief Get the UniqueId of the EObject
* @brief get the UniqueId of the EObject
* @return the requested ID
*/
int32_t GetId(void){ return m_uniqueId; };
int32_t getId(void){ return m_uniqueId; };
/**
* @brief Auto-destroy the object
*/
void AutoDestroy(void);
void autoDestroy(void);
/**
* @brief Asynchronous removing the object
*/
void RemoveObject(void);
void removeObject(void);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @brief get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast == > this will replace it
* @param[in] _objectType type description
* @return true if the object is compatible, otherwise false
*/
virtual const char * const GetObjectType(void) { return "EObject"; };
virtual const char * const getObjectType(void) { return "EObject"; };
protected:
/**
* @brief Add a specific event Id in the list to prevent wrong link on a EObject
* @brief add a specific event Id in the list to prevent wrong link on a EObject
* @param[in] _generateEventId event Id to add
*/
void AddEventId(const char * _generateEventId);
void addEventId(const char * _generateEventId);
/**
* @brief Generate event on all registered EObject
* @brief generate event on all registered EObject
* @param[in] _generateEventId event Id that is curetly generated
* @param[in] _data data associated with the event
*/
void GenerateEventId(const char * _generateEventId, const etk::UString& _data = "");
void generateEventId(const char * _generateEventId, const etk::UString& _data = "");
/**
* @brief Generate Multicast event on all EObject requested the event
* @brief generate Multicast event on all EObject requested the event
* @param[in] _messageId Event Id that is generated
* @param[in] _data String that is send at all the destinations
*/
void SendMultiCast(const char* const _messageId, const etk::UString& _data = "");
void sendMultiCast(const char* const _messageId, const etk::UString& _data = "");
/**
* @brief Register of the arrival of a Multicast message
* @param[in] _messageId Event Id waiting for...
*/
void RegisterMultiCast(const char* const _messageId);
void registerMultiCast(const char* const _messageId);
public:
/**
* @brief Register an EObject over an other to get event on the second...
* @param[in] _destinationObject pointer on the object that might be call when an event is generated
* @param[in] _eventId Event generate inside the object
* @param[in] _eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...)
* @param[in] _eventIdgenerated event generated when call the distant EObject.onReceiveMessage(...)
* @param[in] _overloadData When the user prever to receive a data specificly for this event ...
*/
void RegisterOnEvent(ewol::EObject * _destinationObject,
void registerOnEvent(ewol::EObject * _destinationObject,
const char * _eventId,
const char * _eventIdgenerated = NULL,
const etk::UString& _overloadData="");
/**
* @brief Inform object that an other object is removed ...
* @param[in] _removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @param[in] _removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject
* @note : Sub classes must call this class
*/
virtual void OnObjectRemove(ewol::EObject * _removeObject);
virtual void onObjectRemove(ewol::EObject * _removeObject);
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] _msg Message handle
*/
virtual void OnReceiveMessage(const ewol::EMessage& _msg) { };
virtual void onReceiveMessage(const ewol::EMessage& _msg) { };
private:
etk::Vector<ewol::EConfigElement> m_listConfig;
protected:
@ -154,86 +153,86 @@ namespace ewol {
* @param[in] _description Descritpion on the current type.
* @param[in] _default Default value of this parameter.
*/
void RegisterConfig(const char* _config, const char* _type=NULL, const char* _control=NULL, const char* _description=NULL, const char* _default=NULL);
void registerConfig(const char* _config, const char* _type=NULL, const char* _control=NULL, const char* _description=NULL, const char* _default=NULL);
/**
* @brief Configuration requested to the curent EObject
* @param[in] _conf Configuration handle.
* @return true if the parametere has been used
*/
virtual bool OnSetConfig(const ewol::EConfig& _conf);
virtual bool onSetConfig(const ewol::EConfig& _conf);
/**
* @brief Receive a configuration message from an other element system or from the curent EObject
* @param[in] _config Configuration name.
* @param[out] _result Result of the request.
* @return true if the config is set
*/
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const ;
virtual bool onGetConfig(const char* _config, etk::UString& _result) const ;
public:
/**
* @brief Get all the configuration list
* @brief get all the configuration list
* @return The list of all parameter availlable in the widget
*/
virtual const etk::Vector<ewol::EConfigElement>& GetConfigList(void) { return m_listConfig; };
virtual const etk::Vector<ewol::EConfigElement>& getConfigList(void) { return m_listConfig; };
/**
* @brief Configuration requested to the curent EObject (systrem mode)
* @param[in] _conf Configuration handle.
* @return true if config set correctly...
*/
bool SetConfig(const ewol::EConfig& _conf) { return OnSetConfig(_conf); };
bool SetConfig(const etk::UString& _config, const etk::UString& _value); // need a search ...
bool SetConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value); // need a search ...
bool SetConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf);
bool setConfig(const ewol::EConfig& _conf) { return onSetConfig(_conf); };
bool setConfig(const etk::UString& _config, const etk::UString& _value); // need a search ...
bool setConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value); // need a search ...
bool setConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf);
/**
* @brief Configuration Get from the curent EObject (systrem mode)
* @brief Configuration get from the curent EObject (systrem mode)
* @param[in] _config Configuration name.
* @return the config properties
*/
etk::UString GetConfig(const char* _config) const;
etk::UString GetConfig(const etk::UString& _config) const; // need search
etk::UString getConfig(const char* _config) const;
etk::UString getConfig(const etk::UString& _config) const; // need search
protected:
etk::UString m_name; //!< name of the element ...
public:
/**
* @brief Get the eObject name
* @brief get the eObject name
* @return The requested name
*/
const etk::UString& GetName(void) const { return m_name; };
const etk::UString& getName(void) const { return m_name; };
/**
* @brief Get the Widget name
* @brief get the Widget name
* @param[in] _name The new name
*/
void SetName(const etk::UString& _name) { m_name=_name; };
void setName(const etk::UString& _name) { m_name=_name; };
public:
/**
* @brief Load properties with an XML node.
* @brief load properties with an XML node.
* @param[in] _node Pointer on the tinyXML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool LoadXML(exml::Element* _node);
virtual bool loadXML(exml::Element* _node);
/**
* @brief Store properties in this XML node.
* @brief store properties in this XML node.
* @param[in,out] _node Pointer on the tinyXML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool StoreXML(exml::Element* _node) const;
virtual bool storeXML(exml::Element* _node) const;
public:
/**
* @breif Get the current EObject manager.
* @breif get the current EObject manager.
* @return the requested object manager.
*/
ewol::EObjectManager& GetEObjectManager(void);
ewol::EObjectManager& getEObjectManager(void);
/**
* @breif Get the current EObject Message Multicast manager.
* @breif get the current EObject Message Multicast manager.
* @return the requested object manager.
*/
ewol::EMultiCast& GetMultiCast(void);
ewol::EMultiCast& getMultiCast(void);
/**
* @brief Get the curent the system inteface.
* @brief get the curent the system inteface.
* @return current reference on the instance.
*/
eContext& GetContext(void);
eContext& getContext(void);
};
};

View File

@ -15,97 +15,97 @@
ewol::EObjectManager::EObjectManager(void)
{
EWOL_DEBUG("==> Init EObject-Manager");
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
m_eObjectAutoRemoveList.Clear();
m_eObjectList.Clear();
EWOL_DEBUG(" == > init EObject-Manager");
// Can create mlemory leak ... == > but not predictable comportement otherwise ...
m_eObjectAutoRemoveList.clear();
m_eObjectList.clear();
}
ewol::EObjectManager::~EObjectManager(void)
{
bool hasError = false;
if (m_eObjectAutoRemoveList.Size()!=0) {
if (m_eObjectAutoRemoveList.size()!=0) {
EWOL_ERROR("Must not have anymore eObject to auto-remove !!!");
hasError = true;
}
if (m_eObjectList.Size()!=0) {
if (m_eObjectList.size()!=0) {
EWOL_ERROR("Must not have anymore eObject !!!");
hasError = true;
}
if (true==hasError) {
if (true == hasError) {
EWOL_ERROR("Check if the function UnInit has been called !!!");
}
}
void ewol::EObjectManager::UnInit(void)
void ewol::EObjectManager::unInit(void)
{
EWOL_DEBUG("==> Un-Init EObject-Manager");
RemoveAllAutoRemove();
EWOL_INFO(" Remove missing user widget");
EWOL_DEBUG(" == > Un-Init EObject-Manager");
removeAllAutoRemove();
EWOL_INFO(" remove missing user widget");
int32_t iii=0;
while(iii<m_eObjectList.Size()) {
while(iii<m_eObjectList.size()) {
if (m_eObjectList[iii]!=NULL) {
if (m_eObjectList[iii]->GetStatic() == true) {
if (m_eObjectList[iii]->getStatic() == true) {
iii++;
} else {
EWOL_WARNING("Un-INIT : Remove EObject type=\"" << m_eObjectList[iii]->GetObjectType() << "\"");
EWOL_WARNING("Un-INIT : remove EObject type=\"" << m_eObjectList[iii]->getObjectType() << "\"");
delete(m_eObjectList[iii]);
m_eObjectList[iii] = NULL;
}
} else {
m_eObjectList.Erase(iii);
m_eObjectList.erase(iii);
}
}
}
void ewol::EObjectManager::Add(ewol::EObject* _object)
void ewol::EObjectManager::add(ewol::EObject* _object)
{
if (NULL != _object) {
m_eObjectList.PushBack(_object);
m_eObjectList.pushBack(_object);
} else {
EWOL_ERROR("try to add an inexistant EObject in manager");
}
}
int32_t ewol::EObjectManager::GetNumberObject(void)
int32_t ewol::EObjectManager::getNumberObject(void)
{
return m_eObjectList.Size() + m_eObjectAutoRemoveList.Size();
return m_eObjectList.size() + m_eObjectAutoRemoveList.size();
}
void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object)
{
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] != NULL) {
m_eObjectList[iii]->OnObjectRemove(_object);
m_eObjectList[iii]->onObjectRemove(_object);
}
}
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.Size(); iii++) {
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.size(); iii++) {
if( m_eObjectAutoRemoveList[iii] != NULL
&& m_eObjectAutoRemoveList[iii] != _object) {
m_eObjectAutoRemoveList[iii]->OnObjectRemove(_object);
m_eObjectAutoRemoveList[iii]->onObjectRemove(_object);
}
}
// call input event manager to remove linked widget ...
ewol::GetContext().OnObjectRemove(_object);
ewol::getContext().onObjectRemove(_object);
}
void ewol::EObjectManager::Rm(ewol::EObject* _object)
void ewol::EObjectManager::rm(ewol::EObject* _object)
{
if (NULL == _object) {
EWOL_ERROR("Try to remove (NULL) EObject");
return;
}
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] == _object) {
// Remove Element
// remove Element
m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii);
m_eObjectList.erase(iii);
informOneObjectIsRemoved(_object);
return;
}
}
// check if the object has not been auto removed ... or remove in defered time ...
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.Size(); iii++) {
for (int32_t iii=0; iii<m_eObjectAutoRemoveList.size(); iii++) {
if( m_eObjectAutoRemoveList[iii] != NULL
&& m_eObjectAutoRemoveList[iii] == _object) {
return;
@ -115,21 +115,21 @@ void ewol::EObjectManager::Rm(ewol::EObject* _object)
EWOL_ERROR("Try to remove EObject that is not referenced ...");
}
void ewol::EObjectManager::AutoRemove(ewol::EObject* _object)
void ewol::EObjectManager::autoRemove(ewol::EObject* _object)
{
if (NULL == _object) {
EWOL_ERROR("Try to Auto-Remove (NULL) EObject");
return;
}
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] == _object) {
// Remove Element
// remove Element
m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii);
EWOL_DEBUG("Auto-Remove EObject : [" << _object->GetId() << "] type=\"" << _object->GetObjectType() << "\"");
m_eObjectList.erase(iii);
EWOL_DEBUG("Auto-Remove EObject : [" << _object->getId() << "] type=\"" << _object->getObjectType() << "\"");
informOneObjectIsRemoved(_object);
m_eObjectAutoRemoveList.PushBack(_object);
ewol::GetContext().ForceRedrawAll();
m_eObjectAutoRemoveList.pushBack(_object);
ewol::getContext().forceRedrawAll();
return;
}
}
@ -137,29 +137,29 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* _object)
}
// clean all EObject that request an autoRemove ...
void ewol::EObjectManager::RemoveAllAutoRemove(void)
void ewol::EObjectManager::removeAllAutoRemove(void)
{
//EWOL_DEBUG("Auto-Remove EObject section : " << m_eObjectAutoRemoveList.Size() << " elemeents");
while(0<m_eObjectAutoRemoveList.Size()) {
//EWOL_DEBUG("Auto-Remove EObject section : " << m_eObjectAutoRemoveList.size() << " elemeents");
while(0<m_eObjectAutoRemoveList.size()) {
if (m_eObjectAutoRemoveList[0]!=NULL) {
EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->GetObjectType() << "\"");
EWOL_DEBUG("Real Auto-Remove EObject type=\"" << m_eObjectAutoRemoveList[0]->getObjectType() << "\"");
delete(m_eObjectAutoRemoveList[0]);
m_eObjectAutoRemoveList[0] = NULL;
} else {
m_eObjectAutoRemoveList.Erase(0);
m_eObjectAutoRemoveList.erase(0);
}
}
m_eObjectAutoRemoveList.Clear();
m_eObjectAutoRemoveList.clear();
}
ewol::EObject* ewol::EObjectManager::Get(const etk::UString& _name)
ewol::EObject* ewol::EObjectManager::get(const etk::UString& _name)
{
if (_name=="") {
if (_name == "") {
return NULL;
}
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
for (int32_t iii=0; iii<m_eObjectList.size(); iii++) {
if (m_eObjectList[iii] != NULL) {
if (m_eObjectList[iii]->GetName() == _name) {
if (m_eObjectList[iii]->getName() == _name) {
return m_eObjectList[iii];
}
}

View File

@ -18,7 +18,7 @@ namespace ewol
class EObjectManager
{
private:
etk::Vector<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ...
etk::Vector<ewol::EObject*> m_eObjectList; // all widget allocated == > all time increment ... never removed ...
etk::Vector<ewol::EObject*> m_eObjectAutoRemoveList; // all widget allocated
public:
EObjectManager(void);
@ -26,22 +26,22 @@ namespace ewol
/**
* @brief remove all resources (un-init) out of the destructor (due to the system implementation)
*/
void UnInit(void);
void unInit(void);
void Add(ewol::EObject* _object);
void Rm(ewol::EObject* _object);
int32_t GetNumberObject(void);
void add(ewol::EObject* _object);
void rm(ewol::EObject* _object);
int32_t getNumberObject(void);
void AutoRemove(ewol::EObject* _object);
void RemoveAllAutoRemove(void);
void autoRemove(ewol::EObject* _object);
void removeAllAutoRemove(void);
ewol::EObject* Get(const etk::UString& _name);
ewol::EObject* get(const etk::UString& _name);
private:
void informOneObjectIsRemoved(ewol::EObject* _object);
private:
ewol::EMultiCast m_multiCast; //!< muticast manager
public:
ewol::EMultiCast& MultiCast(void) { return m_multiCast; };
ewol::EMultiCast& multiCast(void) { return m_multiCast; };
};
};

View File

@ -13,10 +13,10 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventEntry& _obj)
{
_os << "{type=" << _obj.GetType();
_os << " status=" << _obj.GetStatus();
if (_obj.GetType() == ewol::keyEvent::keyboardChar) {
_os << " char=" << _obj.GetChar();
_os << "{type=" << _obj.getType();
_os << " status=" << _obj.getStatus();
if (_obj.getType() == ewol::keyEvent::keyboardChar) {
_os << " char=" << _obj.getChar();
}
_os << "}";
return _os;

View File

@ -29,14 +29,14 @@ namespace ewol {
m_specialKey(_specialKey),
m_unicodeData(_char)
{ };
void SetType(ewol::keyEvent::keyboard_te _type) { m_type = _type; };
inline const ewol::keyEvent::keyboard_te& GetType(void) const { return m_type; };
void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& GetStatus(void) const { return m_status; };
void SetSpecialKey(const ewol::SpecialKey& _specialKey) { m_specialKey = _specialKey; };
inline const ewol::SpecialKey& GetSpecialKey(void) const { return m_specialKey; };
void SetChar(uniChar_t _char) { m_unicodeData = _char; };
inline const uniChar_t& GetChar(void) const { return m_unicodeData; };
void setType(ewol::keyEvent::keyboard_te _type) { m_type = _type; };
inline const ewol::keyEvent::keyboard_te& getType(void) const { return m_type; };
void setStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& getStatus(void) const { return m_status; };
void setSpecialKey(const ewol::SpecialKey& _specialKey) { m_specialKey = _specialKey; };
inline const ewol::SpecialKey& getSpecialKey(void) const { return m_specialKey; };
void setChar(uniChar_t _char) { m_unicodeData = _char; };
inline const uniChar_t& getChar(void) const { return m_unicodeData; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventEntry& _obj);

View File

@ -13,10 +13,10 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventInput& _obj)
{
_os << "{type=" << _obj.GetType();
_os << " status=" << _obj.GetStatus();
_os << " id=" << _obj.GetId();
_os << " pos=" << _obj.GetPos();
_os << "{type=" << _obj.getType();
_os << " status=" << _obj.getStatus();
_os << " id=" << _obj.getId();
_os << " pos=" << _obj.getPos();
_os << "}";
return _os;
}

View File

@ -28,14 +28,14 @@ namespace ewol {
m_inputId(_id),
m_pos(_pos)
{ };
void SetType(ewol::keyEvent::type_te _type) { m_type = _type; };
inline const ewol::keyEvent::type_te& GetType(void) const { return m_type; };
void SetStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& GetStatus(void) const { return m_status; };
void SetId(uint8_t _id) { m_inputId = _id; };
inline const uint8_t& GetId(void) const { return m_inputId; };
void SetPos(const vec2& _pos) { m_pos = _pos; };
inline const vec2& GetPos(void) const { return m_pos; };
void setType(ewol::keyEvent::type_te _type) { m_type = _type; };
inline const ewol::keyEvent::type_te& getType(void) const { return m_type; };
void setStatus(ewol::keyEvent::status_te _status) { m_status = _status; };
inline const ewol::keyEvent::status_te& getStatus(void) const { return m_status; };
void setId(uint8_t _id) { m_inputId = _id; };
inline const uint8_t& getId(void) const { return m_inputId; };
void setPos(const vec2& _pos) { m_pos = _pos; };
inline const vec2& getPos(void) const { return m_pos; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventInput& _obj);
@ -56,10 +56,10 @@ namespace ewol {
ewol::Widget* m_dest;
int32_t m_realIdEvent;
public:
void SetDestWidget(ewol::Widget* _dest) { m_dest = _dest; };
inline ewol::Widget* GetDestWidget(void) const { return m_dest; };
void SetRealId(int32_t _realIdEvent) { m_realIdEvent = _realIdEvent; };
inline int32_t GetRealId(void) const { return m_realIdEvent; };
void setDestWidget(ewol::Widget* _dest) { m_dest = _dest; };
inline ewol::Widget* getDestWidget(void) const { return m_dest; };
void setRealId(int32_t _realIdEvent) { m_realIdEvent = _realIdEvent; };
inline int32_t getRealId(void) const { return m_realIdEvent; };
/*
private:
int64_t m_lastTime;

View File

@ -13,10 +13,10 @@
etk::CCout& ewol::operator <<(etk::CCout& _os, const ewol::EventTime& _obj)
{
_os << "{time=" << _obj.GetTime();
_os << " uptime=" << _obj.GetApplUpTime();
_os << " delta=" << _obj.GetDelta();
_os << " deltaCall=" << _obj.GetDeltaCall();
_os << "{time=" << _obj.getTime();
_os << " uptime=" << _obj.getApplUpTime();
_os << " delta=" << _obj.getDelta();
_os << " deltaCall=" << _obj.getDeltaCall();
_os << "}";
return _os;
}

View File

@ -29,15 +29,15 @@ namespace ewol {
m_timeDeltaCall(_timeDeltaCall)
{ };
public:
void SetTime(int64_t _timeSystem) { m_timeSystem=_timeSystem; };
inline int64_t GetTime(void) const { return m_timeSystem; };
void SetApplWakeUpTime(int64_t _timeUpAppl) { m_timeUpAppl=_timeUpAppl; };
inline int64_t GetApplWakeUpTime(void) const { return m_timeUpAppl; };
inline int64_t GetApplUpTime(void) const { return m_timeSystem-m_timeUpAppl; };
void SetDelta(float _timeDelta) { m_timeDelta=_timeDelta; };
inline float GetDelta(void) const { return m_timeDelta; };
void SetDeltaCall(float _timeDeltaCall) { m_timeDeltaCall=_timeDeltaCall; };
inline float GetDeltaCall(void) const { return m_timeDeltaCall; };
void setTime(int64_t _timeSystem) { m_timeSystem=_timeSystem; };
inline int64_t getTime(void) const { return m_timeSystem; };
void setApplWakeUpTime(int64_t _timeUpAppl) { m_timeUpAppl=_timeUpAppl; };
inline int64_t getApplWakeUpTime(void) const { return m_timeUpAppl; };
inline int64_t getApplUpTime(void) const { return m_timeSystem-m_timeUpAppl; };
void setDelta(float _timeDelta) { m_timeDelta=_timeDelta; };
inline float getDelta(void) const { return m_timeDelta; };
void setDeltaCall(float _timeDeltaCall) { m_timeDeltaCall=_timeDeltaCall; };
inline float getDeltaCall(void) const { return m_timeDeltaCall; };
};
etk::CCout& operator <<(etk::CCout& _os, const ewol::EventTime& _obj);
};

View File

@ -13,8 +13,6 @@ namespace ewol
{
/**
* @brief This class is designed to count the number of frame per second in the main renderer system
* @param ---
* @return ---
*/
class Fps
{
@ -38,11 +36,8 @@ namespace ewol
public:
/**
* @brief Constructor
* @param ---
* @return ---
*/
Fps(const char * displayName, bool displayFPS)
{
Fps(const char * displayName, bool displayFPS) {
startTime = -1;
nbCallTime = 0;
nbDisplayTime = 0;
@ -60,21 +55,15 @@ namespace ewol
}
/**
* @brief Destructor
* @param ---
* @return ---
*/
~Fps(void)
{
~Fps(void) {
}
/**
* @brief this might be call every time a diplay start
* @param ---
* @return ---
*/
void Tic(void)
{
int64_t currentTime = ewol::GetTime();
void tic(void) {
int64_t currentTime = ewol::getTime();
ticTime = currentTime;
nbCallTime++;
if (startTime<0) {
@ -87,14 +76,12 @@ namespace ewol
}
/**
* @brief this might be call every time a diplay stop, it do the display every second
* @param[in] displayTime Display curent time of the frame.
* @return ---
* @param[in] displayTime display curent time of the frame.
*/
void Toc(bool displayTime=false)
{
int64_t currentTime = ewol::GetTime();
void toc(bool displayTime = false) {
int64_t currentTime = ewol::getTime();
int64_t processTimeLocal = (currentTime - ticTime);
if (displayTime==true) {
if (displayTime == true) {
EWOL_DEBUG(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms ");
}
if (drwingDone) {
@ -111,16 +98,14 @@ namespace ewol
/**
* @brief this might be call when a display is really done
*/
void IncrementCounter(void)
{
void incrementCounter(void) {
nbDisplayTime++;
drwingDone = true;
}
/**
* @brief Draw debug display ...
* @brief draw debug display ...
*/
void Draw(void)
{
void draw(void) {
if (true == display) {
if (nbDisplayTime>0) {
EWOL_DEBUG(m_displayName << " : Active : "
@ -151,14 +136,5 @@ namespace ewol
}
};
};
/**
* @brief This fuction display and calculate the curent frame per second of the display
* @note this function must be call 2 time the first at the start of the display and the second at the end of this one
* @param[in] Represent the mode of the counter
* @param[in] the curent system time
* @ return ---
*/
#endif

View File

@ -32,7 +32,7 @@
#include <mach/mach.h>
int64_t ewol::GetTime(void)
int64_t ewol::getTime(void)
{
struct timespec now;
clock_serv_t cclock;
@ -100,7 +100,7 @@ MacOSInterface* interface = NULL;
bool MacOs::Draw(bool _displayEveryTime)
bool MacOs::draw(bool _displayEveryTime)
{
if (interface == NULL) {
return false;
@ -117,7 +117,7 @@ void MacOs::Resize(float _x, float _y)
}
void MacOs::SetMouseState(int32_t _id, bool _isDown, float _x, float _y)
void MacOs::setMouseState(int32_t _id, bool _isDown, float _x, float _y)
{
if (interface == NULL) {
return;
@ -125,7 +125,7 @@ void MacOs::SetMouseState(int32_t _id, bool _isDown, float _x, float _y)
interface->MAC_SetMouseState(_id, _isDown, _x, _y);
}
void MacOs::SetMouseMotion(int32_t _id, float _x, float _y)
void MacOs::setMouseMotion(int32_t _id, float _x, float _y)
{
if (interface == NULL) {
return;
@ -133,7 +133,7 @@ void MacOs::SetMouseMotion(int32_t _id, float _x, float _y)
interface->MAC_SetMouseMotion(_id, _x, _y);
}
void MacOs::SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey)
void MacOs::setKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey)
{
if (interface == NULL) {
return;
@ -150,7 +150,7 @@ void MacOs::SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _
*/
int ewol::Run(int _argc, const char *_argv[])
{
etk::SetArgZero(_argv[0]);
etk::setArgZero(_argv[0]);
interface = new MacOSInterface(_argc, _argv);
if (NULL == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");

View File

@ -15,16 +15,16 @@ namespace MacOs
{
// return true if a flush is needed
bool Draw(bool _displayEveryTime);
bool draw(bool _displayEveryTime);
/**
* @brief The OS inform that the current windows has change his size.
* @param[in] _size new size of the windows.
*/
void Resize(float _x, float _y);
void SetMouseState(int32_t _id, bool _isDown, float _x, float _y);
void SetMouseMotion(int32_t _id, float _x, float _y);
void SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey);
void setMouseState(int32_t _id, bool _isDown, float _x, float _y);
void setMouseMotion(int32_t _id, float _x, float _y);
void setKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey);
};

View File

@ -10,7 +10,7 @@
#import <Cocoa/Cocoa.h>
@interface OpenGLView : NSOpenGLView<NSWindowDelegate>
@interface openGLView : NSOpenGLView<NSWindowDelegate>
{
}
- (void)prepareOpenGL;

View File

@ -27,7 +27,7 @@
int64_t ewol::GetTime(void)
int64_t ewol::getTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
@ -78,8 +78,8 @@ class WindowsContext : public ewol::eContext
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hIcon = loadIcon( NULL, IDI_APPLICATION );
wc.hCursor = loadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = "EwolMainWindows";
@ -90,13 +90,13 @@ class WindowsContext : public ewol::eContext
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);
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 );
// enable openGL for the window
enableOpenGL( hWnd, &hDC, &hRC );
// program main loop
while(true == m_run) {
@ -106,7 +106,7 @@ class WindowsContext : public ewol::eContext
if ( msg.message == WM_QUIT ) {
m_run = false;
} else {
TranslateMessage( &msg );
translateMessage( &msg );
DispatchMessage( &msg );
}
} else {
@ -114,8 +114,8 @@ class WindowsContext : public ewol::eContext
SwapBuffers( hDC );
}
}
// shutdown OpenGL
DisableOpenGL( hWnd, hDC, hRC );
// shutdown openGL
disableOpenGL( hWnd, hDC, hRC );
// destroy the window explicitly
DestroyWindow( hWnd );
return msg.wParam;
@ -128,10 +128,10 @@ class WindowsContext : public ewol::eContext
PostQuitMessage(0);
}
void SetSize(const vec2& _size)
void setSize(const vec2& _size)
{
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
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;
@ -141,7 +141,7 @@ class WindowsContext : public ewol::eContext
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
// TODO : remove this 2 line when code will be writen
l_clipBoardOwnerStd = true;
switch (_clipboardID)
{
@ -152,7 +152,7 @@ class WindowsContext : public ewol::eContext
break;
case ewol::clipBoard::clipboardStd:
if (false == l_clipBoardOwnerStd) {
// Generate a request TO the OS
// 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
@ -187,11 +187,11 @@ class WindowsContext : public ewol::eContext
// Enable OpenGL
void EnableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC)
// enable openGL
void enableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC)
{
// get the device context (DC)
*hDC = GetDC( _hWnd );
*hDC = getDC( _hWnd );
PIXELFORMATDESCRIPTOR pfd;
// set the pixel format for the DC
@ -204,7 +204,7 @@ class WindowsContext : public ewol::eContext
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
int format = ChoosePixelFormat( *_hDC, &pfd );
SetPixelFormat( *_hDC, format, &pfd );
setPixelFormat( *_hDC, format, &pfd );
// create and enable the render context (RC)
*_hRC = wglCreateContext( *_hDC );
@ -212,20 +212,20 @@ class WindowsContext : public ewol::eContext
}
// Disable OpenGL
// disable openGL
void DisableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC)
void disableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC)
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( _hRC );
ReleaseDC( _hWnd, _hDC );
releaseDC( _hWnd, _hDC );
}
// Window Procedure
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam)
{
// TODO : Set this function really work...
// TODO : set this function really work...
classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam);
}
@ -274,8 +274,8 @@ class WindowsContext : public ewol::eContext
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);
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);
}
@ -362,14 +362,14 @@ class WindowsContext : public ewol::eContext
//case : keyInput = ewol::keyEvent::keyboardContextMenu; break;
case VK_NUMLOCK: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break;
case VK_BACK: // DEL
tmpChar.Set(0x08);
tmpChar.set(0x08);
break;
// TODO : Really strang, need to understand why ...
case 46: // Suppr
tmpChar.Set(0x7F);
tmpChar.set(0x7F);
break;
case VK_TAB: // special case for TAB
tmpChar.Set(0x09);
tmpChar.set(0x09);
break;
case VK_RETURN: // special case for TAB
tmpChar = '\n';
@ -377,18 +377,18 @@ class WindowsContext : public ewol::eContext
default:
{
BYTE kbd[256];
GetKeyboardState(kbd);
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);
tmpChar.setUtf8((char*)chars);
}
break;
}
EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam);
if (tmpChar == 0) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
//EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown);
} else {
OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown);

View File

@ -51,7 +51,7 @@ bool hasDisplay = false;
#define X11_INFO EWOL_VERBOSE
#define X11_CRITICAL EWOL_VERBOSE
#endif
int64_t ewol::GetTime(void)
int64_t ewol::getTime(void)
{
struct timespec now;
int ret = clock_gettime(CLOCK_REALTIME, &now);
@ -213,7 +213,7 @@ class X11Interface : public ewol::eContext
{
X11_INFO("Receive : ClientMessage");
if(XAtomeDeleteWindows == (int64_t)event.xclient.data.l[0]) {
EWOL_INFO(" ==> Kill Requested ...");
EWOL_INFO(" == > Kill Requested ...");
OS_Stop();
m_run = false;
}
@ -223,7 +223,7 @@ class X11Interface : public ewol::eContext
// Selection AREA //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
case SelectionClear:
// Selection has been done on an other program ==> clear ours ...
// Selection has been done on an other program == > clear ours ...
X11_INFO("X11 event SelectionClear");
{
#ifdef DEBUG_X11_EVENT
@ -242,14 +242,14 @@ class X11Interface : public ewol::eContext
} else if (true == m_clipBoardOwnerStd) {
m_clipBoardOwnerStd = false;
} else {
EWOL_ERROR("X11 event SelectionClear ==> but no selection requested anymore ...");
EWOL_ERROR("X11 event SelectionClear == > but no selection requested anymore ...");
}
}
break;
case SelectionNotify:
X11_INFO("X11 event SelectionNotify");
if (event.xselection.property == None) {
EWOL_VERBOSE(" ==> no data ...");
EWOL_VERBOSE(" == > no data ...");
} else {
unsigned char *buf = 0;
Atom type;
@ -270,12 +270,12 @@ class X11Interface : public ewol::eContext
);
if (true == m_clipBoardRequestPrimary) {
etk::UString tmpppp((char*)buf);
ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardSelection, tmpppp);
ewol::clipBoard::setSystem(ewol::clipBoard::clipboardSelection, tmpppp);
// just transmit an event , we have the data in the system
OS_ClipBoardArrive(ewol::clipBoard::clipboardSelection);
} else {
etk::UString tmpppp((char*)buf);
ewol::clipBoard::SetSystem(ewol::clipBoard::clipboardStd, tmpppp);
ewol::clipBoard::setSystem(ewol::clipBoard::clipboardStd, tmpppp);
// just transmit an event , we have the data in the system
OS_ClipBoardArrive(ewol::clipBoard::clipboardStd);
}
@ -299,9 +299,9 @@ class X11Interface : public ewol::eContext
etk::UString tmpData = "";
if (req->selection == XAtomeSelection) {
tmpData = ewol::clipBoard::Get(ewol::clipBoard::clipboardSelection);
tmpData = ewol::clipBoard::get(ewol::clipBoard::clipboardSelection);
} else if (req->selection == XAtomeClipBoard) {
tmpData = ewol::clipBoard::Get(ewol::clipBoard::clipboardStd);
tmpData = ewol::clipBoard::get(ewol::clipBoard::clipboardStd);
}
etk::Char tmpValueStoredTimeToSend = tmpData.c_str();
const char * magatTextToSend = tmpValueStoredTimeToSend;
@ -324,7 +324,7 @@ class X11Interface : public ewol::eContext
(unsigned char*)listOfAtom,
nbAtomSupported );
respond.xselection.property=req->property;
EWOL_INFO(" ==> Respond ... (test)");
EWOL_INFO(" == > Respond ... (test)");
} else if(XAtomeTargetString == req->target) {
XChangeProperty( m_display,
req->requestor,
@ -335,7 +335,7 @@ class X11Interface : public ewol::eContext
(unsigned char*)magatTextToSend,
strlen(magatTextToSend));
respond.xselection.property=req->property;
EWOL_INFO(" ==> Respond ...");
EWOL_INFO(" == > Respond ...");
} else if (XAtomeTargetStringUTF8 == req->target) {
XChangeProperty( m_display,
req->requestor,
@ -346,7 +346,7 @@ class X11Interface : public ewol::eContext
(unsigned char*)magatTextToSend,
strlen(magatTextToSend));
respond.xselection.property=req->property;
EWOL_INFO(" ==> Respond ...");
EWOL_INFO(" == > Respond ...");
} else {
respond.xselection.property= None;
}
@ -357,7 +357,7 @@ class X11Interface : public ewol::eContext
respond.xselection.target= req->target;
respond.xselection.time = req->time;
XSendEvent (m_display, req->requestor,0,0,&respond);
// Flush the message on the pipe ...
// flush the message on the pipe ...
XFlush (m_display);
}
break;
@ -446,7 +446,7 @@ class X11Interface : public ewol::eContext
break;
case MotionNotify:
X11_INFO("X11 event MotionNotify");
if( true==m_grabAllEvent
if( true == m_grabAllEvent
&& event.xmotion.x == (int32_t)m_forcePos.x()
&& event.xmotion.y == (int32_t)m_forcePos.y()) {
X11_VERBOSE("X11 reject mouse move (grab mode)");
@ -456,12 +456,12 @@ class X11Interface : public ewol::eContext
} else {
m_cursorEventX = event.xmotion.x;
m_cursorEventY = (m_currentHeight-event.xmotion.y);
if(true==m_grabAllEvent) {
if(true == m_grabAllEvent) {
m_cursorEventX -= m_forcePos.x();
m_cursorEventY -= (m_currentHeight-m_forcePos.y());
}
vec2 newDelta = vec2(m_cursorEventX, m_cursorEventY);
if(true==m_grabAllEvent) {
if(true == m_grabAllEvent) {
m_cursorEventX -= m_curentGrabDelta.x();
m_cursorEventY -= m_curentGrabDelta.y();
}
@ -479,9 +479,9 @@ class X11Interface : public ewol::eContext
X11_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
OS_SetMouseMotion(0, vec2(m_cursorEventX, m_cursorEventY));
}
if (true==m_grabAllEvent) {
if (true == m_grabAllEvent) {
if (m_positionChangeRequested == false) {
X11_DEBUG("X11 Set pointer position : " << m_forcePos);
X11_DEBUG("X11 set pointer position : " << m_forcePos);
XWarpPointer(m_display, None, m_WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y());
XFlush(m_display);
m_positionChangeRequested = true;
@ -490,11 +490,11 @@ class X11Interface : public ewol::eContext
}
break;
case FocusIn:
X11_INFO("X11 event FocusIn");
X11_INFO("X11 event focusIn");
specialEventThatNeedARedraw=true;
break;
case FocusOut:
X11_INFO("X11 event : FocusOut");
X11_INFO("X11 event : focusOut");
specialEventThatNeedARedraw=true;
break;
case KeyPress:
@ -625,23 +625,23 @@ class X11Interface : public ewol::eContext
case 77: keyInput = ewol::keyEvent::keyboardNumLock; m_guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break;
case 91: // Suppr on keypad
find = false;
if(m_guiKeyBoardMode.numLock==true){
OS_SetKeyboard(m_guiKeyBoardMode, '.', (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, '.', !(event.type==KeyPress), thisIsAReapeateKey);
if(m_guiKeyBoardMode.numLock == true){
OS_SetKeyboard(m_guiKeyBoardMode, '.', (event.type == KeyPress), thisIsAReapeateKey);
if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, '.', !(event.type == KeyPress), thisIsAReapeateKey);
}
} else {
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, !(event.type==KeyPress), thisIsAReapeateKey);
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, (event.type == KeyPress), thisIsAReapeateKey);
if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, !(event.type == KeyPress), thisIsAReapeateKey);
}
}
break;
case 23: // special case for TAB
find = false;
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, !(event.type==KeyPress), thisIsAReapeateKey);
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, (event.type == KeyPress), thisIsAReapeateKey);
if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, !(event.type == KeyPress), thisIsAReapeateKey);
}
break;
default:
@ -669,11 +669,11 @@ class X11Interface : public ewol::eContext
if (count>0) {
// transform it in unicode
etk::UniChar tmpChar = 0;
tmpChar.SetUtf8(buf);
tmpChar.setUtf8(buf);
//EWOL_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << unicodeValue);
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, !(event.type==KeyPress), thisIsAReapeateKey);
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, (event.type == KeyPress), thisIsAReapeateKey);
if (true == thisIsAReapeateKey) {
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, !(event.type == KeyPress), thisIsAReapeateKey);
}
} else {
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
@ -682,10 +682,10 @@ class X11Interface : public ewol::eContext
break;
}
if (true == find) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, !(event.type==KeyPress), thisIsAReapeateKey);
//EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, (event.type == KeyPress), thisIsAReapeateKey);
if (true == thisIsAReapeateKey) {
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, !(event.type == KeyPress), thisIsAReapeateKey);
}
}
}
@ -728,26 +728,26 @@ class X11Interface : public ewol::eContext
m_run = false;
}
/****************************************************************************************/
virtual void SetSize(const vec2& _size)
virtual void setSize(const vec2& _size)
{
X11_INFO("X11-API: ChangeSize=" << _size);
X11_INFO("X11-API: changeSize=" << _size);
m_currentHeight = _size.y();
m_currentWidth = _size.x();
XResizeWindow(m_display, m_WindowHandle, _size.x(), _size.y());
}
/****************************************************************************************/
virtual void SetPos(const vec2& _pos)
virtual void setPos(const vec2& _pos)
{
X11_INFO("X11-API: ChangePos=" << _pos);
X11_INFO("X11-API: changePos=" << _pos);
XMoveWindow(m_display, m_WindowHandle, _pos.x(), _pos.y());
m_originX = _pos.x();
m_originY = _pos.y();
}
/****************************************************************************************/
/*
virtual void GetAbsPos(ivec2& pos)
virtual void getAbsPos(ivec2& pos)
{
X11_INFO("X11-API: GetAbsPos");
X11_INFO("X11-API: getAbsPos");
int tmp;
unsigned int tmp2;
Window fromroot, tmpwin;
@ -755,10 +755,10 @@ class X11Interface : public ewol::eContext
}
*/
/****************************************************************************************/
virtual void SetCursor(ewol::cursorDisplay_te _newCursor)
virtual void setCursor(ewol::cursorDisplay_te _newCursor)
{
if (_newCursor != m_currentCursor) {
X11_DEBUG("X11-API: Set New Cursor : " << _newCursor);
X11_DEBUG("X11-API: set New Cursor : " << _newCursor);
// undefine previous cursors ...
XUndefineCursor(m_display, m_WindowHandle);
// set the new one :
@ -883,7 +883,7 @@ class X11Interface : public ewol::eContext
m_forcePos.setY(m_currentHeight - m_forcePos.y());
m_grabAllEvent = true;
// change the pointer position to generate a good mouving at the start ...
X11_DEBUG("X11-API: Set pointer position : " << m_forcePos);
X11_DEBUG("X11-API: set pointer position : " << m_forcePos);
XWarpPointer(m_display, None, m_WindowHandle, 0,0, 0, 0, m_forcePos.x(), m_forcePos.y());
XFlush(m_display);
m_positionChangeRequested = true;
@ -918,7 +918,7 @@ class X11Interface : public ewol::eContext
}
int Xscreen = DefaultScreen(m_display);
// set the DPI for the current screen :
ewol::dimension::SetPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen),
ewol::dimension::setPixelRatio(vec2((float)DisplayWidth(m_display, Xscreen)/(float)DisplayWidthMM(m_display, Xscreen),
(float)DisplayHeight(m_display, Xscreen)/(float)DisplayHeightMM(m_display, Xscreen)),
ewol::Dimension::Millimeter);
// get an appropriate visual
@ -1008,7 +1008,7 @@ class X11Interface : public ewol::eContext
XFree(StartupState);
/* Open it, wait for it to appear */
/* open it, wait for it to appear */
XMapWindow(m_display, m_WindowHandle);
//XIfEvent(m_display, &event, WaitForMapNotify, (char*)&m_WindowHandle);
@ -1037,7 +1037,7 @@ class X11Interface : public ewol::eContext
XSetICFocus(m_xic);
// Set the kill atom so we get a message when the user tries to close the window
// set the kill atom so we get a message when the user tries to close the window
if ((m_delAtom = XInternAtom(m_display, "WM_DELETE_WINDOW", 0)) != None) {
XSetWMProtocols(m_display, m_WindowHandle, &m_delAtom, 1);
}
@ -1048,19 +1048,19 @@ class X11Interface : public ewol::eContext
return true;
}
/****************************************************************************************/
void SetIcon(const etk::UString& _inputFile)
void setIcon(const etk::UString& _inputFile)
{
egami::Image dataImage;
// load data
if (false == egami::Load(dataImage, _inputFile)) {
if (false == egami::load(dataImage, _inputFile)) {
EWOL_ERROR("Error when loading Icon");
return;
}
int32_t depth = DefaultDepth(m_display, DefaultScreen(m_display) );
EWOL_DEBUG("X11 Create icon Size=(" << dataImage.GetWidth() << "," << dataImage.GetHeight() << ") depth=" << depth);
EWOL_DEBUG("X11 Create icon size=(" << dataImage.getWidth() << "," << dataImage.getHeight() << ") depth=" << depth);
switch(depth) {
case 8:
EWOL_CRITICAL("Not manage pixmap in 8 bit... ==> no icon ...");
EWOL_CRITICAL("Not manage pixmap in 8 bit... == > no icon ...");
return;
case 16:
break;
@ -1072,7 +1072,7 @@ class X11Interface : public ewol::eContext
EWOL_CRITICAL("Unknow thys type of bitDepth : " << depth);
return;
}
char* tmpVal = new char[4*dataImage.GetWidth()*dataImage.GetHeight()];
char* tmpVal = new char[4*dataImage.getWidth()*dataImage.getHeight()];
if (NULL == tmpVal) {
EWOL_CRITICAL("Allocation error ...");
return;
@ -1080,9 +1080,9 @@ class X11Interface : public ewol::eContext
char* tmpPointer = tmpVal;
switch(depth) {
case 16:
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.Get(pos);
for(ivec2 pos(0,0); pos.y()<dataImage.getHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.getHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.get(pos);
int16_t tmpVal = (((uint16_t)((uint16_t)tmpColor.r()>>3))<<11)
+ (((uint16_t)((uint16_t)tmpColor.g()>>2))<<5)
+ ((uint16_t)((uint16_t)tmpColor.b()>>3));
@ -1092,9 +1092,9 @@ class X11Interface : public ewol::eContext
}
break;
case 24:
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.Get(pos);
for(ivec2 pos(0,0); pos.y()<dataImage.getHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.getHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.get(pos);
*tmpPointer++ = tmpColor.b();
*tmpPointer++ = tmpColor.g();
*tmpPointer++ = tmpColor.r();
@ -1103,9 +1103,9 @@ class X11Interface : public ewol::eContext
}
break;
case 32:
for(ivec2 pos(0,0); pos.y()<dataImage.GetHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.GetHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.Get(pos);
for(ivec2 pos(0,0); pos.y()<dataImage.getHeight(); pos.setY(pos.y()+1)) {
for(pos.setX(0); pos.x()<dataImage.getHeight(); pos.setX(pos.x()+1)) {
etk::Color<> tmpColor = dataImage.get(pos);
*tmpPointer++ = tmpColor.a();
*tmpPointer++ = tmpColor.b();
*tmpPointer++ = tmpColor.g();
@ -1123,12 +1123,12 @@ class X11Interface : public ewol::eContext
ZPixmap,
0,
(char*)tmpVal,
dataImage.GetWidth(),
dataImage.GetHeight(),
dataImage.getWidth(),
dataImage.getHeight(),
32,
0);
Pixmap tmpPixmap = XCreatePixmap(m_display, m_WindowHandle, dataImage.GetWidth(), dataImage.GetHeight(), depth);
Pixmap tmpPixmap = XCreatePixmap(m_display, m_WindowHandle, dataImage.getWidth(), dataImage.getHeight(), depth);
switch(tmpPixmap) {
case BadAlloc:
EWOL_ERROR("X11: BadAlloc");
@ -1144,7 +1144,7 @@ class X11Interface : public ewol::eContext
break;
}
GC tmpGC = DefaultGC(m_display, DefaultScreen(m_display) );
int error = XPutImage(m_display, tmpPixmap, tmpGC, myImage, 0, 0, 0, 0, dataImage.GetWidth(), dataImage.GetHeight());
int error = XPutImage(m_display, tmpPixmap, tmpGC, myImage, 0, 0, 0, 0, dataImage.getWidth(), dataImage.getHeight());
switch(error) {
case BadDrawable:
EWOL_ERROR("X11: BadDrawable");
@ -1174,11 +1174,11 @@ class X11Interface : public ewol::eContext
win_hints->icon_pixmap = tmpPixmap;
// pass the hints to the window manager.
XSetWMHints(m_display, m_WindowHandle, win_hints);
EWOL_INFO(" ==> might be done ");
EWOL_INFO(" == > might be done ");
// finally, we can free the WM hints structure.
XFree(win_hints);
// Note when we free the pixmap ... the icon is removed ... ==> this is a real memory leek ...
// Note when we free the pixmap ... the icon is removed ... == > this is a real memory leek ...
//XFreePixmap(m_display, tmpPixmap);
myImage->data = NULL;
@ -1219,15 +1219,15 @@ class X11Interface : public ewol::eContext
EWOL_INFO("XF86 DRI NOT available\n");
}
// Enable vertical synchronisation : (some computer has synchronisation disable)
// enable vertical synchronisation : (some computer has synchronisation disable)
setVSync(true);
return true;
}
/****************************************************************************************/
void SetTitle(const etk::UString& _title)
void setTitle(const etk::UString& _title)
{
X11_INFO("X11: Set Title (START)");
X11_INFO("X11: set Title (START)");
XTextProperty tp;
etk::Char tmpChar = _title.c_str();
tp.value = (unsigned char *)((const char*)tmpChar);
@ -1238,7 +1238,7 @@ class X11Interface : public ewol::eContext
XStoreName(m_display, m_WindowHandle, (const char*)tp.value);
XSetIconName(m_display, m_WindowHandle, (const char*)tp.value);
XSetWMIconName(m_display, m_WindowHandle, &tp);
X11_INFO("X11: Set Title (END)");
X11_INFO("X11: set Title (END)");
}
/****************************************************************************************/
void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID)
@ -1248,7 +1248,7 @@ class X11Interface : public ewol::eContext
case ewol::clipBoard::clipboardSelection:
if (false == m_clipBoardOwnerPrimary) {
m_clipBoardRequestPrimary = true;
// Generate a request on X11
// generate a request on X11
XConvertSelection(m_display,
XAtomeSelection,
XAtomeTargetStringUTF8,
@ -1263,7 +1263,7 @@ class X11Interface : public ewol::eContext
case ewol::clipBoard::clipboardStd:
if (false == m_clipBoardOwnerStd) {
m_clipBoardRequestPrimary = false;
// Generate a request on X11
// generate a request on X11
XConvertSelection(m_display,
XAtomeClipBoard,
XAtomeTargetStringUTF8,
@ -1314,7 +1314,7 @@ class X11Interface : public ewol::eContext
*/
int ewol::Run(int _argc, const char *_argv[])
{
etk::SetArgZero(_argv[0]);
etk::setArgZero(_argv[0]);
X11Interface* interface = new X11Interface(_argc, _argv);
if (NULL == interface) {
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");

View File

@ -30,31 +30,31 @@ static bool isInit = false;
# include <ewol/renderer/audio/interfacePortAudio.h>
#endif
void ewol::audio::Init(void)
void ewol::audio::init(void)
{
if (isInit == true) {
EWOL_ERROR("multiple init requested ... at the audio system ...");
}
ewol::audio::effects::VolumeSet(0);
ewol::audio::effects::MuteSet(false);
ewol::audio::music::VolumeSet(0);
ewol::audio::music::MuteSet(false);
ewol::audio::effects::volumeSet(0);
ewol::audio::effects::muteSet(false);
ewol::audio::music::volumeSet(0);
ewol::audio::music::muteSet(false);
musicFadingTime = 100;
isInit = true;
#ifdef BUILD_PORTAUDIO
ewol::portAudio::Init();
ewol::portAudio::init();
#endif
}
void ewol::audio::UnInit(void)
void ewol::audio::unInit(void)
{
if (false == isInit) {
EWOL_ERROR("multiple un-init requested ... at the audio system ...");
return;
}
#ifdef BUILD_PORTAUDIO
ewol::portAudio::UnInit();
ewol::portAudio::unInit();
#endif
musicMute = true;
musicVolume = -5000;
@ -65,7 +65,7 @@ void ewol::audio::UnInit(void)
static ewol::audio::AudioCallback userLocalCallback = NULL;
void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
void ewol::audio::getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
// TODO : set the real playing time ...
currentTimePlaying += 10;
@ -80,9 +80,9 @@ void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t n
(*userLocalCallback)(bufferInterlace, nbSample, nbChannels);
}
// get background music :
ewol::audio::music::GetData(bufferInterlace, nbSample, nbChannels);
ewol::audio::music::getData(bufferInterlace, nbSample, nbChannels);
// add effects :
ewol::audio::effects::GetData(bufferInterlace, nbSample, nbChannels);
ewol::audio::effects::getData(bufferInterlace, nbSample, nbChannels);
static FILE * plop = fopen("/home/edupin/testFile48khzstereo.raw", "w");
if (plop!=NULL) {
fwrite(bufferInterlace, sizeof(int16_t), nbSample*nbChannels, plop);
@ -90,69 +90,69 @@ void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t n
}
void ewol::audio::AddCallbackOutput(ewol::audio::AudioCallback userCallback)
void ewol::audio::addCallbackOutput(ewol::audio::AudioCallback userCallback)
{
userLocalCallback = userCallback;
}
void ewol::audio::music::Fading(int32_t timeMs)
void ewol::audio::music::fading(int32_t timeMs)
{
musicFadingTime = timeMs;
musicFadingTime = etk_avg(-100, musicFadingTime, 20);
EWOL_INFO("Set music fading time at " << timeMs << "ms ==> " << musicFadingTime << "ms");
EWOL_INFO("Set music fading time at " << timeMs << "ms == > " << musicFadingTime << "ms");
}
bool ewol::audio::music::ListAdd(etk::UString file)
bool ewol::audio::music::listAdd(etk::UString file)
{
return false;
}
bool ewol::audio::music::ListRm(etk::UString file)
bool ewol::audio::music::listRm(etk::UString file)
{
return false;
}
bool ewol::audio::music::ListClean(void)
bool ewol::audio::music::listClean(void)
{
return false;
}
bool ewol::audio::music::ListPrevious(void)
bool ewol::audio::music::listPrevious(void)
{
return false;
}
bool ewol::audio::music::ListNext(void)
bool ewol::audio::music::listNext(void)
{
return false;
}
bool ewol::audio::music::ListFirst(void)
bool ewol::audio::music::listFirst(void)
{
return false;
}
bool ewol::audio::music::ListLast(void)
bool ewol::audio::music::listLast(void)
{
return false;
}
bool ewol::audio::music::ListPlay(void)
bool ewol::audio::music::listPlay(void)
{
return false;
}
bool ewol::audio::music::ListStop(void)
bool ewol::audio::music::listStop(void)
{
return false;
}
@ -160,20 +160,20 @@ bool ewol::audio::music::ListStop(void)
bool ewol::audio::music::Play(etk::UString file)
bool ewol::audio::music::play(etk::UString file)
{
return false;
}
bool ewol::audio::music::Stop(void)
bool ewol::audio::music::stop(void)
{
return false;
}
float ewol::audio::music::VolumeGet(void)
float ewol::audio::music::volumeGet(void)
{
return musicVolume;
}
@ -181,32 +181,32 @@ float ewol::audio::music::VolumeGet(void)
static void uptateMusicVolume(void)
{
if (musicMute==true) {
if (musicMute == true) {
musicVolumeApply = 0;
} else {
// Convert in an fixpoint value
// convert in an fixpoint value
// V2 = V1*10^(db/20)
double coef = pow(10, (musicVolume/20) );
musicVolumeApply = (int32_t)(coef * (double)(1<<16));
}
}
void ewol::audio::music::VolumeSet(float newVolume)
void ewol::audio::music::volumeSet(float newVolume)
{
musicVolume = newVolume;
musicVolume = etk_avg(-1000, musicVolume, 40);
EWOL_INFO("Set music Volume at " << newVolume << "dB ==> " << musicVolume << "dB");
EWOL_INFO("Set music Volume at " << newVolume << "dB == > " << musicVolume << "dB");
uptateMusicVolume();
}
bool ewol::audio::music::MuteGet(void)
bool ewol::audio::music::muteGet(void)
{
return musicMute;
}
void ewol::audio::music::MuteSet(bool newMute)
void ewol::audio::music::muteSet(bool newMute)
{
musicMute = newMute;
EWOL_INFO("Set music Mute at " << newMute);
@ -214,7 +214,7 @@ void ewol::audio::music::MuteSet(bool newMute)
}
void ewol::audio::music::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
void ewol::audio::music::getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
/*static int32_t maxValue = 0;
static float angle = 0;
@ -226,7 +226,7 @@ void ewol::audio::music::GetData(int16_t * bufferInterlace, int32_t nbSample, in
bufferInterlace[iii*2] = (float)maxValue * sin(angle/180.0 * M_PI);
bufferInterlace[iii*2+1] = bufferInterlace[iii*2];
angle+=0.9;
if (angle>=360) {
if (angle >= 360) {
angle -= 360.0;
}
}*/
@ -244,7 +244,7 @@ class EffectsLoaded {
{
m_file = file;
m_requestedTime = 1;
m_data = ewol::audio::wav::LoadData(file, 1, 48000, m_nbSamples);
m_data = ewol::audio::wav::loadData(file, 1, 48000, m_nbSamples);
if (m_data == NULL) {
// write an error ...
}
@ -262,11 +262,11 @@ class RequestPlay {
int32_t m_playTime; // position in sample playing in the audio effects
public :
RequestPlay(EffectsLoaded * effect) : m_freeSlot(false), m_effect(effect), m_playTime(0) { };
void Reset(EffectsLoaded * effect) { m_effect=effect; m_playTime=0; m_freeSlot=false; };
bool IsFree(void) { return m_freeSlot; };
void Play(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
void reset(EffectsLoaded * effect) { m_effect=effect; m_playTime=0; m_freeSlot=false; };
bool isFree(void) { return m_freeSlot; };
void play(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
if (true==m_freeSlot) {
if (true == m_freeSlot) {
return;
}
if (m_effect->m_data == NULL) {
@ -279,7 +279,7 @@ class RequestPlay {
int16_t * newData = &m_effect->m_data[m_playTime];
//EWOL_DEBUG("AUDIO : Play slot... nb sample : " << processTimeMax << " playTime=" <<m_playTime << " nbCannels=" << nbChannels);
for (int32_t iii=0; iii<processTimeMax; iii++) {
// TODO : Set volume and spacialisation ...
// TODO : set volume and spacialisation ...
for (int32_t jjj=0; jjj<nbChannels; jjj++) {
int32_t tmppp = *pointer + ((((int32_t)*newData)*effectsVolumeApply)>>16);
*pointer = etk_avg(-32767, tmppp, 32766);
@ -290,7 +290,7 @@ class RequestPlay {
}
m_playTime += processTimeMax;
// check end of playing ...
if (m_effect->m_nbSamples<=m_playTime) {
if (m_effect->m_nbSamples <= m_playTime) {
m_freeSlot=true;
}
}
@ -301,9 +301,9 @@ etk::Vector<EffectsLoaded*> ListEffects;
etk::Vector<RequestPlay*> ListEffectsPlaying;
int32_t ewol::audio::effects::Add(etk::UString file)
int32_t ewol::audio::effects::add(etk::UString file)
{
for (int32_t iii=0; iii<ListEffects.Size(); iii++) {
for (int32_t iii=0; iii<ListEffects.size(); iii++) {
if (NULL != ListEffects[iii]) {
if (ListEffects[iii]->m_file == file) {
ListEffects[iii]->m_requestedTime++;
@ -317,25 +317,25 @@ int32_t ewol::audio::effects::Add(etk::UString file)
EWOL_ERROR("Error to load the effects : \"" << file << "\"");
return -1;
}
ListEffects.PushBack(tmpEffect);
return ListEffects.Size()-1;
ListEffects.pushBack(tmpEffect);
return ListEffects.size()-1;
}
void ewol::audio::effects::Rm(int32_t effectId)
void ewol::audio::effects::rm(int32_t effectId)
{
// find element ...
if (effectId <0 || effectId >= ListEffects.Size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not remove it ...");
if (effectId <0 || effectId >= ListEffects.size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] == > can not remove it ...");
return;
}
if (ListEffects[effectId] == NULL) {
EWOL_ERROR("effect ID : " << effectId << " ==> has already been removed");
EWOL_ERROR("effect ID : " << effectId << " == > has already been removed");
return;
}
// check number of requested
if (ListEffects[effectId]->m_requestedTime <=0) {
EWOL_ERROR("effect ID : " << effectId << " ==> request more than predicted a removed of an effects");
if (ListEffects[effectId]->m_requestedTime <= 0) {
EWOL_ERROR("effect ID : " << effectId << " == > request more than predicted a removed of an effects");
return;
}
ListEffects[effectId]->m_requestedTime--;
@ -344,21 +344,21 @@ void ewol::audio::effects::Rm(int32_t effectId)
}
void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
void ewol::audio::effects::play(int32_t effectId, float xxx, float yyy)
{
if (effectId <0 || effectId >= ListEffects.Size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not play it ...");
if (effectId <0 || effectId >= ListEffects.size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.size()-1 << "] == > can not play it ...");
return;
}
if (ListEffects[effectId] == NULL) {
EWOL_ERROR("effect ID : " << effectId << " ==> has been removed");
EWOL_ERROR("effect ID : " << effectId << " == > has been removed");
return;
}
EWOL_VERBOSE("effect play : " << effectId );
// try to find an empty slot :
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) {
if (ListEffectsPlaying[iii]->IsFree()) {
ListEffectsPlaying[iii]->Reset(ListEffects[effectId]);
for (int32_t iii=0; iii<ListEffectsPlaying.size(); iii++) {
if (ListEffectsPlaying[iii]->isFree()) {
ListEffectsPlaying[iii]->reset(ListEffects[effectId]);
return;
}
}
@ -367,11 +367,11 @@ void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
EWOL_CRITICAL("Allocation error of a playing element : " << effectId);
return;
}
ListEffectsPlaying.PushBack(newPlay);
ListEffectsPlaying.pushBack(newPlay);
}
float ewol::audio::effects::VolumeGet(void)
float ewol::audio::effects::volumeGet(void)
{
return effectsVolume;
}
@ -379,32 +379,32 @@ float ewol::audio::effects::VolumeGet(void)
static void uptateEffectVolume(void)
{
if (effectsMute==true) {
if (effectsMute == true) {
effectsVolumeApply = 0;
} else {
// Convert in an fixpoint value
// convert in an fixpoint value
// V2 = V1*10^(db/20)
double coef = pow(10, (effectsVolume/20) );
effectsVolumeApply = (int32_t)(coef * (double)(1<<16));
}
}
void ewol::audio::effects::VolumeSet(float newVolume)
void ewol::audio::effects::volumeSet(float newVolume)
{
effectsVolume = newVolume;
effectsVolume = etk_avg(-100, effectsVolume, 20);
EWOL_INFO("Set music Volume at " << newVolume << "dB ==> " << effectsVolume << "dB");
EWOL_INFO("Set music Volume at " << newVolume << "dB == > " << effectsVolume << "dB");
uptateEffectVolume();
}
bool ewol::audio::effects::MuteGet(void)
bool ewol::audio::effects::muteGet(void)
{
return effectsMute;
}
void ewol::audio::effects::MuteSet(bool newMute)
void ewol::audio::effects::muteSet(bool newMute)
{
effectsMute = newMute;
EWOL_INFO("Set effects Mute at " << newMute);
@ -412,11 +412,11 @@ void ewol::audio::effects::MuteSet(bool newMute)
void ewol::audio::effects::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
void ewol::audio::effects::getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) {
for (int32_t iii=0; iii<ListEffectsPlaying.size(); iii++) {
if (ListEffectsPlaying[iii]!= NULL) {
ListEffectsPlaying[iii]->Play(bufferInterlace, nbSample, nbChannels);
ListEffectsPlaying[iii]->play(bufferInterlace, nbSample, nbChannels);
}
}
}

View File

@ -15,51 +15,51 @@
namespace ewol {
namespace audio {
void Init(void);
void UnInit(void);
void init(void);
void unInit(void);
typedef void (*AudioCallback)(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
void AddCallbackOutput(AudioCallback userCallback);
void addCallbackOutput(AudioCallback userCallback);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
void getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
namespace music {
void Fading(int32_t timeMs);
void fading(int32_t timeMs);
// list playing system : is cyclic ...
bool ListAdd(etk::UString file);
bool ListRm(etk::UString file);
bool ListClean(void);
bool ListPrevious(void);
bool ListNext(void);
bool ListFirst(void);
bool ListLast(void);
bool ListPlay(void); // List playing
bool ListStop(void); // List stopping
bool listAdd(etk::UString file);
bool listRm(etk::UString file);
bool listClean(void);
bool listPrevious(void);
bool listNext(void);
bool listFirst(void);
bool listLast(void);
bool listPlay(void); // List playing
bool listStop(void); // List stopping
bool Play(etk::UString file); // play specific file ... pause the list element;
bool Stop(void);
bool play(etk::UString file); // play specific file ... pause the list element;
bool stop(void);
// in db
float VolumeGet(void);
void VolumeSet(float newVolume);
bool MuteGet(void);
void MuteSet(bool newMute);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
float volumeGet(void);
void volumeSet(float newVolume);
bool muteGet(void);
void muteSet(bool newMute);
void getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
};
// note effect is loaded in memory (then don't create long effect) and unload only when requested
namespace effects {
// note : support file (Mono, 16bit, 48kHz) : .raw or .wav (no encodage) or .ogg (decoded with tremor lib)
int32_t Add(etk::UString file);
void Rm(int32_t effectId);
void Play(int32_t effectId, float xxx, float yyy);
int32_t add(etk::UString file);
void rm(int32_t effectId);
void play(int32_t effectId, float xxx, float yyy);
// in db
float VolumeGet(void);
void VolumeSet(float newVolume);
bool MuteGet(void);
void MuteSet(bool newMute);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
float volumeGet(void);
void volumeSet(float newVolume);
bool muteGet(void);
void muteSet(bool newMute);
void getData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
};
};

View File

@ -60,7 +60,7 @@ typedef struct {
#define COMPR_G721 (64)
#define COMPR_MPEG (80)
int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut)
int16_t * ewol::audio::wav::loadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut)
{
nbSampleOut = 0;
waveHeader myHeader;
@ -69,28 +69,28 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
// Start loading the XML :
EWOL_DEBUG("open file (WAV) \"" << fileAccess << "\"");
if (false == fileAccess.Exist()) {
if (false == fileAccess.exist()) {
EWOL_ERROR("File Does not exist : \"" << fileAccess << "\"");
return NULL;
}
int32_t fileSize = fileAccess.FileSize();
if (0==fileSize) {
int32_t fileSize = fileAccess.fileSize();
if (0 == fileSize) {
EWOL_ERROR("This file is empty : \"" << fileAccess << "\"");
return NULL;
}
if (false == fileAccess.FileOpenRead()) {
if (false == fileAccess.fileOpenRead()) {
EWOL_ERROR("Can not open the file : \"" << fileAccess << "\"");
return NULL;
}
// try to find endienness :
if (fileSize < sizeof(waveHeader)) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> has not enouth data inside might be minumum of " << (int32_t)(sizeof(waveHeader)));
EWOL_ERROR("File : \"" << fileAccess << "\" == > has not enouth data inside might be minumum of " << (int32_t)(sizeof(waveHeader)));
return NULL;
}
// ----------------------------------------------
// read the header :
// ----------------------------------------------
if (fileAccess.FileRead(&myHeader.riffTag, 1, 4)!=4) {
if (fileAccess.fileRead(&myHeader.riffTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
@ -108,14 +108,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
}
// get the data size :
unsigned char tmpData[32];
if (fileAccess.FileRead(tmpData, 1, 4)!=4) {
if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
myHeader.size = CONVERT_UINT32(littleEndien, tmpData);
// get the data size :
if (fileAccess.FileRead(&myHeader.waveTag, 1, 4)!=4) {
if (fileAccess.fileRead(&myHeader.waveTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
@ -128,7 +128,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
}
// get the data size :
if (fileAccess.FileRead(&myHeader.fmtTag, 1, 4)!=4) {
if (fileAccess.fileRead(&myHeader.fmtTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
@ -140,17 +140,17 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
return NULL;
}
// get the data size :
if (fileAccess.FileRead(tmpData, 1, 4)!=4) {
if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
myHeader.waveFormatSize = CONVERT_UINT32(littleEndien, tmpData);
if (myHeader.waveFormatSize != 16) {
EWOL_ERROR("file : \"" << fileAccess << "\" ==> header error ...");
EWOL_ERROR("file : \"" << fileAccess << "\" == > header error ...");
return NULL;
}
if (fileAccess.FileRead(tmpData, 1, 16)!=16) {
if (fileAccess.fileRead(tmpData, 1, 16)!=16) {
EWOL_ERROR("Can not 16 element in the file : \"" << fileAccess << "\"");
return NULL;
}
@ -174,7 +174,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
EWOL_DEBUG(" bytesPerFrame : " << myHeader.waveFormat.bytesPerFrame);
EWOL_DEBUG(" bitsPerSample : " << myHeader.waveFormat.bitsPerSample);
// get the data size :
if (fileAccess.FileRead(&myHeader.dataTag, 1, 4)!=4) {
if (fileAccess.fileRead(&myHeader.dataTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
@ -186,7 +186,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
return NULL;
}
// get the data size :
if (fileAccess.FileRead(tmpData, 1, 4)!=4) {
if (fileAccess.fileRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
@ -198,22 +198,22 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
//Parse the data and transform it if needed ...
if (COMPR_PCM != myHeader.waveFormat.type) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> support only PCM compression ...");
EWOL_ERROR("File : \"" << fileAccess << "\" == > support only PCM compression ...");
return NULL;
}
if (myHeader.waveFormat.channelCount==0 || myHeader.waveFormat.channelCount>2) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> support only mono or stereo ..." << myHeader.waveFormat.channelCount);
if (myHeader.waveFormat.channelCount == 0 || myHeader.waveFormat.channelCount>2) {
EWOL_ERROR("File : \"" << fileAccess << "\" == > support only mono or stereo ..." << myHeader.waveFormat.channelCount);
return NULL;
}
if ( ! ( myHeader.waveFormat.bitsPerSample==16
|| myHeader.waveFormat.bitsPerSample==24
|| myHeader.waveFormat.bitsPerSample==32 ) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> not supported bit/sample ..." << myHeader.waveFormat.bitsPerSample);
if ( ! ( myHeader.waveFormat.bitsPerSample == 16
|| myHeader.waveFormat.bitsPerSample == 24
|| myHeader.waveFormat.bitsPerSample == 32 ) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" == > not supported bit/sample ..." << myHeader.waveFormat.bitsPerSample);
return NULL;
}
if( ! ( 44100 == myHeader.waveFormat.samplesPerSec
|| 48000 == myHeader.waveFormat.samplesPerSec) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> not supported frequency " << myHeader.waveFormat.samplesPerSec << " != 48000");
EWOL_ERROR("File : \"" << fileAccess << "\" == > not supported frequency " << myHeader.waveFormat.samplesPerSec << " != 48000");
return NULL;
}
EWOL_DEBUG(" dataSize : " << myHeader.dataSize);
@ -232,14 +232,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
char audioSample[8];
if (myHeader.waveFormat.bitsPerSample == 16) {
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.FileRead(audioSample, 1, 2)!=2) {
if (fileAccess.fileRead(audioSample, 1, 2)!=2) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = ((int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample))) << 16;
right = left;
} else {
if (fileAccess.FileRead(audioSample, 1, 4)!=4) {
if (fileAccess.fileRead(audioSample, 1, 4)!=4) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
@ -248,14 +248,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
}
} else if (myHeader.waveFormat.bitsPerSample == 24) {
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.FileRead(audioSample, 1, 3)!=3) {
if (fileAccess.fileRead(audioSample, 1, 3)!=3) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = CONVERT_INT24(littleEndien, audioSample);
right = left;
} else {
if (fileAccess.FileRead(audioSample, 1, 6)!=6) {
if (fileAccess.fileRead(audioSample, 1, 6)!=6) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
@ -264,14 +264,14 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
}
} else if (myHeader.waveFormat.bitsPerSample == 32) {
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.FileRead(audioSample, 1, 4)!=4) {
if (fileAccess.fileRead(audioSample, 1, 4)!=4) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = CONVERT_INT32(littleEndien, audioSample);
right = left;
} else {
if (fileAccess.FileRead(audioSample, 1, 8)!=8) {
if (fileAccess.fileRead(audioSample, 1, 8)!=8) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
@ -287,7 +287,7 @@ int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32
}
}
// close the file:
fileAccess.FileClose();
fileAccess.fileClose();
nbSampleOut = nbSample;
return outputData;
}

View File

@ -15,7 +15,7 @@
namespace ewol {
namespace audio {
namespace wav {
int16_t * LoadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut);
int16_t * loadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut);
};
};
};

View File

@ -45,13 +45,13 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
userOutputData *data = (userOutputData*)userData;
// no use of the input buffer ... (mightt be NULL)
(void) inputBuffer;
ewol::audio::GetData((int16_t*)outputBuffer, framesPerBuffer, data->nbChanelsOutput);
ewol::audio::getData((int16_t*)outputBuffer, framesPerBuffer, data->nbChanelsOutput);
return 0;
}
#define SAMPLE_RATE (44100)
void ewol::portAudio::Init(void)
void ewol::portAudio::init(void)
{
PaError err;
EWOL_DEBUG("Create Audio Thread...");
@ -65,7 +65,7 @@ void ewol::portAudio::Init(void)
data.nbChanelsInput = 0;
data.nbChanelsOutput = 2;
data.frameSize = 256;
/* Open an audio I/O stream. */
/* open an audio I/O stream. */
err = Pa_OpenDefaultStream( &stream, data.nbChanelsInput, data.nbChanelsOutput,
paInt16, data.sampleRate, data.frameSize,
patestCallback, &data );
@ -81,7 +81,7 @@ void ewol::portAudio::Init(void)
EWOL_DEBUG("Create Audio Thread ... might have start");
}
void ewol::portAudio::UnInit(void)
void ewol::portAudio::unInit(void)
{
PaError err;
// destroy the thread ...

View File

@ -13,8 +13,8 @@
namespace ewol {
namespace portAudio {
void Init(void);
void UnInit(void);
void init(void);
void unInit(void);
};
};

View File

@ -9,7 +9,7 @@
/*
notes :
sudo edn /etc/udev/rules.d/framebuffer.rules
KERNEL=="fb0", OWNER="root", MODE="0660"
KERNEL == "fb0", OWNER="root", MODE="0660"
sudo usermod -a -G video username
sudo usermod -a -G tty username
sudo fbset -i
@ -47,7 +47,7 @@
#include <directfbgl.h>
int64_t guiInterface::GetTime(void)
int64_t guiInterface::getTime(void)
{
struct timespec now;
int ret = clock_gettime(CLOCK_REALTIME, &now);
@ -88,17 +88,17 @@ static int screen_height = 600;
/**
* @brief Set the new title of the windows
* @brief set the new title of the windows
* @param title New desired title
* @return ---
*/
void guiInterface::SetTitle(etk::UString& title)
void guiInterface::setTitle(etk::UString& title)
{
// TODO : ...
}
void guiInterface::SetIcon(etk::UString inputFile)
void guiInterface::setIcon(etk::UString inputFile)
{
// TODO : ...
}
@ -106,7 +106,7 @@ void guiInterface::SetIcon(etk::UString inputFile)
void DirectFB_Init(int argc, const char *argv[])
{
EWOL_INFO("DirectFB Init (START)");
EWOL_INFO("DirectFB init (START)");
DFBResult err;
DFBSurfaceDescription dsc;
@ -127,10 +127,10 @@ void DirectFB_Init(int argc, const char *argv[])
exit(-1);
}
EWOL_INFO("call SetCooperativeLevel");
EWOL_INFO("call setCooperativeLevel");
// set our cooperative level to DFSCL_FULLSCREEN for exclusive access to the primary layer
dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
//dfb->SetCooperativeLevel(dfb, DFSCL_NORMAL);
dfb->setCooperativeLevel(dfb, DFSCL_FULLSCREEN);
//dfb->setCooperativeLevel(dfb, DFSCL_NORMAL);
// get the primary surface, i.e. the surface of the primary layer we have exclusive access to
dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS);// | DSDESC_PIXELFORMAT);
@ -151,20 +151,20 @@ void DirectFB_Init(int argc, const char *argv[])
exit(-1);
}
primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL);
primary->SetPorterDuff( primary, DSPD_ADD );
primary->SetDstBlendFunction(primary, DSBF_SRCALPHA);
primary->SetDrawingFlags(primary, DSDRAW_BLEND);
primary->setBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL);
primary->setPorterDuff( primary, DSPD_ADD );
primary->setDstBlendFunction(primary, DSBF_SRCALPHA);
primary->setDrawingFlags(primary, DSDRAW_BLEND);
primary->Blit(primary, primary, NULL, 0, 0);
EWOL_INFO("call GetSize");
EWOL_INFO("call getSize");
// get the size of the surface and fill it
err = primary->GetSize(primary, &screen_width, &screen_height);
err = primary->getSize(primary, &screen_width, &screen_height);
if (DFB_OK!=err) {
EWOL_ERROR("primary->GetSize");
DirectFBErrorFatal("primary->GetSize", err);
EWOL_ERROR("primary->getSize");
DirectFBErrorFatal("primary->getSize", err);
exit(-1);
}
@ -182,25 +182,25 @@ void DirectFB_Init(int argc, const char *argv[])
primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
// NOTE : we need to force it on X11 display ...
EWOL_INFO("call GetGL");
EWOL_INFO("call getGL");
// get the GL context
err = primary->GetGL(primary, &primary_gl);
err = primary->getGL(primary, &primary_gl);
if (DFB_OK!=err) {
EWOL_ERROR("primary->GetGL");
EWOL_ERROR("primary->getGL");
DirectFBErrorFatal("GetGL", err);
exit(-1);
}
EWOL_INFO("DirectFB Init (STOP)");
EWOL_INFO("DirectFB init (STOP)");
}
void DirectFB_UnInit(void)
{
// release our interfaces to shutdown DirectFB
primary_gl->Release(primary_gl);
primary->Release(primary);
events->Release(events);
dfb->Release(dfb);
primary_gl->release(primary_gl);
primary->release(primary);
events->release(events);
dfb->release(dfb);
}
void DirectFB_Run(void)
@ -210,13 +210,13 @@ void DirectFB_Run(void)
DFBResult err;
int32_t position = 0;
while (true==m_run) {
while (true == m_run) {
DFBInputEvent evt;
unsigned long t;
/*
primary->SetColor (primary, 0x00, 0x00, 0x00, 0xFF);
primary->setColor (primary, 0x00, 0x00, 0x00, 0xFF);
primary->FillRectangle(primary, 0, 0, screen_width, screen_height);
primary->SetColor (primary, 0xFF, (uint8_t)position, 0x00, 0xFF);
primary->setColor (primary, 0xFF, (uint8_t)position, 0x00, 0xFF);
primary->FillRectangle(primary, position, position, 300, 300);
primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
position++;
@ -230,9 +230,9 @@ void DirectFB_Run(void)
EWOL_ERROR("primary_gl->Lock");
DirectFBErrorFatal("primary_gl->Lock", err);
}
// TODO : Set at false
bool hasDisplay = eSystem::Draw(true);
if (true==hasDisplay) {
// TODO : set at false
bool hasDisplay = eSystem::draw(true);
if (true == hasDisplay) {
glFinish();
}
err = primary_gl->Unlock(primary_gl);
@ -243,7 +243,7 @@ void DirectFB_Run(void)
primary->Flip(primary, NULL, (DFBSurfaceFlipFlags)0);//DSFLIP_ONSYNC);
}
while (events->GetEvent(events, DFB_EVENT(&evt)) == DFB_OK) {
while (events->getEvent(events, DFB_EVENT(&evt)) == DFB_OK) {
switch (evt.type) {
default:
case DIET_UNKNOWN: /* unknown event */
@ -252,12 +252,12 @@ void DirectFB_Run(void)
case DIET_KEYPRESS: /* a key is been pressed */
case DIET_KEYRELEASE: /* a key is been released */
{
bool isPressed = (evt.type==DIET_KEYPRESS);
bool isPressed = (evt.type == DIET_KEYPRESS);
//EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ...");
if( 1 <= evt.key_symbol && evt.key_symbol <= 0x7F ) {
eSystem::SetKeyboard(guiKeyBoardMode, evt.key_symbol, isPressed, false);
eSystem::setKeyboard(guiKeyBoardMode, evt.key_symbol, isPressed, false);
} else {
EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " ==> not managed key");
EWOL_DEBUG("event KeyBoard isPressed : " << isPressed << " symbole=\"" << (char)evt.key_symbol << "\"=" << ((int32_t)evt.key_symbol) << " == > not managed key");
}
}
break;
@ -286,7 +286,7 @@ void DirectFB_Run(void)
case DIET_BUTTONPRESS: /* a (mouse) button is been pressed */
case DIET_BUTTONRELEASE: /* a (mouse) button is been released */
{
bool isPressed = (evt.type==DIET_KEYPRESS);
bool isPressed = (evt.type == DIET_KEYPRESS);
EWOL_DEBUG("event mouse event pressed=" << isPressed << " flag" << (char)evt.flags << " axis=" << evt.axis << " value=" << evt.axisrel);
}
break;
@ -410,25 +410,25 @@ void guiInterface::KeyboardHide(void)
}
void guiInterface::ChangeSize(ivec2 size)
void guiInterface::changeSize(ivec2 size)
{
// TODO : ...
}
void guiInterface::ChangePos(ivec2 pos)
void guiInterface::changePos(ivec2 pos)
{
// TODO : ...
}
void guiInterface::GetAbsPos(ivec2& pos)
void guiInterface::getAbsPos(ivec2& pos)
{
// TODO : ...
}
void guiInterface::SetCursor(ewol::cursorDisplay_te newCursor)
void guiInterface::setCursor(ewol::cursorDisplay_te newCursor)
{
// TODO : ...
}
@ -454,7 +454,7 @@ int guiInterface::main(int argc, const char *argv[])
// start X11 thread ...
DirectFB_Init(argc, argv);
//start the basic thread :
eSystem::Init();
eSystem::init();
// Run ...
DirectFB_Run();
// UnInit:
@ -468,7 +468,7 @@ int guiInterface::main(int argc, const char *argv[])
}
void guiInterface::ForceOrientation(ewol::orientation_te orientation)
void guiInterface::forceOrientation(ewol::orientation_te orientation)
{
// nothing to do ...
}

View File

@ -29,11 +29,11 @@
#include <date/date.h>
/**
* @brief Get the main ewol mutex (event or periodic call mutex).
* @brief get the main ewol mutex (event or periodic call mutex).
* @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& MutexInterface(void)
static etk::Mutex& mutexInterface(void)
{
static etk::Mutex s_interfaceMutex;
return s_interfaceMutex;
@ -41,7 +41,7 @@ static etk::Mutex& MutexInterface(void)
static ewol::eContext* l_curentInterface=NULL;
ewol::eContext& ewol::GetContext(void)
ewol::eContext& ewol::getContext(void)
{
#if DEBUG_LEVEL > 2
if(NULL == l_curentInterface){
@ -52,50 +52,50 @@ ewol::eContext& ewol::GetContext(void)
}
/**
* @brief Set the curent interface.
* @brief set the curent interface.
* @note this lock the main mutex
*/
void ewol::eContext::LockContext(void)
void ewol::eContext::lockContext(void)
{
MutexInterface().Lock();
mutexInterface().lock();
l_curentInterface = this;
}
/**
* @brief Set the curent interface at NULL.
* @brief set the curent interface at NULL.
* @note this un-lock the main mutex
*/
void ewol::eContext::UnLockContext(void)
void ewol::eContext::unLockContext(void)
{
l_curentInterface = NULL;
MutexInterface().UnLock();
mutexInterface().unLock();
}
void ewol::eContext::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
void ewol::eContext::inputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
{
m_input.TransfertEvent(source, destination);
m_input.transfertEvent(source, destination);
}
void ewol::eContext::InputEventGrabPointer(ewol::Widget* widget)
void ewol::eContext::inputEventGrabPointer(ewol::Widget* widget)
{
m_input.GrabPointer(widget);
m_input.grabPointer(widget);
}
void ewol::eContext::InputEventUnGrabPointer(void)
void ewol::eContext::inputEventUnGrabPointer(void)
{
m_input.UnGrabPointer();
m_input.unGrabPointer();
}
void ewol::eContext::ProcessEvents(void)
void ewol::eContext::processEvents(void)
{
int32_t nbEvent = 0;
//EWOL_DEBUG(" ******** Event");
eSystemMessage data;
while (m_msgSystem.Count()>0)
while (m_msgSystem.count()>0)
{
nbEvent++;
m_msgSystem.Wait(data);
m_msgSystem.wait(data);
//EWOL_DEBUG("EVENT");
switch (data.TypeMessage) {
case THREAD_INIT:
@ -103,40 +103,40 @@ void ewol::eContext::ProcessEvents(void)
/*bool returnVal = */APP_Init(*this);
break;
case THREAD_RECALCULATE_SIZE:
ForceRedrawAll();
forceRedrawAll();
break;
case THREAD_RESIZE:
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
m_windowsSize = data.dimention;
ewol::dimension::SetPixelWindowsSize(m_windowsSize);
ForceRedrawAll();
ewol::dimension::setPixelWindowsSize(m_windowsSize);
forceRedrawAll();
break;
case THREAD_INPUT_MOTION:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
m_input.Motion(data.inputType, data.inputId, data.dimention);
m_input.motion(data.inputType, data.inputId, data.dimention);
break;
case THREAD_INPUT_STATE:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
m_input.State(data.inputType, data.inputId, data.stateIsDown, data.dimention);
m_input.state(data.inputType, data.inputId, data.stateIsDown, data.dimention);
break;
case THREAD_KEYBORAD_KEY:
case THREAD_KEYBORAD_MOVE:
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
if (NULL != m_windowsCurrent) {
if (false==m_windowsCurrent->OnEventShortCut(data.keyboardSpecial,
if (false == m_windowsCurrent->onEventShortCut(data.keyboardSpecial,
data.keyboardChar,
data.keyboardMove,
data.stateIsDown) ) {
// Get the current Focused Widget :
ewol::Widget * tmpWidget = m_widgetManager.FocusGet();
// get the current focused Widget :
ewol::Widget * tmpWidget = m_widgetManager.focusGet();
if (NULL != tmpWidget) {
// check if the widget allow repeating key events.
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->GetKeyboardRepeate() << " state=" << data.stateIsDown);
if( false==data.repeateKey
|| ( true==data.repeateKey
&& true==tmpWidget->GetKeyboardRepeate()) ) {
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->getKeyboardRepeate() << " state=" << data.stateIsDown);
if( false == data.repeateKey
|| ( true == data.repeateKey
&& true == tmpWidget->getKeyboardRepeate()) ) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardSpecial,
if (false == tmpWidget->onEventShortCut(data.keyboardSpecial,
data.keyboardChar,
data.keyboardMove,
data.stateIsDown) ) {
@ -147,9 +147,9 @@ void ewol::eContext::ProcessEvents(void)
data.keyboardSpecial,
data.keyboardChar);
if(true == data.stateIsDown) {
tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown);
tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
}
tmpWidget->SystemEventEntry(tmpEntryEvent);
tmpWidget->systemEventEntry(tmpEntryEvent);
} else { // THREAD_KEYBORAD_MOVE
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown);
ewol::EventEntrySystem tmpEntryEvent(data.keyboardMove,
@ -157,9 +157,9 @@ void ewol::eContext::ProcessEvents(void)
data.keyboardSpecial,
0);
if(true == data.stateIsDown) {
tmpEntryEvent.m_event.SetStatus(ewol::keyEvent::statusDown);
tmpEntryEvent.m_event.setStatus(ewol::keyEvent::statusDown);
}
tmpWidget->SystemEventEntry(tmpEntryEvent);
tmpWidget->systemEventEntry(tmpEntryEvent);
}
} else {
EWOL_DEBUG("remove Repeate key ...");
@ -171,9 +171,9 @@ void ewol::eContext::ProcessEvents(void)
break;
case THREAD_CLIPBOARD_ARRIVE:
{
ewol::Widget * tmpWidget = m_widgetManager.FocusGet();
ewol::Widget * tmpWidget = m_widgetManager.focusGet();
if (tmpWidget != NULL) {
tmpWidget->OnEventClipboard(data.clipboardID);
tmpWidget->onEventClipboard(data.clipboardID);
}
}
break;
@ -194,21 +194,21 @@ void ewol::eContext::ProcessEvents(void)
}
}
void ewol::eContext::SetArchiveDir(int mode, const char* str)
void ewol::eContext::setArchiveDir(int mode, const char* str)
{
switch(mode)
{
case 0:
EWOL_DEBUG("Directory APK : path=" << str);
etk::SetBaseFolderData(str);
etk::setBaseFolderData(str);
break;
case 1:
EWOL_DEBUG("Directory mode=FILE path=" << str);
etk::SetBaseFolderDataUser(str);
etk::setBaseFolderDataUser(str);
break;
case 2:
EWOL_DEBUG("Directory mode=CACHE path=" << str);
etk::SetBaseFolderCache(str);
etk::setBaseFolderCache(str);
break;
case 3:
EWOL_DEBUG("Directory mode=EXTERNAL_CACHE path=" << str);
@ -232,98 +232,98 @@ ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
m_windowsCurrent(NULL),
m_windowsSize(320,480)
{
m_commandLine.Parse(_argc, _argv);
EWOL_INFO("==> Ewol System Init (BEGIN)");
m_commandLine.parse(_argc, _argv);
EWOL_INFO(" == > Ewol system init (BEGIN)");
// set the curent interface :
LockContext();
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 if (m_commandLine.Get(iii) == "-fps") {
for(esize_t iii=m_commandLine.size()-1 ; iii >= 0 ; --iii) {
if (m_commandLine.get(iii) == "-l0") {
debug::setGeneralLevel(etk::LOG_LEVEL_NONE);
} else if (m_commandLine.get(iii) == "-l1") {
debug::setGeneralLevel(etk::LOG_LEVEL_CRITICAL);
} else if (m_commandLine.get(iii) == "-l2") {
debug::setGeneralLevel(etk::LOG_LEVEL_ERROR);
} else if (m_commandLine.get(iii) == "-l3") {
debug::setGeneralLevel(etk::LOG_LEVEL_WARNING);
} else if (m_commandLine.get(iii) == "-l4") {
debug::setGeneralLevel(etk::LOG_LEVEL_INFO);
} else if (m_commandLine.get(iii) == "-l5") {
debug::setGeneralLevel(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") {
debug::setGeneralLevel(etk::LOG_LEVEL_VERBOSE);
} else if (m_commandLine.get(iii) == "-fps") {
m_displayFps=true;
} else {
continue;
}
m_commandLine.Remove(iii);
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 ...
etk::InitDefaultFolder("ewolApplNoName");
EWOL_INFO("v:" << ewol::getVersion());
EWOL_INFO("Build Date: " << date::getYear() << "/" << date::getMonth() << "/" << date::getDay() << " " << date::getHour() << "h" << date::getMinute());
// TODO : remove this ...
etk::initDefaultFolder("ewolApplNoName");
// request the init of the application in the main context of openGL ...
{
eSystemMessage data;
data.TypeMessage = THREAD_INIT;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
// force a recalculation
RequestUpdateSize();
requestUpdateSize();
#if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__)
ForceOrientation(ewol::SCREEN_ORIENTATION_LANDSCAPE);
forceOrientation(ewol::SCREEN_ORIENTATION_LANDSCAPE);
#elif defined(__EWOL_ANDROID_ORIENTATION_PORTRAIT__)
ForceOrientation(ewol::SCREEN_ORIENTATION_PORTRAIT);
forceOrientation(ewol::SCREEN_ORIENTATION_PORTRAIT);
#else
ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
forceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
#endif
// release the curent interface :
UnLockContext();
EWOL_INFO("==> Ewol System Init (END)");
unLockContext();
EWOL_INFO(" == > Ewol system init (END)");
}
ewol::eContext::~eContext(void)
{
EWOL_INFO("==> Ewol System Un-Init (BEGIN)");
EWOL_INFO(" == > Ewol system Un-Init (BEGIN)");
// set the curent interface :
LockContext();
lockContext();
// call application to uninit
APP_UnInit(*this);
if (NULL!=m_windowsCurrent) {
EWOL_ERROR("Main windows has not been removed... ==> memory leek");
EWOL_ERROR("Main windows has not been removed... == > memory leek");
}
// unset all windows
m_windowsCurrent = NULL;
m_msgSystem.Clean();
m_msgSystem.clean();
m_EObjectManager.UnInit();
m_resourceManager.UnInit();
m_EObjectManager.unInit();
m_resourceManager.unInit();
// release the curent interface :
UnLockContext();
EWOL_INFO("==> Ewol System Un-Init (END)");
unLockContext();
EWOL_INFO(" == > Ewol system Un-Init (END)");
}
void ewol::eContext::RequestUpdateSize(void)
void ewol::eContext::requestUpdateSize(void)
{
eSystemMessage data;
data.TypeMessage = THREAD_RECALCULATE_SIZE;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
void ewol::eContext::OS_Resize(const vec2& _size)
{
// TODO : Better in the thread ... ==> but generate some init error ...
ewol::dimension::SetPixelWindowsSize(_size);
// TODO : Better in the thread ... == > but generate some init error ...
ewol::dimension::setPixelWindowsSize(_size);
eSystemMessage data;
data.TypeMessage = THREAD_RESIZE;
data.dimention = _size;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
void ewol::eContext::OS_Move(const vec2& _pos)
{
@ -343,7 +343,7 @@ void ewol::eContext::OS_SetInputMotion(int _pointerID, const vec2& _pos )
data.inputType = ewol::keyEvent::typeFinger;
data.inputId = _pointerID;
data.dimention = _pos;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
@ -355,7 +355,7 @@ void ewol::eContext::OS_SetInputState(int _pointerID, bool _isDown, const vec2&
data.inputId = _pointerID;
data.stateIsDown = _isDown;
data.dimention = _pos;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
@ -366,7 +366,7 @@ void ewol::eContext::OS_SetMouseMotion(int _pointerID, const vec2& _pos )
data.inputType = ewol::keyEvent::typeMouse;
data.inputId = _pointerID;
data.dimention = _pos;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
@ -378,7 +378,7 @@ void ewol::eContext::OS_SetMouseState(int _pointerID, bool _isDown, const vec2&
data.inputId = _pointerID;
data.stateIsDown = _isDown;
data.dimention = _pos;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
@ -393,7 +393,7 @@ void ewol::eContext::OS_SetKeyboard(ewol::SpecialKey& _special,
data.keyboardChar = _myChar;
data.keyboardSpecial = _special;
data.repeateKey = _isARepeateKey;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special,
@ -407,7 +407,7 @@ void ewol::eContext::OS_SetKeyboardMove(ewol::SpecialKey& _special,
data.keyboardMove = _move;
data.keyboardSpecial = _special;
data.repeateKey = _isARepeateKey;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
@ -415,14 +415,14 @@ void ewol::eContext::OS_Hide(void)
{
eSystemMessage data;
data.TypeMessage = THREAD_HIDE;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
void ewol::eContext::OS_Show(void)
{
eSystemMessage data;
data.TypeMessage = THREAD_SHOW;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
@ -431,12 +431,12 @@ void ewol::eContext::OS_ClipBoardArrive(ewol::clipBoard::clipboardListe_te _clip
eSystemMessage data;
data.TypeMessage = THREAD_CLIPBOARD_ARRIVE;
data.clipboardID = _clipboardID;
m_msgSystem.Post(data);
m_msgSystem.post(data);
}
bool ewol::eContext::OS_Draw(bool _displayEveryTime)
{
int64_t currentTime = ewol::GetTime();
int64_t currentTime = ewol::getTime();
// this is to prevent the multiple display at the a high frequency ...
#if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__Windows))
if(currentTime - m_previousDisplayTime < 1000000/120) {
@ -448,124 +448,124 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
m_previousDisplayTime = currentTime;
// process the events
if (m_displayFps==true) {
m_FpsSystemEvent.Tic();
if (m_displayFps == true) {
m_FpsSystemEvent.tic();
}
bool needRedraw = false;
//! Event management section ...
{
// set the curent interface :
LockContext();
ProcessEvents();
lockContext();
processEvents();
// call all the widget that neded to do something periodicly
//! ewol::widgetManager::PeriodicCall(currentTime);
m_widgetManager.PeriodicCall(currentTime);
// Remove all widget that they are no more usefull (these who decided to destroy themself)
//! ewol::EObjectManager::RemoveAllAutoRemove();
m_EObjectManager.RemoveAllAutoRemove();
//! ewol::widgetManager::periodicCall(currentTime);
m_widgetManager.periodicCall(currentTime);
// remove all widget that they are no more usefull (these who decided to destroy themself)
//! ewol::EObjectManager::removeAllAutoRemove();
m_EObjectManager.removeAllAutoRemove();
// check if the user selected a windows
if (NULL != m_windowsCurrent) {
// Redraw all needed elements
m_windowsCurrent->OnRegenerateDisplay();
m_windowsCurrent->onRegenerateDisplay();
}
if (m_displayFps==true) {
m_FpsSystemEvent.IncrementCounter();
m_FpsSystemEvent.Toc();
if (m_displayFps == true) {
m_FpsSystemEvent.incrementCounter();
m_FpsSystemEvent.toc();
}
//! bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
needRedraw = m_widgetManager.IsDrawingNeeded();
//! bool needRedraw = ewol::widgetManager::isDrawingNeeded();
needRedraw = m_widgetManager.isDrawingNeeded();
// release the curent interface :
UnLockContext();
unLockContext();
}
bool hasDisplayDone = false;
//! Drawing section :
//! drawing section :
{
// Lock OpenGl context:
ewol::openGL::Lock();
if (m_displayFps==true) {
m_FpsSystemContext.Tic();
// Lock openGl context:
ewol::openGL::lock();
if (m_displayFps == true) {
m_FpsSystemContext.tic();
}
if (NULL != m_windowsCurrent) {
if( true == needRedraw
|| true == _displayEveryTime) {
m_resourceManager.UpdateContext();
if (m_displayFps==true) {
m_FpsSystemContext.IncrementCounter();
m_resourceManager.updateContext();
if (m_displayFps == true) {
m_FpsSystemContext.incrementCounter();
}
}
}
if (m_displayFps==true) {
m_FpsSystemContext.Toc();
m_FpsSystem.Tic();
if (m_displayFps == true) {
m_FpsSystemContext.toc();
m_FpsSystem.tic();
}
if (NULL != m_windowsCurrent) {
if( true == needRedraw
|| true == _displayEveryTime) {
m_FpsSystem.IncrementCounter();
m_windowsCurrent->SysDraw();
m_FpsSystem.incrementCounter();
m_windowsCurrent->sysDraw();
hasDisplayDone = true;
}
}
if (m_displayFps==true) {
m_FpsSystem.Toc();
m_FpsFlush.Tic();
m_FpsFlush.IncrementCounter();
if (m_displayFps == true) {
m_FpsSystem.toc();
m_FpsFlush.tic();
m_FpsFlush.incrementCounter();
}
glFlush();
//glFinish();
if (m_displayFps==true) {
m_FpsFlush.Toc();
if (m_displayFps == true) {
m_FpsFlush.toc();
}
// Release Open GL Context
ewol::openGL::UnLock();
// release open GL Context
ewol::openGL::unLock();
}
if (m_displayFps==true) {
m_FpsSystemEvent.Draw();
m_FpsSystemContext.Draw();
m_FpsSystem.Draw();
m_FpsFlush.Draw();
if (m_displayFps == true) {
m_FpsSystemEvent.draw();
m_FpsSystemContext.draw();
m_FpsSystem.draw();
m_FpsFlush.draw();
}
return hasDisplayDone;
}
void ewol::eContext::OnObjectRemove(ewol::EObject * _removeObject)
void ewol::eContext::onObjectRemove(ewol::EObject * _removeObject)
{
//EWOL_CRITICAL("element removed");
m_input.OnObjectRemove(_removeObject);
m_input.onObjectRemove(_removeObject);
}
void ewol::eContext::ResetIOEvent(void)
void ewol::eContext::resetIOEvent(void)
{
m_input.NewLayerSet();
m_input.newLayerSet();
}
void ewol::eContext::OS_OpenGlContextDestroy(void)
{
m_resourceManager.ContextHasBeenDestroyed();
m_resourceManager.contextHasBeenDestroyed();
}
void ewol::eContext::SetWindows(ewol::Windows* _windows)
void ewol::eContext::setWindows(ewol::Windows* _windows)
{
// Remove current Focus :
m_widgetManager.FocusSetDefault(NULL);
m_widgetManager.FocusRelease();
// 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);
// set the new default focus :
m_widgetManager.focusSetDefault(_windows);
// request all the widget redrawing
ForceRedrawAll();
forceRedrawAll();
}
void ewol::eContext::ForceRedrawAll(void)
void ewol::eContext::forceRedrawAll(void)
{
if (NULL != m_windowsCurrent) {
m_windowsCurrent->CalculateSize(vec2(m_windowsSize.x(), m_windowsSize.y()));
m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y()));
}
}
@ -573,7 +573,7 @@ void ewol::eContext::ForceRedrawAll(void)
void ewol::eContext::OS_Stop(void)
{
if (NULL != m_windowsCurrent) {
m_windowsCurrent->SysOnKill();
m_windowsCurrent->sysOnKill();
}
}
@ -584,6 +584,6 @@ void ewol::eContext::OS_Suspend(void)
void ewol::eContext::OS_Resume(void)
{
m_previousDisplayTime = ewol::GetTime();
m_widgetManager.PeriodicCallResume(m_previousDisplayTime);
m_previousDisplayTime = ewol::getTime();
m_widgetManager.periodicCallResume(m_previousDisplayTime);
}

View File

@ -24,7 +24,7 @@
#include <ewol/commandLine.h>
// TODO : Remove this from here ...
// TODO : remove this from here ...
typedef enum {
THREAD_NONE,
THREAD_INIT,
@ -41,7 +41,7 @@ typedef enum {
THREAD_CLIPBOARD_ARRIVE,
} theadMessage_te;
// TODO : Remove this from here ...
// TODO : remove this from here ...
class eSystemMessage {
public :
// specify the message type
@ -88,37 +88,37 @@ namespace ewol
private:
ewol::CommandLine m_commandLine; //!< Start command line information
public:
ewol::CommandLine& GetCmd(void) { return m_commandLine; };
ewol::CommandLine& getCmd(void) { return m_commandLine; };
private:
ewol::ConfigFont m_configFont; //!< global font configuration
public:
ewol::ConfigFont& GetFontDefault(void) { return m_configFont; };
ewol::ConfigFont& getFontDefault(void) { return m_configFont; };
private:
ewol::WidgetManager m_widgetManager; //!< global widget manager
public:
ewol::WidgetManager& GetWidgetManager(void) { return m_widgetManager; };
ewol::WidgetManager& getWidgetManager(void) { return m_widgetManager; };
private:
ewol::EObjectManager m_EObjectManager; //!< eObject Manager main instance
public:
ewol::EObjectManager& GetEObjectManager(void) { return m_EObjectManager; };
ewol::EObjectManager& getEObjectManager(void) { return m_EObjectManager; };
private:
ewol::ResourceManager m_resourceManager; //!< global resources Manager
public:
ewol::ResourceManager& GetResourcesManager(void) { return m_resourceManager; };
ewol::ResourceManager& getResourcesManager(void) { return m_resourceManager; };
public:
eContext(int32_t _argc=0, const char* _argv[]=NULL);
virtual ~eContext(void);
protected:
/**
* @brief Set the curent interface.
* @brief set the curent interface.
* @note this lock the main mutex
*/
void LockContext(void);
void lockContext(void);
/**
* @brief Set the curent interface at NULL.
* @brief set the curent interface at NULL.
* @note this un-lock the main mutex
*/
void UnLockContext(void);
void unLockContext(void);
private:
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
ewol::eInput m_input;
@ -131,10 +131,10 @@ namespace ewol
/**
* @brief Processing all the event arrived ... (commoly called in draw function)
*/
void ProcessEvents(void);
void processEvents(void);
public:
virtual void SetArchiveDir(int _mode, const char* _str);
virtual void setArchiveDir(int _mode, const char* _str);
virtual void OS_SetInputMotion(int _pointerID, const vec2& _pos);
@ -156,28 +156,28 @@ namespace ewol
*/
virtual void OS_Suspend(void);
/**
* @brief The current context is Resumed
* @brief The current context is resumed
*/
virtual void OS_Resume(void);
//virtual void OS_SetClipBoard(ewol::clipBoard::clipboardListe_te _clipboardID);
void RequestUpdateSize(void);
void requestUpdateSize(void);
// return true if a flush is needed
bool OS_Draw(bool _displayEveryTime);
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject
* @param[in] removeObject Pointer on the EObject removed == > the user must remove all reference on this EObject
* @note : Sub classes must call this class
*/
void OnObjectRemove(ewol::EObject * removeObject);
void onObjectRemove(ewol::EObject * removeObject);
/**
* @brief reset event management for the IO like Input ou Mouse or keyborad
*/
void ResetIOEvent(void);
void resetIOEvent(void);
/**
* @brief The OS inform that the OpenGL constext has been destroy ==> use to automaticly reload the texture and other thinks ...
* @brief The OS inform that the openGL constext has been destroy == > use to automaticly reload the texture and other thinks ...
*/
void OS_OpenGlContextDestroy(void);
/**
@ -187,7 +187,7 @@ namespace ewol
/**
* @brief The application request that the Window will be killed
*/
virtual void Stop(void) { };
virtual void stop(void) { };
private:
ewol::Windows* m_windowsCurrent; //!< curent displayed windows
public:
@ -195,20 +195,20 @@ namespace ewol
* @brief set the current windows to display :
* @param _windows Windows that might be displayed
*/
void SetWindows(ewol::Windows* _windows);
void setWindows(ewol::Windows* _windows);
/**
* @brief Get the current windows that is displayed
* @brief get the current windows that is displayed
* @return the current handle on the windows (can be null)
*/
ewol::Windows* GetWindows(void) { return m_windowsCurrent; };
ewol::Windows* getWindows(void) { return m_windowsCurrent; };
private:
vec2 m_windowsSize; //!< current size of the system
public:
/**
* @brief Get the current windows size
* @brief get the current windows size
* @return the current size ...
*/
const vec2& GetSize(void) { return m_windowsSize; };
const vec2& getSize(void) { return m_windowsSize; };
/**
* @brief The OS inform that the current windows has change his size.
* @param[in] _size new size of the windows.
@ -218,7 +218,7 @@ namespace ewol
* @brief The application request a change of his curent size.
* @param[in] _size new Requested size of the windows.
*/
virtual void SetSize(const vec2& _size) { };
virtual void setSize(const vec2& _size) { };
/**
* @brief The OS inform that the current windows has change his position.
* @param[in] _pos New position of the Windows.
@ -228,7 +228,7 @@ namespace ewol
* @brief The Application request that the current windows will change his position.
* @param[in] _pos New position of the Windows requested.
*/
virtual void SetPos(const vec2& _pos) { };
virtual void setPos(const vec2& _pos) { };
/**
* @brief The OS inform that the Windows is now Hidden.
*/
@ -236,7 +236,7 @@ namespace ewol
/**
* @brief The Application request that the Windows will be Hidden.
*/
virtual void Hide(void) { };
virtual void hide(void) { };
/**
* @brief The OS inform that the Windows is now visible.
*/
@ -244,11 +244,11 @@ namespace ewol
/**
* @brief The Application request that the Windows will be visible.
*/
virtual void Show(void) { };
virtual void show(void) { };
/**
* @brief Redraw all the windows
*/
void ForceRedrawAll(void);
void forceRedrawAll(void);
// TODO : Later ...
/**
@ -256,75 +256,75 @@ namespace ewol
* @param source the widget where the event came from
* @param destination the widget where the event mitgh be generated now
*/
void InputEventTransfertWidget(ewol::Widget* _source, ewol::Widget* _destination);
void inputEventTransfertWidget(ewol::Widget* _source, ewol::Widget* _destination);
/**
* @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] widget The widget that lock the pointer events
*/
void InputEventGrabPointer(ewol::Widget* _widget);
void inputEventGrabPointer(ewol::Widget* _widget);
/**
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/
void InputEventUnGrabPointer(void);
void inputEventUnGrabPointer(void);
/**
* @brief Display the virtal keyboard (for touch system only)
* @brief display the virtal keyboard (for touch system only)
*/
void KeyboardShow(void) {};
void keyboardShow(void) {};
/**
* @brief Hide the virtal keyboard (for touch system only)
*/
void KeyboardHide(void) {};
void keyboardHide(void) {};
/**
* @brief Inform the Gui that we want to have a copy of the clipboard
* @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here
*/
virtual void ClipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) { };
virtual void clipBoardGet(ewol::clipBoard::clipboardListe_te _clipboardID) { };
/**
* @brief Inform the Gui that we are the new owner of the clipboard
* @param[in] _clipboardID ID of the clipboard (STD/SELECTION) only apear here
*/
virtual void ClipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID) { };
virtual void clipBoardSet(ewol::clipBoard::clipboardListe_te _clipboardID) { };
/**
* @brief Call by the OS when a clipboard arrive to US (previously requested by a widget)
* @param[in] Id of the clipboard
*/
void OS_ClipBoardArrive(ewol::clipBoard::clipboardListe_te _clipboardID);
/**
* @brief Set the new title of the windows
* @brief set the new title of the windows
* @param[in] title New desired title
*/
virtual void SetTitle(const etk::UString& _title) { };
virtual void setTitle(const etk::UString& _title) { };
/**
* @brief Force the screen orientation (availlable on portable elements ...
* @brief force the screen orientation (availlable on portable elements ...
* @param[in] _orientation Selected orientation.
*/
virtual void ForceOrientation(ewol::orientation_te _orientation) { };
virtual void forceOrientation(ewol::orientation_te _orientation) { };
/**
* @brief Get all the event from the X system
* @brief get all the event from the X system
* @param[in] _isGrabbed "true" if all the event will be get, false if we want only ours.
* @param[in] _forcedPosition the position where the mouse might be reset at every events ...
*/
virtual void GrabPointerEvents(bool _isGrabbed, const vec2& _forcedPosition) { };
virtual void grabPointerEvents(bool _isGrabbed, const vec2& _forcedPosition) { };
/**
* @brief Set the cursor display type.
* @brief set the cursor display type.
* @param[in] _newCursor selected new cursor.
*/
virtual void SetCursor(ewol::cursorDisplay_te _newCursor) { };
virtual void setCursor(ewol::cursorDisplay_te _newCursor) { };
/**
* @brief Set the Icon of the program
* @brief set the Icon of the program
* @param[in] _inputFile new filename icon of the curent program.
*/
virtual void SetIcon(const etk::UString& _inputFile) { };
virtual void setIcon(const etk::UString& _inputFile) { };
/**
* @brief Get the curent time in micro-second
* @brief get the curent time in micro-second
* @note : must be implemented in all system OS implementation
* @return The curent time of the process
*/
static int64_t GetTime(void);
static int64_t getTime(void);
private:
// TODO : Set user argument here ....
// TODO : set user argument here ....
public:
/**
@ -345,7 +345,7 @@ namespace ewol
* @brief From everyware in the program, we can get the context inteface.
* @return current reference on the instance.
*/
eContext& GetContext(void);
eContext& getContext(void);
};
//!< must be define in CPP by the application ... this are the main init and unInit of the Application

View File

@ -28,7 +28,7 @@
#define EVENT_DEBUG EWOL_VERBOSE
//#define EVENT_DEBUG EWOL_DEBUG
void ewol::eInput::CalculateLimit(void)
void ewol::eInput::calculateLimit(void)
{
m_eventInputLimit.sepatateTime = 300000; // µs
m_eventInputLimit.DpiOffset = m_dpi*100;
@ -36,11 +36,11 @@ void ewol::eInput::CalculateLimit(void)
m_eventMouseLimit.DpiOffset = (float)m_dpi*(float)0.1;
}
void ewol::eInput::SetDpi(int32_t newDPI)
void ewol::eInput::setDpi(int32_t newDPI)
{
m_dpi = newDPI;
// recalculate the DPI system ...
CalculateLimit();
calculateLimit();
}
bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type,
@ -54,7 +54,7 @@ bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type,
// create the system Event :
ewol::EventInputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0); // TODO : set the real ID ...
// generate the event :
return _destWidget->SystemEventInput(tmpEventSystem);
return _destWidget->systemEventInput(tmpEventSystem);
} else {
return false;
}
@ -62,12 +62,12 @@ bool ewol::eInput::localEventInput(ewol::keyEvent::type_te _type,
return false;
}
void ewol::eInput::AbortElement(InputPoperty_ts *_eventTable, int32_t _idInput, ewol::keyEvent::type_te _type)
void ewol::eInput::abortElement(InputPoperty_ts *_eventTable, int32_t _idInput, ewol::keyEvent::type_te _type)
{
if (NULL==_eventTable) {
if (NULL == _eventTable) {
return;
}
if (_eventTable[_idInput].isUsed==true) {
if (_eventTable[_idInput].isUsed == true) {
localEventInput(_type,
_eventTable[_idInput].curentWidgetEvent,
_eventTable[_idInput].destinationInputId,
@ -76,9 +76,9 @@ void ewol::eInput::AbortElement(InputPoperty_ts *_eventTable, int32_t _idInput,
}
}
void ewol::eInput::CleanElement(InputPoperty_ts *_eventTable, int32_t _idInput)
void ewol::eInput::cleanElement(InputPoperty_ts *_eventTable, int32_t _idInput)
{
if (NULL==_eventTable) {
if (NULL == _eventTable) {
return;
}
//EWOL_INFO("CleanElement[" << idInput << "] = @" << (int64_t)eventTable);
@ -97,7 +97,7 @@ void ewol::eInput::CleanElement(InputPoperty_ts *_eventTable, int32_t _idInput)
void ewol::eInput::TransfertEvent(ewol::Widget* source, ewol::Widget* destination)
void ewol::eInput::transfertEvent(ewol::Widget* source, ewol::Widget* destination)
{
if( NULL == source
|| NULL == destination) {
@ -107,64 +107,64 @@ void ewol::eInput::TransfertEvent(ewol::Widget* source, ewol::Widget* destinatio
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (m_eventInputSaved[iii].curentWidgetEvent == source) {
// inform the widget that it does not receive the event now
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent);
EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventInputSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventInputSaved[iii].posEvent);
// set the new widget ...
m_eventInputSaved[iii].curentWidgetEvent = destination;
// inform the widget that he receive the event property now...
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent);
EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventInputSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventInputSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeFinger, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventInputSaved[iii].posEvent);
}
if (m_eventMouseSaved[iii].curentWidgetEvent == source) {
// inform the widget that it does not receive the event now
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent);
EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_ABORT] " << m_eventMouseSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusAbort, m_eventMouseSaved[iii].posEvent);
// set the new widget ...
m_eventMouseSaved[iii].curentWidgetEvent = destination;
// inform the widget that he receive the event property now...
EVENT_DEBUG("GUI : Input ID=" << iii << "==>" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent);
EVENT_DEBUG("GUI : Input ID=" << iii << " == >" << m_eventMouseSaved[iii].destinationInputId << " [EVENT_INPUT_TYPE_TRANSFERT] " << m_eventMouseSaved[iii].posEvent);
localEventInput(ewol::keyEvent::typeMouse, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::keyEvent::statusTransfert, m_eventMouseSaved[iii].posEvent);
}
}
}
void ewol::eInput::GrabPointer(ewol::Widget* widget)
void ewol::eInput::grabPointer(ewol::Widget* widget)
{
if(NULL==widget) {
if(NULL == widget) {
return;
}
m_grabWidget = widget;
m_context.GrabPointerEvents(true, widget->GetOrigin() + ivec2(widget->GetSize().x()/2.0f, widget->GetSize().y()/2.0f) );
m_context.grabPointerEvents(true, widget->getOrigin() + ivec2(widget->getSize().x()/2.0f, widget->getSize().y()/2.0f) );
}
void ewol::eInput::UnGrabPointer(void)
void ewol::eInput::unGrabPointer(void)
{
m_grabWidget = NULL;
m_context.GrabPointerEvents(false, vec2(0,0));
m_context.grabPointerEvents(false, vec2(0,0));
}
void ewol::eInput::OnObjectRemove(ewol::EObject * removeObject)
void ewol::eInput::onObjectRemove(ewol::EObject * removeObject)
{
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (m_eventInputSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ...
CleanElement(m_eventInputSaved, iii);
cleanElement(m_eventInputSaved, iii);
}
if (m_eventMouseSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ...
CleanElement(m_eventMouseSaved, iii);
cleanElement(m_eventMouseSaved, iii);
}
}
}
void ewol::eInput::NewLayerSet(void)
void ewol::eInput::newLayerSet(void)
{
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
AbortElement(m_eventInputSaved, iii, ewol::keyEvent::typeFinger);
CleanElement(m_eventInputSaved, iii);
AbortElement(m_eventMouseSaved, iii, ewol::keyEvent::typeMouse);
CleanElement(m_eventMouseSaved, iii);
abortElement(m_eventInputSaved, iii, ewol::keyEvent::typeFinger);
cleanElement(m_eventInputSaved, iii);
abortElement(m_eventMouseSaved, iii, ewol::keyEvent::typeMouse);
cleanElement(m_eventMouseSaved, iii);
}
}
@ -172,12 +172,12 @@ ewol::eInput::eInput(ewol::eContext& _context) :
m_grabWidget(NULL),
m_context(_context)
{
SetDpi(200);
setDpi(200);
EWOL_INFO("Init (start)");
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
CleanElement(m_eventInputSaved, iii);
CleanElement(m_eventMouseSaved, iii);
cleanElement(m_eventInputSaved, iii);
cleanElement(m_eventMouseSaved, iii);
}
EWOL_INFO("Init (end)");
}
@ -194,7 +194,7 @@ int32_t ewol::eInput::localGetDestinationId(ewol::keyEvent::type_te _type, ewol:
if (_type == ewol::keyEvent::typeFinger) {
int32_t lastMinimum = 0;
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (true==m_eventInputSaved[iii].isUsed) {
if (true == m_eventInputSaved[iii].isUsed) {
if (m_eventInputSaved[iii].curentWidgetEvent == _destWidget) {
if (iii != _realInputId) {
lastMinimum = etk_max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
@ -207,12 +207,12 @@ int32_t ewol::eInput::localGetDestinationId(ewol::keyEvent::type_te _type, ewol:
return _realInputId;
}
// note if id<0 ==> the it was finger event ...
void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
// note if id<0 == > the it was finger event ...
void ewol::eInput::motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
{
EVENT_DEBUG("motion event : " << type << " " << pointerID << " " << pos);
if (MAX_MANAGE_INPUT<=pointerID) {
// reject pointer ==> out of IDs...
if (MAX_MANAGE_INPUT <= pointerID) {
// reject pointer == > out of IDs...
return;
}
InputPoperty_ts *eventTable = NULL;
@ -229,7 +229,7 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
// not manage input
return;
}
ewol::Windows* tmpWindows = m_context.GetWindows();
ewol::Windows* tmpWindows = m_context.getWindows();
// special case for the mouse event 0 that represent the hover event of the system :
if (type == ewol::keyEvent::typeMouse && pointerID == 0) {
// this event is all time on the good widget ... and manage the enter and leave ...
@ -240,7 +240,7 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
tmpWidget = m_grabWidget;
} else {
if (NULL != tmpWindows) {
tmpWidget = tmpWindows->GetWidgetAtPos(pos);
tmpWidget = tmpWindows->getWidgetAtPos(pos);
}
}
if( tmpWidget != eventTable[pointerID].curentWidgetEvent
@ -250,12 +250,12 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) ) ) {
eventTable[pointerID].isInside = false;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
}
if (false == eventTable[pointerID].isInside) {
// Set the element inside ...
// set the element inside ...
eventTable[pointerID].isInside = true;
// get destination widget :
eventTable[pointerID].curentWidgetEvent = tmpWidget;
@ -263,15 +263,15 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
eventTable[pointerID].isInside = false;
}
if (NULL != eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->GetOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize();
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->getOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->getSize();
}
eventTable[pointerID].destinationInputId = 0;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos);
}
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
} else if (true == eventTable[pointerID].isUsed) {
@ -281,7 +281,7 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
|| (eventTable[pointerID].origin.x() + eventTable[pointerID].size.x()) < pos.x()
|| (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) < pos.y()) {
eventTable[pointerID].isInside = false;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
}
@ -291,25 +291,25 @@ void ewol::eInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos)
&& ( eventTable[pointerID].origin.y() <= pos.y()
&& (eventTable[pointerID].origin.y() + eventTable[pointerID].size.y()) >= pos.y() ) ) {
eventTable[pointerID].isInside = true;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, pos);
}
}
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
}
}
void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos)
void ewol::eInput::state(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos)
{
if (MAX_MANAGE_INPUT<=pointerID) {
// reject pointer ==> out of IDs...
if (MAX_MANAGE_INPUT <= pointerID) {
// reject pointer == > out of IDs...
return;
}
EWOL_DEBUG("event pointerId=" << pointerID);
// convert position in Open-GL coordonates ...
// convert position in open-GL coordonates ...
InputPoperty_ts *eventTable = NULL;
inputLimit_ts localLimit;
if (type == ewol::keyEvent::typeMouse) {
@ -328,25 +328,25 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
return;
}
// get the curent time ...
int64_t currentTime = ewol::GetTime();
ewol::Windows* tmpWindows = m_context.GetWindows();
int64_t currentTime = ewol::getTime();
ewol::Windows* tmpWindows = m_context.getWindows();
if (true == isDown) {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
EWOL_VERBOSE("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
if(true == eventTable[pointerID].isUsed) {
// we have an event previously ... check delay between click and offset position
if (currentTime - eventTable[pointerID].lastTimeEvent > localLimit.sepatateTime) {
CleanElement(eventTable, pointerID);
cleanElement(eventTable, pointerID);
} else if( abs(eventTable[pointerID].downStart.x() - pos.x()) >= localLimit.DpiOffset
|| abs(eventTable[pointerID].downStart.y() - pos.y()) >= localLimit.DpiOffset ){
CleanElement(eventTable, pointerID);
cleanElement(eventTable, pointerID);
}
}
if(true == eventTable[pointerID].isUsed) {
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
// generate DOWN Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos);
} else {
@ -356,32 +356,32 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
eventTable[pointerID].downStart = pos;
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
// Set the element inside ...
// set the element inside ...
eventTable[pointerID].isInside = true;
// get destination widget :
if(NULL != tmpWindows) {
if (m_grabWidget != NULL && type == ewol::keyEvent::typeMouse) {
eventTable[pointerID].curentWidgetEvent = m_grabWidget;
} else {
eventTable[pointerID].curentWidgetEvent = tmpWindows->GetWidgetAtPos(pos);
eventTable[pointerID].curentWidgetEvent = tmpWindows->getWidgetAtPos(pos);
}
} else {
eventTable[pointerID].curentWidgetEvent = NULL;
}
if (NULL != eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->GetOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize();
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->getOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->getSize();
eventTable[pointerID].destinationInputId = localGetDestinationId(type, eventTable[pointerID].curentWidgetEvent, pointerID);
} else {
eventTable[pointerID].destinationInputId = -1;
}
// generate DOWN Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos);
}
} else {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
EWOL_VERBOSE("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
if(false == eventTable[pointerID].isUsed) {
// bad case ... ???
EWOL_DEBUG("Up event without previous down ... ");
@ -391,7 +391,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
eventTable[pointerID].curentWidgetEvent = NULL;
} else {
// generate UP Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::keyEvent::statusUp, pos);
// generate event (single)
@ -403,7 +403,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
eventTable[pointerID].lastTimeEvent = currentTime;
int32_t nbClickMax = 0;
if(eventTable[pointerID].curentWidgetEvent != NULL) {
nbClickMax = eventTable[pointerID].curentWidgetEvent->GetMouseLimit();
nbClickMax = eventTable[pointerID].curentWidgetEvent->getMouseLimit();
if (nbClickMax>5) {
nbClickMax = 5;
}
@ -414,7 +414,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
&& eventTable[pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE :
eventTable[pointerID].nbClickEvent++;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [" << eventTable[pointerID].nbClickEvent << "] " << pos);
EVENT_DEBUG("GUI : Input ID=" << pointerID << " == >" << eventTable[pointerID].destinationInputId << " [" << eventTable[pointerID].nbClickEvent << "] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type,
eventTable[pointerID].curentWidgetEvent,
@ -430,7 +430,7 @@ void ewol::eInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDow
}
// specific for tuch event
if (type == ewol::keyEvent::typeFinger) {
CleanElement(eventTable, pointerID);
cleanElement(eventTable, pointerID);
}
}
}

View File

@ -45,11 +45,11 @@ namespace ewol
int32_t m_dpi;
inputLimit_ts m_eventInputLimit;
inputLimit_ts m_eventMouseLimit;
void CalculateLimit(void);
void calculateLimit(void);
InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT];
InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT];
void AbortElement(InputPoperty_ts *eventTable, int32_t idInput, ewol::keyEvent::type_te _type);
void CleanElement(InputPoperty_ts *eventTable, int32_t idInput);
void abortElement(InputPoperty_ts *eventTable, int32_t idInput, ewol::keyEvent::type_te _type);
void cleanElement(InputPoperty_ts *eventTable, int32_t idInput);
/**
* @brief generate the event on the destinated widget.
* @param[in] type Type of the event that might be sended.
@ -65,11 +65,11 @@ namespace ewol
ewol::keyEvent::status_te typeEvent,
vec2 pos);
/**
* @brief Convert the system event id in the correct EWOL id depending of the system management mode
* @brief convert the system event id in the correct EWOL id depending of the system management mode
* This function find the next input id unused on the specifiic widget
* ==> on PC, the ID does not change (GUI is not the same)
* == > on PC, the ID does not change (GUI is not the same)
* @param[in] destWidget Pointer of the widget destination
* @param[in] realInputId System Id
* @param[in] realInputId system Id
* @return the ewol input id
*/
int32_t localGetDestinationId(ewol::keyEvent::type_te type,
@ -80,41 +80,41 @@ namespace ewol
public:
eInput(ewol::eContext& _context);
~eInput(void);
void SetDpi(int32_t newDPI);
void setDpi(int32_t newDPI);
// note if id<0 ==> the it was finger event ...
void Motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos );
void State(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos);
// note if id<0 == > the it was finger event ...
void motion(ewol::keyEvent::type_te type, int pointerID, vec2 pos );
void state(ewol::keyEvent::type_te type, int pointerID, bool isDown, vec2 pos);
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @param[in] removeObject Pointer on the EObject remeved == > the user must remove all reference on this EObject
* @note : Sub classes must call this class
* @return ---
*/
void OnObjectRemove(ewol::EObject * removeObject);
void onObjectRemove(ewol::EObject * removeObject);
/**
* @brief a new layer on the windows is set ==> might remove all the property of the current element ...
* @brief a new layer on the windows is set == > might remove all the property of the current element ...
* @param ---
* @return ---
*/
void NewLayerSet(void);
void newLayerSet(void);
/**
* @brief This is to transfert the event from one widget to another one
* @param source the widget where the event came from
* @param destination the widget where the event mitgh be generated now
* @return ---
*/
void TransfertEvent(ewol::Widget* source, ewol::Widget* destination);
void transfertEvent(ewol::Widget* source, ewol::Widget* destination);
/**
* @brief This fonction lock the pointer properties to move in relative instead of absolute
* @param[in] widget The widget that lock the pointer events
*/
void GrabPointer(ewol::Widget* widget);
void grabPointer(ewol::Widget* widget);
/**
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/
void UnGrabPointer(void);
void unGrabPointer(void);
};
};

View File

@ -11,11 +11,11 @@
#include <ewol/renderer/openGL.h>
/**
* @brief Get the draw mutex (ewol render).
* @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& mutexOpenGl(void)
{
static etk::Mutex s_drawMutex;
return s_drawMutex;
@ -29,103 +29,102 @@ static uint32_t l_textureflags = 0;
static int32_t l_programId = 0;
void ewol::openGL::Lock(void)
{
MutexOpenGl().Lock();
l_matrixList.Clear();
void ewol::openGL::lock(void) {
mutexOpenGl().lock();
l_matrixList.clear();
mat4 tmpMat;
l_matrixList.PushBack(tmpMat);
l_matrixCamera.Identity();
l_matrixList.pushBack(tmpMat);
l_matrixCamera.identity();
l_flagsCurrent = 0;
l_flagsMustBeSet = 0;
l_textureflags = 0;
l_programId = -1;
}
void ewol::openGL::UnLock(void)
void ewol::openGL::unLock(void)
{
MutexOpenGl().UnLock();
mutexOpenGl().unLock();
}
void ewol::openGL::SetBasicMatrix(const mat4& newOne)
void ewol::openGL::setBasicMatrix(const mat4& newOne)
{
if (l_matrixList.Size()!=1) {
EWOL_ERROR("matrix is not corect size in the stack : " << l_matrixList.Size());
if (l_matrixList.size()!=1) {
EWOL_ERROR("matrix is not corect size in the stack : " << l_matrixList.size());
}
l_matrixList.Clear();
l_matrixList.PushBack(newOne);
l_matrixList.clear();
l_matrixList.pushBack(newOne);
}
void ewol::openGL::SetMatrix(const mat4& newOne)
void ewol::openGL::setMatrix(const mat4& newOne)
{
if (l_matrixList.Size()==0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
l_matrixList.PushBack(newOne);
if (l_matrixList.size() == 0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
l_matrixList.pushBack(newOne);
return;
}
l_matrixList[l_matrixList.Size()-1] = newOne;
l_matrixList[l_matrixList.size()-1] = newOne;
}
void ewol::openGL::Push(void)
void ewol::openGL::push(void)
{
if (l_matrixList.Size()==0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
if (l_matrixList.size() == 0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
mat4 tmp;
l_matrixList.PushBack(tmp);
l_matrixList.pushBack(tmp);
return;
}
mat4 tmp = l_matrixList[l_matrixList.Size()-1];
l_matrixList.PushBack(tmp);
mat4 tmp = l_matrixList[l_matrixList.size()-1];
l_matrixList.pushBack(tmp);
}
void ewol::openGL::Pop(void)
void ewol::openGL::pop(void)
{
if (l_matrixList.Size()<=1) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
l_matrixList.Clear();
if (l_matrixList.size() <= 1) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
l_matrixList.clear();
mat4 tmp;
l_matrixList.PushBack(tmp);
l_matrixCamera.Identity();
l_matrixList.pushBack(tmp);
l_matrixCamera.identity();
return;
}
l_matrixList.PopBack();
l_matrixCamera.Identity();
l_matrixList.popBack();
l_matrixCamera.identity();
}
const mat4& ewol::openGL::GetMatrix(void)
const mat4& ewol::openGL::getMatrix(void)
{
if (l_matrixList.Size()==0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
if (l_matrixList.size() == 0) {
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.size());
mat4 tmp;
l_matrixList.PushBack(tmp);
l_matrixList.pushBack(tmp);
}
return l_matrixList[l_matrixList.Size()-1];
return l_matrixList[l_matrixList.size()-1];
}
const mat4& ewol::openGL::GetCameraMatrix(void)
const mat4& ewol::openGL::getCameraMatrix(void)
{
return l_matrixCamera;
}
void ewol::openGL::SetCameraMatrix(const mat4& newOne)
void ewol::openGL::setCameraMatrix(const mat4& newOne)
{
l_matrixCamera = newOne;
}
void ewol::openGL::Finish(void)
void ewol::openGL::finish(void)
{
l_programId = -1;
l_textureflags = 0;
}
void ewol::openGL::Flush(void)
void ewol::openGL::flush(void)
{
l_programId = -1;
l_textureflags = 0;
}
void ewol::openGL::Swap(void)
void ewol::openGL::swap(void)
{
}
@ -196,48 +195,48 @@ static correspondenceTable_ts basicFlag[] = {
static int32_t basicFlagCount = sizeof(basicFlag) / sizeof(correspondenceTable_ts);
void ewol::openGL::Enable(ewol::openGL::openGlFlags_te flagID)
void ewol::openGL::enable(ewol::openGL::openGlFlags_te flagID)
{
#ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if ( basicFlag[iii].curentFlag==(uint32_t)flagID ) {
if ( basicFlag[iii].curentFlag == (uint32_t)flagID ) {
glEnable(basicFlag[iii].OGlFlag);
}
}
# else
//EWOL_DEBUG("Enable FLAGS = " << l_flagsMustBeSet);
l_flagsMustBeSet |= (uint32_t)flagID;
//EWOL_DEBUG(" ==>" << l_flagsMustBeSet);
//EWOL_DEBUG(" == >" << l_flagsMustBeSet);
#endif
}
void ewol::openGL::Disable(ewol::openGL::openGlFlags_te flagID)
void ewol::openGL::disable(ewol::openGL::openGlFlags_te flagID)
{
#ifdef DIRECT_MODE
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
if ( basicFlag[iii].curentFlag==(uint32_t)flagID ) {
if ( basicFlag[iii].curentFlag == (uint32_t)flagID ) {
glDisable(basicFlag[iii].OGlFlag);
}
}
# else
//EWOL_DEBUG("Disable FLAGS = " << l_flagsMustBeSet);
l_flagsMustBeSet &= ~((uint32_t)flagID);
//EWOL_DEBUG(" ==>" << l_flagsMustBeSet);
//EWOL_DEBUG(" == >" << l_flagsMustBeSet);
#endif
}
void ewol::openGL::UpdateAllFlags(void)
void ewol::openGL::updateAllFlags(void)
{
#ifdef DIRECT_MODE
return;
#endif
// check if fhags has change :
if (l_flagsMustBeSet==l_flagsCurrent ) {
if (l_flagsMustBeSet == l_flagsCurrent ) {
return;
}
//EWOL_DEBUG(" ==>" << l_flagsMustBeSet);
//EWOL_DEBUG(" == >" << l_flagsMustBeSet);
for (int32_t iii=0; iii<basicFlagCount ; iii++) {
uint32_t CurrentFlag = basicFlag[iii].curentFlag;
if ( (l_flagsMustBeSet&CurrentFlag)!=(l_flagsCurrent&CurrentFlag) ) {
@ -252,63 +251,63 @@ void ewol::openGL::UpdateAllFlags(void)
}
void ewol::openGL::ActiveTexture(uint32_t flagID)
void ewol::openGL::activeTexture(uint32_t flagID)
{
if (l_programId>=0) {
if (l_programId >= 0) {
glActiveTexture(flagID);
}
}
void ewol::openGL::DesActiveTexture(uint32_t flagID)
void ewol::openGL::desActiveTexture(uint32_t flagID)
{
if (l_programId>=0) {
if (l_programId >= 0) {
}
}
void ewol::openGL::DrawArrays(uint32_t mode, int32_t first, int32_t count)
void ewol::openGL::drawArrays(uint32_t mode, int32_t first, int32_t count)
{
if (l_programId>=0) {
UpdateAllFlags();
if (l_programId >= 0) {
updateAllFlags();
glDrawArrays(mode, first, count);
}
}
void ewol::openGL::DrawElements(uint32_t mode, const etk::Vector<uint32_t>& indices)
void ewol::openGL::drawElements(uint32_t mode, const etk::Vector<uint32_t>& indices)
{
if (l_programId>=0) {
UpdateAllFlags();
//EWOL_DEBUG("Request draw of " << indices.Size() << "elements");
glDrawElements(mode, indices.Size(), GL_UNSIGNED_INT, &indices[0]);
if (l_programId >= 0) {
updateAllFlags();
//EWOL_DEBUG("Request draw of " << indices.size() << "elements");
glDrawElements(mode, indices.size(), GL_UNSIGNED_INT, &indices[0]);
}
}
void ewol::openGL::DrawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices)
void ewol::openGL::drawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices)
{
if (l_programId>=0) {
UpdateAllFlags();
glDrawElements(mode, indices.Size(), GL_UNSIGNED_SHORT, &indices[0]);
if (l_programId >= 0) {
updateAllFlags();
glDrawElements(mode, indices.size(), GL_UNSIGNED_SHORT, &indices[0]);
}
}
void ewol::openGL::DrawElements8(uint32_t mode, const etk::Vector<uint8_t>& indices)
void ewol::openGL::drawElements8(uint32_t mode, const etk::Vector<uint8_t>& indices)
{
if (l_programId>=0) {
UpdateAllFlags();
glDrawElements(mode, indices.Size(), GL_UNSIGNED_BYTE, &indices[0]);
if (l_programId >= 0) {
updateAllFlags();
glDrawElements(mode, indices.size(), GL_UNSIGNED_BYTE, &indices[0]);
}
}
void ewol::openGL::UseProgram(int32_t id)
void ewol::openGL::useProgram(int32_t id)
{
//EWOL_DEBUG("USE prog : " << id);
#if 1
// note : In normal openGL case, the system might call with the program ID and at the end with 0,
// here, we wrap this use to prevent over call of glUseProgram ==> then we set -1 when the
// user no more use this program, and just stop grnerating. (chen 0 ==> this is an errored program ...
if (-1==id) {
// not used ==> because it is unneded
// here, we wrap this use to prevent over call of glUseProgram == > then we set -1 when the
// user no more use this program, and just stop grnerating. (chen 0 == > this is an errored program ...
if (-1 == id) {
// not used == > because it is unneded
return;
}
if (l_programId != id) {
@ -316,7 +315,7 @@ void ewol::openGL::UseProgram(int32_t id)
glUseProgram(l_programId);
}
#else
if (-1==id) {
if (-1 == id) {
glUseProgram(0);
} else {
l_programId = id;

View File

@ -22,7 +22,7 @@ extern "C" {
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
// TODO : Check it it work
// This is to prevent the use of these element that is not allowed in the OpenGL ES
// This is to prevent the use of these element that is not allowed in the openGL ES
#undef glVertexPointer
#undef glTexCoordPointer
#undef glColorPointer
@ -56,59 +56,59 @@ extern "C" {
namespace ewol {
namespace openGL {
/**
* @brief Lock the OpenGL context for one user only ==> better to keep flags and other things ...
* @brief Lock the openGL context for one user only == > better to keep flags and other things ...
*/
void Lock(void);
void lock(void);
/**
* @brief Un-lock the OpenGL context for an other user...
* @brief Un-lock the openGL context for an other user...
*/
void UnLock(void);
void unLock(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.
* @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
*/
void SetBasicMatrix(const mat4& newOne);
void setBasicMatrix(const mat4& newOne);
/**
* @brief this funtion configure the current use matrix for the renderer (call @ref Push before, and @ref Pop when no more needed).
* @param[in] newOne The new current matrix use for the render.
* @note We did not use opengl standard system, due to the fact that is not supported in opengl ES-2
*/
void SetMatrix(const mat4& newOne);
void setMatrix(const mat4& newOne);
/**
* @brief Store current matrix in the matrix stack.
* @brief store current matrix in the matrix stack.
*/
void Push(void);
void push(void);
/**
* @brief Remove the current matrix and get the last one from the matrix stack.
* @brief remove the current matrix and get the last one from the matrix stack.
*/
void Pop(void);
void pop(void);
/**
* @brief Get a reference on the current matrix destinate to opengl renderer.
* @brief get a reference on the current matrix destinate to opengl renderer.
* @return The requested matrix.
*/
const mat4& GetMatrix(void);
const mat4& getMatrix(void);
/**
* @brief Get a reference on the current matrix camera destinate to opengl renderer.
* @brief get a reference on the current matrix camera destinate to opengl renderer.
* @return The requested matrix.
*/
const mat4& GetCameraMatrix(void);
const mat4& getCameraMatrix(void);
/**
* @brief Set a reference on the current camera to opengl renderer.
* @brief set a reference on the current camera to opengl renderer.
* @param[in] newOne The requested matrix.
*/
void SetCameraMatrix(const mat4& newOne);
void setCameraMatrix(const mat4& newOne);
/**
* @brief
*/
void Finish(void);
void finish(void);
/**
* @brief
*/
void Flush(void);
void flush(void);
/**
* @brief
*/
void Swap(void);
void swap(void);
typedef enum {
FLAG_BLEND = 1<<0, //!< If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc.
@ -127,8 +127,8 @@ namespace ewol {
FLAG_POLYGON_OFFSET_LINE = 1<<13, //!< If enabled, and if the polygon is rendered in GL_LINE mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See glPolygonOffset.
FLAG_POLYGON_OFFSET_POINT = 1<<14, //!< If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed, if the polygon is rendered in GL_POINT mode. See glPolygonOffset.
FLAG_POLYGON_SMOOTH = 1<<15, //!< If enabled, draw polygons with proper filtering. Otherwise, draw aliased polygons. For correct antialiased polygons, an alpha buffer is needed and the polygons must be sorted front to back.
FLAG_PRIMITIVE_RESTART = 1<<16, //!< Enables primitive restarting. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the primitive restart index. See glPrimitiveRestartIndex.
FLAG_PRIMITIVE_RESTART_FIXED_INDEX = 1<<17, //!< Enables primitive restarting with a fixed index. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the fixed primitive index for the specified index type. The fixed index is equal to 2n1 where n is equal to 8 for GL_UNSIGNED_BYTE, 16 for GL_UNSIGNED_SHORT and 32 for GL_UNSIGNED_INT.
FLAG_PRIMITIVE_RESTART = 1<<16, //!< enables primitive restarting. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the primitive restart index. See glPrimitiveRestartIndex.
FLAG_PRIMITIVE_RESTART_FIXED_INDEX = 1<<17, //!< enables primitive restarting with a fixed index. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the fixed primitive index for the specified index type. The fixed index is equal to 2n1 where n is equal to 8 for GL_UNSIGNED_BYTE, 16 for GL_UNSIGNED_SHORT and 32 for GL_UNSIGNED_INT.
FLAG_SAMPLE_ALPHA_TO_COVERAGE = 1<<18, //!< If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value.
FLAG_SAMPLE_ALPHA_TO_ONE = 1<<19, //!< If enabled, each sample alpha value is replaced by the maximum representable alpha value.
FLAG_SAMPLE_COVERAGE = 1<<20, //!< If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage.
@ -143,41 +143,41 @@ namespace ewol {
} openGlFlags_te;
/**
* @brief Enable a flag on the system
* @brief enable a flag on the system
* @param[in] flagID The flag requested
*/
void Enable(openGlFlags_te flagID);
void enable(openGlFlags_te flagID);
/**
* @brief Disable a flag on the system
* @brief disable a flag on the system
* @param[in] flagID The flag requested
*/
void Disable(openGlFlags_te flagID);
void disable(openGlFlags_te flagID);
/**
* @brieg Update all the internal flag needed to be set from tre previous element set ...
* @brieg update all the internal flag needed to be set from tre previous element set ...
*/
void UpdateAllFlags(void);
void updateAllFlags(void);
/**
* @brief Enable Texture on the system
* @brief enable Texture on the system
* @param[in] flagID The flag requested
*/
void ActiveTexture(uint32_t flagID);
void activeTexture(uint32_t flagID);
/**
* @brief Disable Texture on the system
* @brief disable Texture on the system
* @param[in] flagID The flag requested
*/
void DesActiveTexture(uint32_t flagID);
void desActiveTexture(uint32_t flagID);
/**
* @brief draw a specific array ==> this enable mode difference ...
* @brief draw a specific array == > this enable mode difference ...
*/
void DrawArrays(uint32_t mode, int32_t first, int32_t count);
void DrawElements (uint32_t mode, const etk::Vector<uint32_t>& indices);
void DrawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices);
void DrawElements8 (uint32_t mode, const etk::Vector<uint8_t>& indices);
void drawArrays(uint32_t mode, int32_t first, int32_t count);
void drawElements (uint32_t mode, const etk::Vector<uint32_t>& indices);
void drawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices);
void drawElements8 (uint32_t mode, const etk::Vector<uint8_t>& indices);
/**
* @brief Use openGL program
* @param[in] id Id of the program that might be used
*/
void UseProgram(int32_t id);
void useProgram(int32_t id);
};
};

View File

@ -19,149 +19,149 @@ ewol::Colored3DObject::Colored3DObject(void) :
{
// get the shader resource :
m_GLPosition = 0;
m_GLprogram = ewol::Program::Keep("DATA:simple3D.prog");
m_GLprogram = ewol::Program::keep("DATA:simple3D.prog");
if (NULL != m_GLprogram ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetUniform("EW_color");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
m_GLColor = m_GLprogram->getUniform("EW_color");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
}
}
ewol::Colored3DObject::~Colored3DObject(void)
{
// remove dynamics dependencies :
ewol::Program::Release(m_GLprogram);
ewol::Program::release(m_GLprogram);
}
void ewol::Colored3DObject::Draw(etk::Vector<vec3>& _vertices,
void ewol::Colored3DObject::draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color,
bool _updateDepthBuffer,
bool _depthtest)
{
if (_vertices.Size()<=0) {
if (_vertices.size() <= 0) {
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
if (true==_depthtest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false==_updateDepthBuffer) {
if (true == _depthtest) {
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false == _updateDepthBuffer) {
glDepthMask(GL_FALSE);
}
}
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
m_GLprogram->Use();
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->use();
// set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix();
mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &_vertices[0], 4*sizeof(float));
m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z,unused*/, &_vertices[0], 4*sizeof(float));
// color :
m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, _vertices.Size());
m_GLprogram->UnUse();
ewol::openGL::drawArrays(GL_TRIANGLES, 0, _vertices.size());
m_GLprogram->unUse();
// Request the draw od the elements :
//glDrawArrays(GL_LINES, 0, vertices.Size());
//glDrawArrays(GL_LINES, 0, vertices.size());
//m_GLprogram->UnUse();
if (true==_depthtest) {
if (false==_updateDepthBuffer) {
if (true == _depthtest) {
if (false == _updateDepthBuffer) {
glDepthMask(GL_TRUE);
}
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST);
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
}
}
void ewol::Colored3DObject::Draw(etk::Vector<vec3>& _vertices,
void ewol::Colored3DObject::draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color,
mat4& _transformationMatrix,
bool _updateDepthBuffer,
bool _depthtest)
{
if (_vertices.Size()<=0) {
if (_vertices.size() <= 0) {
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
if (true==_depthtest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false==_updateDepthBuffer) {
if (true == _depthtest) {
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false == _updateDepthBuffer) {
glDepthMask(GL_FALSE);
}
}
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
m_GLprogram->Use();
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->use();
// set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix();
mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float));
m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float));
// color :
m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_TRIANGLES, 0, _vertices.Size());
m_GLprogram->UnUse();
if (true==_depthtest) {
if (false==_updateDepthBuffer) {
ewol::openGL::drawArrays(GL_TRIANGLES, 0, _vertices.size());
m_GLprogram->unUse();
if (true == _depthtest) {
if (false == _updateDepthBuffer) {
glDepthMask(GL_TRUE);
}
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST);
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
}
}
void ewol::Colored3DObject::DrawLine(etk::Vector<vec3>& _vertices,
void ewol::Colored3DObject::drawLine(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color,
mat4& _transformationMatrix,
bool _updateDepthBuffer,
bool _depthtest)
{
if (_vertices.Size()<=0) {
if (_vertices.size() <= 0) {
return;
}
if (m_GLprogram==NULL) {
if (m_GLprogram == NULL) {
EWOL_ERROR("No shader ...");
return;
}
if (true==_depthtest) {
ewol::openGL::Enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false==_updateDepthBuffer) {
if (true == _depthtest) {
ewol::openGL::enable(ewol::openGL::FLAG_DEPTH_TEST);
if (false == _updateDepthBuffer) {
glDepthMask(GL_FALSE);
}
}
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
m_GLprogram->Use();
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
m_GLprogram->use();
// set Matrix : translation/positionMatrix
mat4 projMatrix = ewol::openGL::GetMatrix();
mat4 camMatrix = ewol::openGL::GetCameraMatrix();
mat4 projMatrix = ewol::openGL::getMatrix();
mat4 camMatrix = ewol::openGL::getCameraMatrix();
mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
m_GLprogram->uniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float));
m_GLprogram->sendAttribute(m_GLPosition, 3/*x,y,z*/, &_vertices[0], 4*sizeof(float));
// color :
m_GLprogram->Uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
m_GLprogram->uniform4fv(m_GLColor, 1/*r,g,b,a*/, (float*)&_color);
// Request the draw od the elements :
ewol::openGL::DrawArrays(GL_LINES, 0, _vertices.Size());
m_GLprogram->UnUse();
if (true==_depthtest) {
if (false==_updateDepthBuffer) {
ewol::openGL::drawArrays(GL_LINES, 0, _vertices.size());
m_GLprogram->unUse();
if (true == _depthtest) {
if (false == _updateDepthBuffer) {
glDepthMask(GL_TRUE);
}
ewol::openGL::Disable(ewol::openGL::FLAG_DEPTH_TEST);
ewol::openGL::disable(ewol::openGL::FLAG_DEPTH_TEST);
}
}
ewol::Colored3DObject* ewol::Colored3DObject::Keep(void)
ewol::Colored3DObject* ewol::Colored3DObject::keep(void)
{
EWOL_VERBOSE("KEEP : direct Colored3DObject");
// need to crate a new one ...
@ -170,16 +170,16 @@ ewol::Colored3DObject* ewol::Colored3DObject::Keep(void)
EWOL_ERROR("allocation error of a resource : Colored3DObject ");
return NULL;
}
GetManager().LocalAdd(object);
getManager().localAdd(object);
return object;
}
void ewol::Colored3DObject::Release(ewol::Colored3DObject*& _object)
void ewol::Colored3DObject::release(ewol::Colored3DObject*& _object)
{
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2);
getManager().release(object2);
_object = NULL;
}

View File

@ -28,33 +28,33 @@ namespace ewol
Colored3DObject(void);
virtual ~Colored3DObject(void);
public:
virtual const char* GetType(void) { return "ewol::Colored3DObject"; };
virtual void Draw(etk::Vector<vec3>& _vertices,
virtual const char* getType(void) { return "ewol::Colored3DObject"; };
virtual void draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color,
bool _updateDepthBuffer=true,
bool _depthtest=true);
virtual void Draw(etk::Vector<vec3>& _vertices,
virtual void draw(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color,
mat4& _transformationMatrix,
bool _updateDepthBuffer=true,
bool _depthtest=true);
virtual void DrawLine(etk::Vector<vec3>& _vertices,
virtual void drawLine(etk::Vector<vec3>& _vertices,
const etk::Color<float>& _color,
mat4& _transformationMatrix,
bool _updateDepthBuffer=true,
bool _depthtest=true);
public:
/**
* @brief Keep the resource pointer.
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @return pointer on the resource or NULL if an error occured.
*/
static ewol::Colored3DObject* Keep(void);
static ewol::Colored3DObject* keep(void);
/**
* @brief Release the keeped resources
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void Release(ewol::Colored3DObject*& _object);
static void release(ewol::Colored3DObject*& _object);
};
};

View File

@ -15,7 +15,7 @@
#define __class__ "ConfigFile"
void ewol::SimpleConfigElement::Parse(const etk::UString& value)
void ewol::SimpleConfigElement::parse(const etk::UString& value)
{
etk::Char tmp = value.c_str();
m_valueInt = 0;
@ -31,50 +31,50 @@ ewol::ConfigFile::ConfigFile(const etk::UString& _filename):
ewol::Resource(_filename)
{
EWOL_DEBUG("SFP : load \"" << _filename << "\"");
Reload();
reload();
}
ewol::ConfigFile::~ConfigFile(void)
{
// remove all element
for (int32_t iii=0; iii<m_list.Size(); iii++){
for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) {
delete(m_list[iii]);
m_list[iii] = NULL;
}
}
m_list.Clear();
m_list.clear();
}
void ewol::ConfigFile::Reload(void)
void ewol::ConfigFile::reload(void)
{
// Reset all parameters
for (int32_t iii=0; iii<m_list.Size(); iii++){
// reset all parameters
for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) {
m_list[iii]->Parse("");
m_list[iii]->parse("");
}
}
// acess of the file :
etk::FSNode file(m_name);
if (false == file.Exist()) {
if (false == file.exist()) {
EWOL_ERROR("File does not Exist : \"" << file << "\"");
return;
}
etk::UString fileExtention = file.FileGetExtention();
etk::UString fileExtention = file.fileGetExtention();
if (fileExtention != "conf") {
EWOL_ERROR("File does not have extention \".conf\" for program but : \"" << fileExtention << "\"");
return;
}
if (false == file.FileOpenRead()) {
if (false == file.fileOpenRead()) {
EWOL_ERROR("Can not open the file : " << file);
return;
}
#define MAX_LINE_SIZE (2048)
char tmpData[MAX_LINE_SIZE];
while (file.FileGets(tmpData, MAX_LINE_SIZE) != NULL) {
while (file.fileGets(tmpData, MAX_LINE_SIZE) != NULL) {
int32_t len = strlen(tmpData);
if( tmpData[len-1] == '\n'
|| tmpData[len-1] == '\r') {
@ -87,30 +87,30 @@ void ewol::ConfigFile::Reload(void)
}
etk::UString tmpData2(tmpData);
etk::UString tmppp("#");
if (true == tmpData2.StartWith(tmppp)) {
if (true == tmpData2.startWith(tmppp)) {
// comment ...
continue;
}
tmppp="//";
if (true == tmpData2.StartWith(tmppp)) {
if (true == tmpData2.startWith(tmppp)) {
// comment ...
continue;
}
// get parameters :
int32_t pos = tmpData2.FindForward('=');
int32_t pos = tmpData2.findForward('=');
if (pos == -1){
//the element "=" is not find ...
continue;
}
etk::UString paramName = tmpData2.Extract(0, pos);
etk::UString paramValue = tmpData2.Extract(pos+1, 0x7FFFF);
etk::UString paramName = tmpData2.extract(0, pos);
etk::UString paramValue = tmpData2.extract(pos+1, 0x7FFFF);
EWOL_DEBUG(" param name=\"" << paramName << "\" val=\"" << paramValue << "\"");
// check if the parameters existed :
bool findParam = false;
for (int32_t iii=0; iii<m_list.Size(); iii++){
for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) {
if (m_list[iii]->m_paramName == paramName) {
m_list[iii]->Parse(paramValue);
m_list[iii]->parse(paramValue);
findParam = true;
// stop parsing ...
break;
@ -122,21 +122,21 @@ void ewol::ConfigFile::Reload(void)
if (NULL == tmpElement) {
EWOL_DEBUG("error while allocation");
} else {
tmpElement->Parse(paramValue);
m_list.PushBack(tmpElement);
tmpElement->parse(paramValue);
m_list.pushBack(tmpElement);
}
}
}
// close the file:
file.FileClose();
file.fileClose();
}
int32_t ewol::ConfigFile::Request(const etk::UString& _paramName)
int32_t ewol::ConfigFile::request(const etk::UString& _paramName)
{
// check if the parameters existed :
for (int32_t iii=0; iii<m_list.Size(); iii++){
for (int32_t iii=0; iii<m_list.size(); iii++){
if (NULL != m_list[iii]) {
if (m_list[iii]->m_paramName == _paramName) {
return iii;
@ -147,16 +147,16 @@ int32_t ewol::ConfigFile::Request(const etk::UString& _paramName)
if (NULL == tmpElement) {
EWOL_DEBUG("error while allocation");
} else {
m_list.PushBack(tmpElement);
m_list.pushBack(tmpElement);
}
return m_list.Size()-1;
return m_list.size()-1;
}
ewol::ConfigFile* ewol::ConfigFile::Keep(const etk::UString& _filename)
ewol::ConfigFile* ewol::ConfigFile::keep(const etk::UString& _filename)
{
EWOL_INFO("KEEP : SimpleConfig : file : \"" << _filename << "\"");
ewol::ConfigFile* object = static_cast<ewol::ConfigFile*>(GetManager().LocalKeep(_filename));
ewol::ConfigFile* object = static_cast<ewol::ConfigFile*>(getManager().localKeep(_filename));
if (NULL != object) {
return object;
}
@ -166,17 +166,17 @@ ewol::ConfigFile* ewol::ConfigFile::Keep(const etk::UString& _filename)
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
return NULL;
}
GetManager().LocalAdd(object);
getManager().localAdd(object);
return object;
}
void ewol::ConfigFile::Release(ewol::ConfigFile*& _object)
void ewol::ConfigFile::release(ewol::ConfigFile*& _object)
{
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2);
getManager().release(object2);
_object = NULL;
}

View File

@ -30,10 +30,10 @@ namespace ewol
m_valueInt(0),
m_valuefloat(0.0) { };
~SimpleConfigElement(void) { };
void Parse(const etk::UString& value);
int32_t GetInteger(void) { return m_valueInt; };
float GetFloat(void) { return m_valuefloat; };
etk::UString& GetString(void) { return m_value; };
void parse(const etk::UString& value);
int32_t getInteger(void) { return m_valueInt; };
float getFloat(void) { return m_valuefloat; };
etk::UString& getString(void) { return m_value; };
};
class ConfigFile : public ewol::Resource
@ -45,27 +45,27 @@ namespace ewol
ConfigFile(const etk::UString& _filename);
virtual ~ConfigFile(void);
public:
const char* GetType(void) { return "ewol::SimpleConfigFile"; };
void Reload(void);
const char* getType(void) { return "ewol::SimpleConfigFile"; };
void reload(void);
int32_t Request(const etk::UString& _paramName);
int32_t request(const etk::UString& _paramName);
int32_t GetInteger(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetInteger(); };
float GetFloat(int32_t id) { if (id<0) { return 0; } return m_list[id]->GetFloat(); };
etk::UString& GetString(int32_t id) { if (id<0) { return m_errorString; } return m_list[id]->GetString(); };
int32_t getInteger(int32_t id) { if (id<0) { return 0; } return m_list[id]->getInteger(); };
float getFloat(int32_t id) { if (id<0) { return 0; } return m_list[id]->getFloat(); };
etk::UString& getString(int32_t id) { if (id<0) { return m_errorString; } return m_list[id]->getString(); };
public:
/**
* @brief Keep the resource pointer.
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the configuration file.
* @return pointer on the resource or NULL if an error occured.
*/
static ewol::ConfigFile* Keep(const etk::UString& _filename);
static ewol::ConfigFile* keep(const etk::UString& _filename);
/**
* @brief Release the keeped resources
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void Release(ewol::ConfigFile*& _object);
static void release(ewol::ConfigFile*& _object);
};
};

View File

@ -27,9 +27,9 @@
static int32_t l_countLoaded=0;
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 ...
@ -41,9 +41,9 @@ 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 ...
@ -66,16 +66,16 @@ ewol::FontFreeType::FontFreeType(const etk::UString& _fontName) :
m_FileSize = 0;
etk::FSNode myfile(_fontName);
if (false == myfile.Exist()) {
if (false == myfile.exist()) {
EWOL_ERROR("File Does not exist : " << myfile);
return;
}
m_FileSize = myfile.FileSize();
if (0==m_FileSize) {
m_FileSize = myfile.fileSize();
if (0 == m_FileSize) {
EWOL_ERROR("This file is empty : " << myfile);
return;
}
if (false == myfile.FileOpenRead()) {
if (false == myfile.fileOpenRead()) {
EWOL_ERROR("Can not open the file : " << myfile);
return;
}
@ -86,9 +86,9 @@ ewol::FontFreeType::FontFreeType(const etk::UString& _fontName) :
return;
}
// load data from the file :
myfile.FileRead(m_FileBuffer, 1, m_FileSize);
myfile.fileRead(m_FileBuffer, 1, m_FileSize);
// close the file:
myfile.FileClose();
myfile.fileClose();
// load Face ...
int32_t error = FT_New_Memory_Face( library, m_FileBuffer, m_FileSize, 0, &m_fftFace );
if( FT_Err_Unknown_File_Format == error) {
@ -115,9 +115,9 @@ ewol::FontFreeType::~FontFreeType(void)
}
vec2 ewol::FontFreeType::GetSize(int32_t _fontSize, const etk::UString& _unicodeString)
vec2 ewol::FontFreeType::getSize(int32_t _fontSize, const etk::UString& _unicodeString)
{
if(false==m_init) {
if(false == m_init) {
return vec2(0,0);
}
// TODO : ...
@ -125,29 +125,29 @@ vec2 ewol::FontFreeType::GetSize(int32_t _fontSize, const etk::UString& _unicode
return outputSize;
}
int32_t ewol::FontFreeType::GetHeight(int32_t _fontSize)
int32_t ewol::FontFreeType::getHeight(int32_t _fontSize)
{
return _fontSize*1.43f; // this is a really "magic" number ...
}
bool ewol::FontFreeType::GetGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property)
bool ewol::FontFreeType::getGlyphProperty(int32_t _fontSize, ewol::GlyphProperty& _property)
{
if(false==m_init) {
if(false == m_init) {
return false;
}
// 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96;
// Select Size ...
// note tha <<6==*64 corespond with the 1/64th of points calculation of freetype
// Select size ...
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size ==> error in settings ...");
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
return false;
}
// a small shortcut
FT_GlyphSlot slot = m_fftFace->glyph;
// retrieve glyph index from character code
int32_t glyph_index = FT_Get_Char_Index(m_fftFace, _property.m_UVal.Get());
int32_t glyph_index = FT_Get_Char_Index(m_fftFace, _property.m_UVal.get());
// load glyph image into the slot (erase previous one)
error = FT_Load_Glyph(m_fftFace, // handle to face object
glyph_index, // glyph index
@ -171,23 +171,22 @@ bool ewol::FontFreeType::GetGlyphProperty(int32_t _fontSize, ewol::GlyphProperty
return true;
}
bool ewol::FontFreeType::DrawGlyph(egami::Image& _imageOut,
bool ewol::FontFreeType::drawGlyph(egami::Image& _imageOut,
int32_t _fontSize,
ivec2 _glyphPosition,
ewol::GlyphProperty& _property,
int8_t _posInImage)
{
if(false==m_init) {
if(false == m_init) {
return false;
}
// 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96;
// Select Size ...
// note tha <<6==*64 corespond with the 1/64th of points calculation of freetype
// Select size ...
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, _fontSize<<6, _fontSize<<6, fontQuality, fontQuality);
if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size ==> error in settings ...");
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
return false;
}
// a small shortcut
@ -210,59 +209,59 @@ bool ewol::FontFreeType::DrawGlyph(egami::Image& _imageOut,
etk::Color<> tlpppp(0xFFFFFF00);
for(int32_t jjj=0; jjj < slot->bitmap.rows;jjj++) {
for(int32_t iii=0; iii < slot->bitmap.width; iii++){
tlpppp = _imageOut.Get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
tlpppp = _imageOut.get(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
uint8_t valueColor = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
// set only alpha :
switch(_posInImage)
{
default:
case 0:
tlpppp.SetA(valueColor);
tlpppp.setA(valueColor);
break;
case 1:
tlpppp.SetR(valueColor);
tlpppp.setR(valueColor);
break;
case 2:
tlpppp.SetG(valueColor);
tlpppp.setG(valueColor);
break;
case 3:
tlpppp.SetB(valueColor);
tlpppp.setB(valueColor);
break;
}
// real set of color
_imageOut.Set(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp );
_imageOut.set(ivec2(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp );
}
}
return true;
}
void ewol::FontFreeType::GenerateKerning(int32_t fontSize, etk::Vector<ewol::GlyphProperty>& listGlyph)
void ewol::FontFreeType::generateKerning(int32_t fontSize, etk::Vector<ewol::GlyphProperty>& listGlyph)
{
if(false==m_init) {
if(false == m_init) {
return;
}
if ((FT_FACE_FLAG_KERNING & m_fftFace->face_flags) == 0) {
EWOL_INFO("No kerning generation (Disable) in the font");
EWOL_INFO("No kerning generation (disable) in the font");
}
// 300dpi (hight quality) 96 dpi (normal quality)
int32_t fontQuality = 96;
// Select Size ...
// note tha <<6==*64 corespond with the 1/64th of points calculation of freetype
// Select size ...
// note tha <<6 == *64 corespond with the 1/64th of points calculation of freetype
int32_t error = FT_Set_Char_Size(m_fftFace, fontSize<<6, fontSize<<6, fontQuality, fontQuality);
if (0!=error ) {
EWOL_ERROR("FT_Set_Char_Size ==> error in settings ...");
EWOL_ERROR("FT_Set_Char_Size == > error in settings ...");
return;
}
// For all the kerning element we get the kerning value :
for(int32_t iii=0; iii<listGlyph.Size(); iii++) {
listGlyph[iii].KerningClear();
for(int32_t kkk=0; kkk<listGlyph.Size(); kkk++) {
for(int32_t iii=0; iii<listGlyph.size(); iii++) {
listGlyph[iii].kerningClear();
for(int32_t kkk=0; kkk<listGlyph.size(); kkk++) {
FT_Vector kerning;
FT_Get_Kerning(m_fftFace, listGlyph[kkk].m_glyphIndex, listGlyph[iii].m_glyphIndex, FT_KERNING_UNFITTED, &kerning );
// add the kerning only if != 0 ...
if (kerning.x != 0) {
listGlyph[iii].KerningAdd(listGlyph[kkk].m_UVal,
listGlyph[iii].kerningAdd(listGlyph[kkk].m_UVal,
kerning.x/32.0f );
//EWOL_DEBUG("Kerning between : '" << (char)listGlyph[iii].m_UVal << "'&'" << (char)listGlyph[kkk].m_UVal << "' value : " << kerning.x << " => " << (kerning.x/64.0f));
}
@ -271,9 +270,9 @@ void ewol::FontFreeType::GenerateKerning(int32_t fontSize, etk::Vector<ewol::Gly
}
void ewol::FontFreeType::Display(void)
void ewol::FontFreeType::display(void)
{
if(false==m_init) {
if(false == m_init) {
return;
}
EWOL_INFO(" nuber of glyph = " << (int)m_fftFace->num_glyphs);
@ -360,10 +359,10 @@ void ewol::FontFreeType::Display(void)
ewol::FontBase* ewol::FontFreeType::Keep(const etk::UString& _filename)
ewol::FontBase* ewol::FontFreeType::keep(const etk::UString& _filename)
{
EWOL_VERBOSE("KEEP : Font : file : \"" << _filename << "\"");
ewol::FontBase* object = static_cast<ewol::FontBase*>(GetManager().LocalKeep(_filename));
ewol::FontBase* object = static_cast<ewol::FontBase*>(getManager().localKeep(_filename));
if (NULL != object) {
return object;
}
@ -373,16 +372,16 @@ ewol::FontBase* ewol::FontFreeType::Keep(const etk::UString& _filename)
EWOL_ERROR("allocation error of a resource : " << _filename);
return NULL;
}
GetManager().LocalAdd(object);
getManager().localAdd(object);
return object;
}
void ewol::FontFreeType::Release(ewol::FontBase*& _object)
void ewol::FontFreeType::release(ewol::FontBase*& _object)
{
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2);
getManager().release(object2);
_object = NULL;
}

View File

@ -27,42 +27,42 @@ namespace ewol
int32_t m_FileSize;
FT_Face m_fftFace;
bool m_init;
void Display(void);
void display(void);
protected:
FontFreeType(const etk::UString& _fontName);
~FontFreeType(void);
public:
bool GetGlyphProperty(int32_t _fontSize,
bool getGlyphProperty(int32_t _fontSize,
ewol::GlyphProperty& _property);
bool DrawGlyph(egami::Image& _imageOut,
bool drawGlyph(egami::Image& _imageOut,
int32_t _fontSize,
ivec2 _glyphPosition,
ewol::GlyphProperty& _property,
int8_t _posInImage);
vec2 GetSize(int32_t _fontSize, const etk::UString& _unicodeString);
vec2 getSize(int32_t _fontSize, const etk::UString& _unicodeString);
int32_t GetHeight(int32_t _fontSize);
int32_t getHeight(int32_t _fontSize);
void GenerateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph);
void generateKerning(int32_t _fontSize, etk::Vector<ewol::GlyphProperty>& _listGlyph);
public:
/**
* @brief Keep the resource pointer.
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the base font.
* @return pointer on the resource or NULL if an error occured.
*/
static ewol::FontBase* Keep(const etk::UString& _filename);
static ewol::FontBase* keep(const etk::UString& _filename);
/**
* @brief Release the keeped resources
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void Release(ewol::FontBase*& _object);
static void release(ewol::FontBase*& _object);
};
void FreeTypeInit(void);
void FreeTypeUnInit(void);
void freeTypeInit(void);
void freeTypeUnInit(void);
};

View File

@ -15,7 +15,8 @@
#undef __class__
#define __class__ "TextureFile"
#define __class__ "TextureFile"
ewol::TextureFile::TextureFile(const etk::UString& _genName) :
Texture(_genName)
{
@ -26,12 +27,12 @@ ewol::TextureFile::TextureFile(const etk::UString& _genName) :
ewol::TextureFile::TextureFile(etk::UString _genName, const etk::UString& _tmpfileName, const ivec2& _size) :
Texture(_genName)
{
if (false == egami::Load(m_data, _tmpfileName, _size)) {
if (false == egami::load(m_data, _tmpfileName, _size)) {
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
}
ivec2 tmp = m_data.GetSize();
ivec2 tmp = m_data.getSize();
m_realImageSize = vec2(tmp.x(), tmp.y());
Flush();
flush();
}
@ -57,7 +58,7 @@ static int32_t nextP2(int32_t _value)
ewol::TextureFile* ewol::TextureFile::Keep(const etk::UString& _filename, ivec2 _size)
ewol::TextureFile* ewol::TextureFile::keep(const etk::UString& _filename, ivec2 _size)
{
EWOL_INFO("KEEP : TextureFile : file : " << _filename << " basic size=" << _size);
if (_filename == "") {
@ -66,27 +67,27 @@ ewol::TextureFile* ewol::TextureFile::Keep(const etk::UString& _filename, ivec2
EWOL_ERROR("allocation error of a resource : ??TEX??");
return NULL;
}
GetManager().LocalAdd(object);
getManager().localAdd(object);
return object;
}
if (_size.x()==0) {
if (_size.x() == 0) {
_size.setX(-1);
//EWOL_ERROR("Error Request the image size.x() =0 ???");
}
if (_size.y()==0) {
if (_size.y() == 0) {
_size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???");
}
etk::UString TmpFilename = _filename;
if (false == _filename.EndWith(".svg") ) {
if (false == _filename.endWith(".svg") ) {
_size = ivec2(-1,-1);
}
#ifdef __TARGET_OS__MacOs
EWOL_ERROR("TODO : Remove this strange hack");
EWOL_ERROR("TODO : remove this strange hack");
_size = ivec2(64,64);
#endif
if (_size.x()>0 && _size.y()>0) {
EWOL_VERBOSE(" ==> specific size : " << _size);
EWOL_VERBOSE(" == > specific size : " << _size);
#ifdef __TARGET_OS__Android
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif
@ -97,29 +98,29 @@ ewol::TextureFile* ewol::TextureFile::Keep(const etk::UString& _filename, ivec2
}
EWOL_INFO("KEEP : TextureFile : file : \"" << TmpFilename << "\" new size=" << _size);
ewol::TextureFile* object = static_cast<ewol::TextureFile*>(GetManager().LocalKeep(TmpFilename));
ewol::TextureFile* object = static_cast<ewol::TextureFile*>(getManager().localKeep(TmpFilename));
if (NULL != object) {
return object;
}
EWOL_INFO(" ==> create new one...");
EWOL_INFO(" == > create new one...");
// need to crate a new one ...
object = new ewol::TextureFile(TmpFilename, _filename, _size);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << _filename);
return NULL;
}
GetManager().LocalAdd(object);
getManager().localAdd(object);
return object;
}
void ewol::TextureFile::Release(ewol::TextureFile*& _object)
void ewol::TextureFile::release(ewol::TextureFile*& _object)
{
if (NULL == _object) {
return;
}
ewol::Resource* object2 = static_cast<ewol::Resource*>(_object);
GetManager().Release(object2);
getManager().release(object2);
_object = NULL;
}

View File

@ -26,22 +26,22 @@ namespace ewol
TextureFile(etk::UString _genName, const etk::UString& _fileName, const ivec2& _size);
~TextureFile(void) { };
public:
virtual const char* GetType(void) { return "ewol::TextureFile"; };
const vec2& GetRealSize(void) { return m_realImageSize; };
virtual const char* getType(void) { return "ewol::TextureFile"; };
const vec2& getRealSize(void) { return m_realImageSize; };
public:
/**
* @brief Keep the resource pointer.
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the image file.
* @param[in] _requested size of the image (usefull when loading .svg to automatic rescale)
* @return pointer on the resource or NULL if an error occured.
*/
static ewol::TextureFile* Keep(const etk::UString& _filename, ivec2 _size=ivec2(-1,-1));
static ewol::TextureFile* keep(const etk::UString& _filename, ivec2 _size=ivec2(-1,-1));
/**
* @brief Release the keeped resources
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void Release(ewol::TextureFile*& _object);
static void release(ewol::TextureFile*& _object);
};
};

File diff suppressed because it is too large Load Diff

View File

@ -111,61 +111,61 @@ namespace ewol
Mesh(const etk::UString& _fileName, const etk::UString& _shaderName="DATA:textured3D2.prog");
virtual ~Mesh(void);
public:
virtual const char* GetType(void) { return "ewol::Mesh"; };
virtual void Draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true);
void GenerateVBO(void);
virtual const char* getType(void) { return "ewol::Mesh"; };
virtual void draw(mat4& _positionMatrix, bool _enableDepthTest=true, bool _enableDepthUpdate=true);
void generateVBO(void);
private:
void CalculateNormaleFace(void);
void CalculateNormaleEdge(void);
void calculateNormaleFace(void);
void calculateNormaleEdge(void);
public :
void CreateViewBox(const etk::UString& _materialName,float _size=1.0);
void createViewBox(const etk::UString& _materialName,float _size=1.0);
private:
bool LoadOBJ(const etk::UString& _fileName);
bool LoadEMF(const etk::UString& _fileName);
bool loadOBJ(const etk::UString& _fileName);
bool loadEMF(const etk::UString& _fileName);
public:
void AddMaterial(const etk::UString& _name, ewol::Material* _data);
void addMaterial(const etk::UString& _name, ewol::Material* _data);
public:
/**
* @brief Set the check of normal position befor sending it to the openGl card
* @brief set the check of normal position befor sending it to the openGl card
* @param[in] _status New state.
*/
void SetCheckNormal(bool _status) { m_checkNormal=_status; };
void setCheckNormal(bool _status) { m_checkNormal=_status; };
/**
* @brief Get the check value of normal position befor sending it to the openGl card
* @return Get the chcking stus of normal or not
* @brief get the check value of normal position befor sending it to the openGl card
* @return get the chcking stus of normal or not
*/
bool GetCheckNormal(void) { return m_checkNormal; };
const etk::Vector<ewol::PhysicsShape*>& GetPhysicalProperties(void) const { return m_physics; };
bool getCheckNormal(void) { return m_checkNormal; };
const etk::Vector<ewol::PhysicsShape*>& getPhysicalProperties(void) const { return m_physics; };
private:
void* m_pointerShape; //!< all mesh have a basic shape (bullet or other) the void pointer mermit to not depent on the bullet lib
public:
/**
* @brief Set the shape pointer (no type ==> user might know it ...)
* @brief set the shape pointer (no type == > user might know it ...)
* @param[in] _shape The new shape (this remove the previous one)
*/
void SetShape(void* _shape);
void setShape(void* _shape);
/**
* @brief Get the pointer on the shame (no type)
* @brief get the pointer on the shame (no type)
* @return Pointer on shape.
*/
void* GetShape(void) { return m_pointerShape; };
void* getShape(void) { return m_pointerShape; };
private:
void (*m_functionFreeShape)(void* _pointer);
public:
void SetFreeShapeFunction(void (*_functionFreeShape)(void* _pointer)) { m_functionFreeShape = _functionFreeShape; };
void setFreeShapeFunction(void (*_functionFreeShape)(void* _pointer)) { m_functionFreeShape = _functionFreeShape; };
public:
/**
* @brief Keep the resource pointer.
* @brief keep the resource pointer.
* @note Never free this pointer by your own...
* @param[in] _filename Name of the ewol mesh file.
* @return pointer on the resource or NULL if an error occured.
*/
static ewol::Mesh* Keep(const etk::UString& _meshname);
static ewol::Mesh* keep(const etk::UString& _meshname);
/**
* @brief Release the keeped resources
* @brief release the keeped resources
* @param[in,out] reference on the object pointer
*/
static void Release(ewol::Mesh*& _object);
static void release(ewol::Mesh*& _object);
};
};

Some files were not shown because too many files have changed in this diff Show More