[DEV] Rework of the internal tree and system

This commit is contained in:
Edouard DUPIN 2012-11-22 22:28:05 +01:00
parent 6921fd4467
commit f45c7a6743
70 changed files with 893 additions and 907 deletions

2
external/agg vendored

@ -1 +1 @@
Subproject commit 197525dfc6cbe138767392466ad4f450aa7b2bd6
Subproject commit b166e92b447201ef12236cd498a06664c7aec52f

2
external/etk vendored

@ -1 +1 @@
Subproject commit a8cafb5969640bd14ed9ba0dd3dfa718124e2101
Subproject commit 6ceb992e455f2cd02e7fa3ff071e835cedaf436f

2
external/parsersvg vendored

@ -1 +1 @@
Subproject commit 2697e6940e2549e4c6725911d049ae3a92efe2f9
Subproject commit 6ff447eadb51765b42574baf8d3dd2ed791af617

View File

@ -34,6 +34,8 @@ include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := \
$(FILE_LIST) \
QSDFQSDFQSDF = \
ewol/os/gui.X11.cpp \
ewol/audio/interfacePortAudio.cpp

View File

@ -27,7 +27,7 @@ note: la copy dans le :
static etk::UString mesCopy[ewol::clipBoard::clipboardCount];
static const char* clipboardDescriptionString[clipboardCount] = {
static const char* clipboardDescriptionString[ewol::clipBoard::clipboardCount+1] = {
"clipboard0",
"clipboard1",
"clipboard2",
@ -45,7 +45,7 @@ static const char* clipboardDescriptionString[clipboardCount] = {
etk::CCout& ewol::clipBoard::operator <<(etk::CCout &os, const ewol::clipBoard::clipboardListe_te obj)
{
if (obj>=0 && obj <clipboardCount) {
if (obj>=0 && obj <ewol::clipBoard::clipboardCount) {
os << clipboardDescriptionString[obj];
} else {
os << "[ERROR]";

View File

@ -9,7 +9,7 @@
#ifndef __EWOL_COMMAND_LINE_H__
#define __EWOL_COMMAND_LINE_H__
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/UString.h>
namespace ewol

View File

@ -6,7 +6,10 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <etk/types.h>
#include <etk/math/Matrix4.h>
#include <ewol/debug.h>
#include <ewol/compositing/Compositing.h>
@ -30,19 +33,19 @@ void ewol::Compositing::ResetMatrix(void)
void ewol::Compositing::Translate(etk::Vector3D<float> vect)
{
m_matrixApply *= etk::matrix::Translate(vect);
m_matrixApply *= etk::Matrix4::Translate(vect);
}
void ewol::Compositing::Rotate(etk::Vector3D<float> vect, float angle)
{
m_matrixApply *= etk::matrix::Rotate(vect, angle);
m_matrixApply *= etk::Matrix4::Rotate(vect, angle);
}
void ewol::Compositing::Scale(etk::Vector3D<float> vect)
{
m_matrixApply *= etk::matrix::Scale(vect);
m_matrixApply *= etk::Matrix4::Scale(vect);
}

View File

@ -9,9 +9,9 @@
#ifndef __EWOL_COMPOSITING_H__
#define __EWOL_COMPOSITING_H__
#include <ewol/Debug.h>
#include <etk/math/Matrix4.h>
#include <ewol/debug.h>
#include <etk/UString.h>
#include <etk/math/Matrix4.h>
namespace ewol
{

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <ewol/debug.h>
#include <ewol/compositing/Drawing.h>

View File

@ -9,10 +9,11 @@
#ifndef __EWOL_DRAWING_H__
#define __EWOL_DRAWING_H__
#include <ewol/Debug.h>
#include <ewol/compositing/Compositing.h>
#include <draw/Color.h>
#include <ewol/ResourceManager.h>
#include <ewol/debug.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/renderer/ResourceManager.h>
namespace ewol

View File

@ -0,0 +1,255 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <tinyXML/tinyxml.h>
#include <ewol/debug.h>
#include <ewol/compositing/Image.h>
#include <ewol/config.h>
ewol::Image::Image(etk::UString imageName) :
m_position(0.0, 0.0, 0.0),
m_clippingPosStart(0.0, 0.0, 0.0),
m_clippingPosStop(0.0, 0.0, 0.0),
m_clippingEnable(false),
m_color(draw::color::black),
m_axes(0.0, 0.0, 0.0),
m_angle(0.0),
m_GLprogram(NULL),
m_GLPosition(-1),
m_GLMatrix(-1),
m_GLColor(-1),
m_GLtexture(-1),
m_GLtexID(-1),
m_resource(NULL)
{
SetSource(imageName);
LoadProgram();
}
ewol::Image::~Image(void)
{
if (NULL != m_resource) {
ewol::resource::Release(m_resource);
m_resource = NULL;
}
ewol::resource::Release(m_GLprogram);
}
void ewol::Image::LoadProgram(void)
{
etk::UString tmpString("DATA:textured3D.prog");
// get the shader resource :
m_GLPosition = 0;
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
m_GLColor = m_GLprogram->GetAttribute("EW_color");
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
}
}
void ewol::Image::Draw(void)
{
if (m_coord.Size()<=0) {
//EWOL_WARNING("Nothink to draw...");
return;
}
if (m_resource == NULL) {
EWOL_WARNING("no resources ...");
return;
}
if (m_GLprogram==NULL) {
EWOL_ERROR("No shader ...");
return;
}
// set Matrix : translation/positionMatrix
etk::Matrix4 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());
// position :
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_coord[0]);
// Texture :
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]);
// Request the draw od the elements :
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
m_GLprogram->UnUse();
}
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 :
m_position = etk::Vector3D<float>(0.0, 0.0, 0.0);
m_clippingPosStart = etk::Vector3D<float>(0.0, 0.0, 0.0);
m_clippingPosStop = etk::Vector3D<float>(0.0, 0.0, 0.0);
m_clippingEnable = false;
m_color = draw::color::black;
m_axes = etk::Vector3D<float>(0.0, 0.0, 0.0);
m_angle = 0.0;
}
etk::Vector3D<float> ewol::Image::GetPos(void)
{
return m_position;
}
void ewol::Image::SetPos(etk::Vector3D<float> pos)
{
m_position = pos;
}
void ewol::Image::SetRelPos(etk::Vector3D<float> pos)
{
m_position += pos;
}
void ewol::Image::SetColor(draw::Color color)
{
m_color = color;
}
void ewol::Image::SetClippingWidth(etk::Vector3D<float> pos, etk::Vector3D<float> width)
{
SetClipping(pos, pos+width);
}
void ewol::Image::SetClipping(etk::Vector3D<float> pos, etk::Vector3D<float> posEnd)
{
// note the internal system all time request to have a bounding all time in the same order
if (pos.x <= posEnd.x) {
m_clippingPosStart.x = pos.x;
m_clippingPosStop.x = posEnd.x;
} else {
m_clippingPosStart.x = posEnd.x;
m_clippingPosStop.x = pos.x;
}
if (pos.y <= posEnd.y) {
m_clippingPosStart.y = pos.y;
m_clippingPosStop.y = posEnd.y;
} else {
m_clippingPosStart.y = posEnd.y;
m_clippingPosStop.y = pos.y;
}
if (pos.z <= posEnd.z) {
m_clippingPosStart.z = pos.z;
m_clippingPosStop.z = posEnd.z;
} else {
m_clippingPosStart.z = posEnd.z;
m_clippingPosStop.z = pos.z;
}
m_clippingEnable = true;
}
void ewol::Image::SetClippingMode(bool newMode)
{
m_clippingEnable = newMode;
}
void ewol::Image::SetAngle(etk::Vector3D<float> axes, float angle)
{
m_axes = axes;
m_angle = angle;
if( m_axes.x == 0
&& m_axes.y == 0
&& m_axes.z == 0) {
m_angle = 0;
}
}
void ewol::Image::Print(etk::Vector2D<int32_t> size)
{
etk::Vector3D<float> point;
etk::Vector2D<float> tex;
point.z = 0;
tex.x = 0;
tex.y = 1;
point.x = m_position.x;
point.y = m_position.y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
tex.x = 1;
tex.y = 1;
point.x = m_position.x + size.x;
point.y = m_position.y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
tex.x = 1;
tex.y = 0;
point.x = m_position.x + size.x;
point.y = 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.x = 0;
tex.y = 0;
point.x = m_position.x;
point.y = m_position.y + size.y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
tex.x = 0;
tex.y = 1;
point.x = m_position.x;
point.y = m_position.y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(m_color);
}
void ewol::Image::PrintPart(etk::Vector2D<int32_t> size,
etk::Vector2D<float> sourcePosStart,
etk::Vector2D<float> sourcePosStop)
{
}
void ewol::Image::SetSource(etk::UString newFile)
{
Clear();
// remove old one
if (NULL != m_resource) {
ewol::resource::Release(m_resource);
m_resource = NULL;
}
etk::Vector2D<int32_t> size(-1,-1);
// link to new One
if (false == ewol::resource::Keep(newFile, m_resource, size)) {
EWOL_ERROR("Can not get Image resource");
}
}

View File

@ -9,23 +9,122 @@
#ifndef __EWOL_IMAGE_H__
#define __EWOL_IMAGE_H__
#include <ewol/debug.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/renderer/ResourceManager.h>
namespace ewol
{
class Image : public ewol::Compositing
{
protected:
etk::Vector2D<int32_t> m_size;
private:
private:
etk::Vector3D<float> m_position; //!< The current position to draw
etk::Vector3D<float> m_clippingPosStart; //!< Clipping start position
etk::Vector3D<float> m_clippingPosStop; //!< Clipping stop position
bool m_clippingEnable; //!< true if the clipping must be activated
private:
draw::Color m_color; //!< The text foreground color
etk::Vector3D<float> m_axes; //!< Rotation axes (instant)
float m_angle; //!< Angle to set at the axes
private:
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)
int32_t m_GLColor; //!< openGL id on the element (color buffer)
int32_t m_GLtexture; //!< openGL id on the element (Texture position)
int32_t m_GLtexID; //!< openGL id on the element (texture ID)
private:
ewol::TextureFile* m_resource; //!< texture resources
etk::Vector<etk::Vector3D<float> > m_coord; //!< internal coord of the object
etk::Vector<etk::Vector2D<float> > m_coordTex; //!< internal texture coordinate for every point
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
private:
/**
* @brief Load the openGL program and get all the ID needed
*/
void LoadProgram(void);
public:
Image(void);
/**
* @brief generic constructor
* @param[in] imageName Name of the file that might be loaded
*/
Image(etk::UString imageName);
/**
* @brief generic destructor
*/
~Image(void);
public:
/**
* @brief Draw All the refistered text in the current element on openGL
*/
void Draw(void);
/**
* @brief Clear alll tre registered element in the current element
*/
void Clear(void);
/**
* @brief Get the current display position (sometime needed in the gui control)
* @return the current position.
*/
etk::Vector3D<float> GetPos(void);
/**
* @brief Set position for the next text writen
* @param[in] pos Position of the text (in 3D)
*/
void SetPos(etk::Vector3D<float> pos);
/**
* @brief Set relative position for the next text writen
* @param[in] pos ofset apply of the text (in 3D)
*/
void SetRelPos(etk::Vector3D<float> pos);
void SetAngle(etk::Vector3D<float> angle);
void SetColor(etk::Color color);
void SetSize(etk::Vector2D<int32_t> size);
// TODO : ...
/**
* @brief Set the Color of the current foreground font
* @param[in] color Color to set on foreground (for next print)
*/
void SetColor(draw::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(etk::Vector3D<float> pos, etk::Vector3D<float> 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(etk::Vector3D<float> pos, etk::Vector3D<float> posEnd);
/**
* @brief Enable/Disable the clipping (without lose the current clipping position)
* @brief newMode The new status of the clipping
*/
void SetClippingMode(bool newMode);
/**
* @brief Set a unique rotation of this element (not set in the Rotate Generic system)
* @param[in] axes Rotation axes selection
* @param[in] angle Angle to set on this axes
*/
void SetAngle(etk::Vector3D<float> axes, float angle);
/**
* @brief Add a compleate of the image to display with the requested size
* @param[in] size Size of the output image
*/
void Print(etk::Vector2D<int32_t> size);
/**
* @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(etk::Vector2D<int32_t> size,
etk::Vector2D<float> sourcePosStart,
etk::Vector2D<float> sourcePosStop);
/**
* @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
*/
void SetSource(etk::UString newFile);
};
};

View File

@ -9,6 +9,10 @@
#ifndef __EWOL_MESH_H__
#define __EWOL_MESH_H__
#include <ewol/debug.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/renderer/ResourceManager.h>
namespace ewol
{
class Mesh : public ewol::Compositing

View File

@ -9,6 +9,10 @@
#ifndef __EWOL_SPRITE_H__
#define __EWOL_SPRITE_H__
#include <ewol/debug.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/renderer/ResourceManager.h>
namespace ewol
{
class Sprite : public ewol::Compositing

View File

@ -6,23 +6,11 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <ewol/compositing/Text.h>
#include <ewol/font/FontManager.h>
#include <tinyXML/tinyxml.h>
/*
// curent Drawing position
etk::Vector3D<float> m_position; //!< the next position to draw the text
// clipping section
etk::Vector3D<float> m_clippingPosition;
etk::Vector3D<float> m_clippingSize;
bool m_clippingEnable;
// Basic color
etk::Color m_color;
*/
#include <ewol/debug.h>
#include <ewol/compositing/Text.h>
#include <ewol/config.h>
ewol::Text::Text(void) :
m_position(0.0, 0.0, 0.0),
@ -46,7 +34,7 @@ ewol::Text::Text(void) :
m_GLtexID(-1),
m_font(NULL)
{
SetFont(ewol::font::GetDefaultFont(), ewol::font::GetDefaultSize());
SetFont("", -1);
LoadProgram();
}
@ -263,7 +251,7 @@ void ewol::Text::SetClippingMode(bool newMode)
void ewol::Text::SetFontSize(int32_t fontSize)
{
// get old size
etk::UString fontName = ewol::font::GetDefaultFont();
etk::UString fontName = "";
if (NULL != m_font) {
fontName = m_font->GetName();
}
@ -274,7 +262,7 @@ void ewol::Text::SetFontSize(int32_t fontSize)
void ewol::Text::SetFontName(etk::UString fontName)
{
// get old size
int32_t fontSize = ewol::font::GetDefaultSize();
int32_t fontSize = -1;
if (NULL != m_font) {
fontSize = m_font->GetFontSize();
}
@ -284,16 +272,22 @@ void ewol::Text::SetFontName(etk::UString fontName)
void ewol::Text::SetFont(etk::UString fontName, int32_t fontSize)
{
Clear();
// remove old one
if (NULL != m_font) {
ewol::resource::Release(m_font);
m_font = NULL;
}
etk::UString tmpName = fontName;
tmpName += ":";
tmpName += fontSize;
if (fontSize <= 0) {
fontSize = ewol::config::FontGetDefaultSize();
}
if (fontName == "") {
fontName = ewol::config::FontGetDefaultName();
}
fontName += ":";
fontName += fontSize;
// link to new One
if (false == ewol::resource::Keep(tmpName, m_font)) {
if (false == ewol::resource::Keep(fontName, m_font)) {
EWOL_ERROR("Can not get font resource");
}
}
@ -629,10 +623,10 @@ void ewol::Text::Print(const uniChar_t charcode)
float dyC = m_position.y + myGlyph->m_bearing.y + fontHeigh - fontSize;
float dyD = dyC - myGlyph->m_sizeTexture.y;
float tuA = myGlyph->m_texturePosStart.u;
float tuB = myGlyph->m_texturePosStop.u;
float tvC = myGlyph->m_texturePosStart.v;
float tvD = myGlyph->m_texturePosStop.v;
float tuA = myGlyph->m_texturePosStart.x;
float tuB = myGlyph->m_texturePosStop.x;
float tvC = myGlyph->m_texturePosStart.y;
float tvD = myGlyph->m_texturePosStop.y;
// Clipping and drawing area
@ -710,16 +704,16 @@ void ewol::Text::Print(const uniChar_t charcode)
* | |
* 3------2
*/
texCoord_ts texturePos[4];
texturePos[0].u = tuA+m_mode;
texturePos[1].u = tuB+m_mode;
texturePos[2].u = tuB+m_mode;
texturePos[3].u = tuA+m_mode;
etk::Vector2D<float> texturePos[4];
texturePos[0].x = tuA+m_mode;
texturePos[1].x = tuB+m_mode;
texturePos[2].x = tuB+m_mode;
texturePos[3].x = tuA+m_mode;
texturePos[0].v = tvC;
texturePos[1].v = tvC;
texturePos[2].v = tvD;
texturePos[3].v = tvD;
texturePos[0].y = tvC;
texturePos[1].y = tvC;
texturePos[2].y = tvD;
texturePos[3].y = tvD;
// NOTE : Android does not support the Quads elements ...
/* Step 1 :

View File

@ -9,11 +9,12 @@
#ifndef __EWOL_TEXT_H__
#define __EWOL_TEXT_H__
#include <ewol/Debug.h>
#include <draw/Color.h>
#include <ewol/debug.h>
#include <ewol/compositing/Compositing.h>
#include <ewol/compositing/Drawing.h>
#include <draw/Color.h>
#include <ewol/ResourceManager.h>
#include <ewol/renderer/ResourceManager.h>
namespace ewol
{
@ -75,7 +76,7 @@ namespace ewol
ewol::TexturedFont* m_font; //!< Font resources
private: // Text
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::Vector<etk::Vector2D<float> > m_coordTex; //!< internal texture coordinate for every point
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
private:
/**

View File

@ -7,6 +7,7 @@
*/
#include <ewol/config.h>
#include <ewol/renderer/resources/FontFreeType.h>
#undef __class__
#define __class__ "ewol::config"

View File

@ -9,6 +9,9 @@
#ifndef __EWOL_CONFIG_H__
#define __EWOL_CONFIG_H__
#include <etk/types.h>
#include <etk/UString.h>
namespace ewol
{
namespace config

View File

@ -6,6 +6,6 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <ewol/debug.h>
const char * ewolLibName = "ewol ";

View File

@ -8,7 +8,7 @@
#include <ewol/eObject/EObject.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/Debug.h>
#include <ewol/debug.h>
#undef __class__

View File

@ -7,7 +7,8 @@
*/
#include <ewol/eObject/EObjectManager.h>
#include <ewol/os/eSystem.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/ewol.h>
#undef __class__
#define __class__ "EObjectManager"

View File

@ -16,11 +16,10 @@
#define __class__ "ewol"
int32_t ewol::Run(int32_t argc, const char* argv[]);
int32_t ewol::Run(int32_t argc, const char* argv[])
{
// call standard RUN ...
return guiInterface::main(argc, argv);
}
@ -49,12 +48,12 @@ void ewol::WindowsPopUpAdd(ewol::Widget * tmpWidget)
}
}
void ewol::ChangeSize(etkVector2D<int32_t> size)
void ewol::ChangeSize(etk::Vector2D<int32_t> size)
{
guiInterface::ChangeSize(size);
}
void ewol::ChangePos(etkVector2D<int32_t> pos)
void ewol::ChangePos(etk::Vector2D<int32_t> pos)
{
guiInterface::ChangePos(pos);
}

View File

@ -47,13 +47,13 @@ namespace ewol
* @note work only on computer
* @param[in] size The new windows size
*/
void ChangeSize(etkVector2D<int32_t> size);
void ChangeSize(etk::Vector2D<int32_t> size);
/**
* @brief Change the windows curent position
* @note work only on computer
* @param[in] pos The new windows position
*/
void ChangePos(etkVector2D<int32_t> pos);
void ChangePos(etk::Vector2D<int32_t> pos);
/**
* @brief Generate the action of redrawing all the display.
*/

View File

@ -8,7 +8,7 @@
#include <ewol/key.h>
static const char* statusDescriptionString[statusCount] = {
static const char* statusDescriptionString[ewol::keyEvent::statusCount+1] = {
"statusUnknow",
"statusDown",
"statusMove",
@ -21,13 +21,13 @@ static const char* statusDescriptionString[statusCount] = {
"statusEnter",
"statusLeave",
"statusAbort",
"statusTransfer",
"statusTransfert",
"statusCount"
};
etk::CCout& ewol::keyEvent::operator <<(etk::CCout &os, const ewol::keyEvent::status_te obj)
{
if (obj>=0 && obj <statusCount) {
if (obj>=0 && obj <ewol::keyEvent::statusCount) {
os << statusDescriptionString[obj];
} else {
os << "[ERROR]";
@ -36,7 +36,7 @@ etk::CCout& ewol::keyEvent::operator <<(etk::CCout &os, const ewol::keyEvent::st
}
static const char* keyboardDescriptionString[keyboardCount] = {
static const char* keyboardDescriptionString[ewol::keyEvent::keyboardCount+1] = {
"keyboardUnknow",
"keyboardLeft",
"keyboardRight",
@ -78,7 +78,7 @@ static const char* keyboardDescriptionString[keyboardCount] = {
etk::CCout& ewol::keyEvent::operator <<(etk::CCout &os, const ewol::keyEvent::keyboard_te obj)
{
if (obj>=0 && obj <keyboardCount) {
if (obj>=0 && obj <ewol::keyEvent::keyboardCount) {
os << keyboardDescriptionString[obj];
} else {
os << "[ERROR]";
@ -87,7 +87,7 @@ etk::CCout& ewol::keyEvent::operator <<(etk::CCout &os, const ewol::keyEvent::ke
}
static const char* typeDescriptionString[typeCount] = {
static const char* typeDescriptionString[ewol::keyEvent::typeCount+1] = {
"typeUnknow",
"typeMouse",
"typeFinger",
@ -97,7 +97,7 @@ static const char* typeDescriptionString[typeCount] = {
etk::CCout& ewol::keyEvent::operator <<(etk::CCout &os, const ewol::keyEvent::type_te obj)
{
if (obj>=0 && obj < typeCount) {
if (obj>=0 && obj < ewol::keyEvent::typeCount) {
os << typeDescriptionString[obj];
} else {
os << "[ERROR]";

View File

@ -46,7 +46,7 @@ namespace ewol
statusEnter,
statusLeave,
statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
statusTransfer, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
statusCount, // number max of imput possible
} status_te;
/**
@ -101,6 +101,19 @@ namespace ewol
etk::CCout& operator <<(etk::CCout &os, const ewol::keyEvent::keyboard_te obj);
};
class SpecialKey {
public:
unsigned capLock : 1;
unsigned shift : 1;
unsigned ctrl : 1;
unsigned meta : 1;
unsigned alt : 1;
unsigned altGr : 1;
unsigned verNum : 1;
unsigned insert : 1;
};
};

View File

@ -6,10 +6,10 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/ResourceManager.h>
#include <ewol/font/FontFreeType.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/FontFreeType.h>
// Specific for the resource :
@ -197,10 +197,10 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::TexturedFont*& object)
}
bool ewol::resource::Keep(etk::UString& filename, ewol::Font*& object)
bool ewol::resource::Keep(etk::UString& filename, ewol::FontBase*& object)
{
EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\"");
object = static_cast<ewol::Font*>(LocalKeep(filename));
object = static_cast<ewol::FontBase*>(LocalKeep(filename));
if (NULL != object) {
return true;
}
@ -233,7 +233,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
{
EWOL_VERBOSE("KEEP : Shader : file : \"" << filename << "\"");
EWOL_VERBOSE("KEEP : ShSimpleader : file : \"" << filename << "\"");
object = static_cast<ewol::Shader*>(LocalKeep(filename));
if (NULL != object) {
return true;
@ -248,23 +248,6 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
return true;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::DistantFieldFont*& object)
{
EWOL_VERBOSE("KEEP : DistanceFieldFont : file : \"" << filename << "\"");
object = static_cast<ewol::DistantFieldFont*>(LocalKeep(filename));
if (NULL != object) {
return true;
}
// need to crate a new one ...
object = new ewol::DistantFieldFont(filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : " << filename);
return false;
}
LocalAdd(object);
return true;
}
bool ewol::resource::Keep(ewol::Texture*& object)
{
// this element create a new one every time ....
@ -345,15 +328,15 @@ bool ewol::resource::Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& o
return true;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::SimpleConfigFile*& object)
bool ewol::resource::Keep(etk::UString& filename, ewol::ConfigFile*& object)
{
EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\"");
object = static_cast<ewol::SimpleConfigFile*>(LocalKeep(filename));
object = static_cast<ewol::ConfigFile*>(LocalKeep(filename));
if (NULL != object) {
return true;
}
// this element create a new one every time ....
object = new ewol::SimpleConfigFile(filename);
object = new ewol::ConfigFile(filename);
if (NULL == object) {
EWOL_ERROR("allocation error of a resource : ??Mesh.obj??");
return false;
@ -404,7 +387,7 @@ void ewol::resource::Release(ewol::TexturedFont*& object)
Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Font*& object)
void ewol::resource::Release(ewol::FontBase*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
@ -422,12 +405,6 @@ void ewol::resource::Release(ewol::Shader*& object)
Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::DistantFieldFont*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);
object = NULL;
}
void ewol::resource::Release(ewol::Texture*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
@ -448,7 +425,7 @@ void ewol::resource::Release(ewol::MeshObj*& object)
object = NULL;
}
void ewol::resource::Release(ewol::SimpleConfigFile*& object)
void ewol::resource::Release(ewol::ConfigFile*& object)
{
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
Release(object2);

View File

@ -9,19 +9,17 @@
#ifndef __RESOURCES_MANAGER_H__
#define __RESOURCES_MANAGER_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
#include <ewol/openGL/Shader.h>
#include <ewol/openGL/Program.h>
#include <ewol/openGL/VirtualBufferObject.h>
#include <ewol/SimpleConfigFile.h>
#include <ewol/font/Font.h>
#include <ewol/font/TexturedFont.h>
#include <ewol/font/DistantFieldFont.h>
#include <ewol/texture/Texture.h>
#include <ewol/texture/TextureFile.h>
#include <ewol/Mesh/MeshObj.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/Resource.h>
#include <ewol/renderer/resources/Shader.h>
#include <ewol/renderer/resources/Program.h>
#include <ewol/renderer/resources/VirtualBufferObject.h>
#include <ewol/renderer/resources/ConfigFile.h>
#include <ewol/renderer/resources/TexturedFont.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/Image.h>
#include <ewol/renderer/resources/MeshObj.h>
namespace ewol
{
@ -40,27 +38,25 @@ namespace ewol
// return the type of the resource ...
bool Keep(etk::UString& filename, ewol::TexturedFont*& object);
bool Keep(etk::UString& filename, ewol::Font*& object);
bool Keep(etk::UString& filename, ewol::FontBase*& object);
bool Keep(etk::UString& filename, ewol::Program*& object);
bool Keep(etk::UString& filename, ewol::Shader*& object);
bool Keep(etk::UString& filename, ewol::DistantFieldFont*& object);
bool Keep(ewol::Texture*& object); // no name needed here ...
bool Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D<int32_t> size);
bool Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& object);
bool Keep(etk::UString& filename, ewol::MeshObj*& object);
bool Keep(etk::UString& filename, ewol::SimpleConfigFile*& object);
bool Keep(etk::UString& filename, ewol::ConfigFile*& object);
void Release(ewol::Resource*& object);
void Release(ewol::TexturedFont*& object);
void Release(ewol::Font*& object);
void Release(ewol::FontBase*& object);
void Release(ewol::Program*& object);
void Release(ewol::Shader*& object);
void Release(ewol::DistantFieldFont*& object);
void Release(ewol::Texture*& object);
void Release(ewol::TextureFile*& object);
void Release(ewol::VirtualBufferObject*& object);
void Release(ewol::MeshObj*& object);
void Release(ewol::SimpleConfigFile*& object);
void Release(ewol::ConfigFile*& object);
}
};

View File

@ -6,9 +6,9 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <ewol/openGL/openGL.h>
#include <etk/Vector.h>
#include <ewol/debug.h>
#include <ewol/renderer/openGL.h>
etk::Vector<etk::Matrix4> l_matrixList;

View File

@ -9,6 +9,7 @@
#ifndef __OPEN_GL_H__
#define __OPEN_GL_H__
#include <etk/types.h>
#include <etk/math/Matrix4.h>
#ifdef __cplusplus

View File

@ -7,25 +7,30 @@
*/
#include <etk/Types.h>
#include <ewol/ewol.h>
#include <ewol/Debug.h>
#include <etk/types.h>
#include <etk/MessageFifo.h>
#include <ewol/os/eSystem.h>
#include <ewol/os/gui.h>
#include <ewol/ResourceManager.h>
#include <ewol/ewol.h>
#include <ewol/debug.h>
#include <ewol/config.h>
#include <ewol/eObject/EObject.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/ShortCutManager.h>
#include <ewol/os/eSystemInput.h>
#include <ewol/openGL/openGL.h>
#include <ewol/os/Fps.h>
#include <ewol/font/FontManager.h>
static ewol::Windows* windowsCurrent = NULL;
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/os/eSystemInput.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/os/Fps.h>
#include <ewol/widget/WidgetManager.h>
static ewol::Windows* windowsCurrent = NULL;
static etk::Vector2D<int32_t> windowsSize(320, 480);
static ewol::eSystemInput l_managementInput;
static ewol::eSystemInput l_managementInput;
@ -58,8 +63,9 @@ typedef struct {
int w;
int h;
} eventResize_ts;
typedef struct {
ewol::inputType_te type;
ewol::keyEvent::type_te type;
int pointerID;
bool state;
float x;
@ -81,7 +87,7 @@ typedef struct {
static etk::MessageFifo<eSystemMessage_ts> l_msgSystem;
extern ewol::specialKey_ts specialCurrentKey;
extern ewol::SpecialKey specialCurrentKey;
static bool requestEndProcessing = false;
@ -131,26 +137,27 @@ void ewolProcessEvents(void)
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
{
specialCurrentKey = data.keyboardKey.special;
// check main shortcut
if (false==ewol::shortCut::Process(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::EVENT_KB_MOVE_TYPE_NONE,
data.keyboardKey.isDown)) {
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::EVENT_KB_MOVE_TYPE_NONE,
data.keyboardKey.isDown)) {
// generate the direct event ...
if(true == data.keyboardKey.isDown) {
EWOL_VERBOSE("GUI PRESSED : \"" << data.keyboardKey.myChar << "\"");
tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_DOWN, data.keyboardKey.myChar);
} else {
EWOL_VERBOSE("GUI Release : \"" << data.keyboardKey.myChar << "\"");
tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_UP, data.keyboardKey.myChar);
if (NULL != windowsCurrent) {
if (false==windowsCurrent->OnEventShortCut(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::keyEvent::keyboardUnknow,
data.keyboardKey.isDown)) {
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::keyEvent::keyboardUnknow,
data.keyboardKey.isDown)) {
// generate the direct event ...
if(true == data.keyboardKey.isDown) {
EWOL_VERBOSE("GUI PRESSED : \"" << data.keyboardKey.myChar << "\"");
tmpWidget->OnEventKb(ewol::keyEvent::statusDown, data.keyboardKey.myChar);
} else {
EWOL_VERBOSE("GUI Release : \"" << data.keyboardKey.myChar << "\"");
tmpWidget->OnEventKb(ewol::keyEvent::statusUp, data.keyboardKey.myChar);
}
}
}
}
@ -160,24 +167,26 @@ void ewolProcessEvents(void)
case THREAD_KEYBORAD_MOVE:
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE");
// check main shortcut
if (false==ewol::shortCut::Process(data.keyboardKey.special,
0,
data.keyboardMove.move,
data.keyboardKey.isDown)) {
specialCurrentKey = data.keyboardMove.special;
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::EVENT_KB_MOVE_TYPE_NONE,
data.keyboardKey.isDown)) {
// generate the direct event ...
if(true == data.keyboardMove.isDown) {
tmpWidget->OnEventKbMove(ewol::EVENT_KB_TYPE_DOWN, data.keyboardMove.move);
} else {
tmpWidget->OnEventKbMove(ewol::EVENT_KB_TYPE_UP, data.keyboardMove.move);
if (NULL != windowsCurrent) {
if (false==windowsCurrent->OnEventShortCut(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::keyEvent::keyboardUnknow,
data.keyboardKey.isDown)) {
specialCurrentKey = data.keyboardMove.special;
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardKey.special,
data.keyboardKey.myChar,
ewol::keyEvent::keyboardUnknow,
data.keyboardKey.isDown)) {
// generate the direct event ...
if(true == data.keyboardMove.isDown) {
tmpWidget->OnEventKbMove(ewol::keyEvent::statusDown, data.keyboardMove.move);
} else {
tmpWidget->OnEventKbMove(ewol::keyEvent::statusUp, data.keyboardMove.move);
}
}
}
}
@ -266,8 +275,7 @@ void eSystem::Init(void)
l_managementInput.Reset();
ewol::resource::Init();
ewol::widgetManager::Init();
ewol::font::Init();
ewol::shortCut::Init();
ewol::config::Init();
isGlobalSystemInit = true;
// request the init of the application in the main context of openGL ...
RequestInit();
@ -291,12 +299,11 @@ void eSystem::UnInit(void)
isGlobalSystemInit = false;
requestEndProcessing = true;
// unset all windows
ewol::DisplayWindows(NULL);
ewol::WindowsSet(NULL);
// call application to uninit
APP_UnInit();
ewol::shortCut::UnInit();
ewol::widgetManager::UnInit();
ewol::font::UnInit();
ewol::config::UnInit();
ewol::EObjectMessageMultiCast::UnInit();
ewol::EObjectManager::UnInit();
ewol::resource::UnInit();
@ -345,7 +352,7 @@ void eSystem::SetInputMotion(int pointerID, float x, float y )
if (true == isGlobalSystemInit) {
eSystemMessage_ts data;
data.TypeMessage = THREAD_INPUT_MOTION;
data.input.type = ewol::INPUT_TYPE_FINGER;
data.input.type = ewol::keyEvent::typeFinger;
data.input.pointerID = pointerID;
data.input.x = x;
data.input.y = y;
@ -359,7 +366,7 @@ void eSystem::SetInputState(int pointerID, bool isUp, float x, float y )
if (true == isGlobalSystemInit) {
eSystemMessage_ts data;
data.TypeMessage = THREAD_INPUT_STATE;
data.input.type = ewol::INPUT_TYPE_FINGER;
data.input.type = ewol::keyEvent::typeFinger;
data.input.pointerID = pointerID;
data.input.state = isUp;
data.input.x = x;
@ -374,7 +381,7 @@ void eSystem::SetMouseMotion(int pointerID, float x, float y )
if (true == isGlobalSystemInit) {
eSystemMessage_ts data;
data.TypeMessage = THREAD_INPUT_MOTION;
data.input.type = ewol::INPUT_TYPE_MOUSE;
data.input.type = ewol::keyEvent::typeMouse;
data.input.pointerID = pointerID;
data.input.x = x;
data.input.y = y;
@ -388,7 +395,7 @@ void eSystem::SetMouseState(int pointerID, bool isUp, float x, float y )
if (true == isGlobalSystemInit) {
eSystemMessage_ts data;
data.TypeMessage = THREAD_INPUT_STATE;
data.input.type = ewol::INPUT_TYPE_MOUSE;
data.input.type = ewol::keyEvent::typeMouse;
data.input.pointerID = pointerID;
data.input.state = isUp;
data.input.x = x;

View File

@ -9,7 +9,10 @@
#ifndef __EWOL_SYSTEM_H__
#define __EWOL_SYSTEM_H__
#include <ewol/ewol.h>
#include <etk/types.h>
#include <ewol/key.h>
#include <ewol/clipBoard.h>
#include <ewol/widget/Windows.h>
namespace eSystem
{
@ -30,15 +33,15 @@ namespace eSystem
void SetMouseState(int pointerID, bool isUp, float x, float y);
typedef struct {
bool isDown;
uniChar_t myChar;
ewol::specialKey_ts special;
bool isDown;
uniChar_t myChar;
ewol::SpecialKey special;
} keyboardKey_ts;
typedef struct {
bool isDown;
ewol::eventKbMoveType_te move;
ewol::specialKey_ts special;
bool isDown;
ewol::keyEvent::keyboard_te move;
ewol::SpecialKey special;
} keyboardMove_ts;
void SetKeyboard(eSystem::keyboardKey_ts& keyInput);

View File

@ -6,23 +6,25 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/oObject/OObject.h>
#include <ewol/widget/Widget.h>
#include <ewol/widget/Windows.h>
#include <ewol/os/gui.h>
#include <ewol/Debug.h>
#include <etk/types.h>
#include <etk/UString.h>
#include <ewol/debug.h>
#include <ewol/ewol.h>
#include <ewol/eObject/EObject.h>
#include <ewol/eObject/EObjectManager.h>
#include <ewol/renderer/os/gui.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/renderer/os/eSystemInput.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/widget/Widget.h>
#include <ewol/widget/Windows.h>
#include <ewol/widget/WidgetManager.h>
#include <ewol/os/gui.h>
#include <ewol/ewol.h>
#include <ewol/texture/Texture.h>
#include <ewol/os/eSystem.h>
#include <ewol/os/eSystemInput.h>
#define EVENT_DEBUG EWOL_VERBOSE
@ -63,10 +65,14 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp
}
bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos)
bool ewol::eSystemInput::localEventInput(ewol::keyEvent::type_te type,
ewol::Widget* destWidget,
int32_t IdInput,
ewol::keyEvent::status_te typeEvent,
etk::Vector2D<float> pos)
{
if (NULL != destWidget) {
if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) {
if (type == ewol::keyEvent::typeMouse || type == ewol::keyEvent::typeFinger) {
return destWidget->OnEventInput(type, IdInput, typeEvent, pos);
} else {
return false;
@ -87,22 +93,22 @@ void ewol::eSystemInput::TransfertEvent(ewol::Widget* source, ewol::Widget* dest
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);
localEventInput(ewol::INPUT_TYPE_FINGER, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::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);
localEventInput(ewol::INPUT_TYPE_FINGER, m_eventInputSaved[iii].curentWidgetEvent, m_eventInputSaved[iii].destinationInputId, ewol::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);
localEventInput(ewol::INPUT_TYPE_MOUSE, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::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);
localEventInput(ewol::INPUT_TYPE_MOUSE, m_eventMouseSaved[iii].curentWidgetEvent, m_eventMouseSaved[iii].destinationInputId, ewol::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);
}
}
}
@ -153,9 +159,9 @@ ewol::eSystemInput::~eSystemInput(void)
}
int32_t ewol::eSystemInput::localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId)
int32_t ewol::eSystemInput::localGetDestinationId(ewol::keyEvent::type_te type, ewol::Widget* destWidget, int32_t realInputId)
{
if (type == ewol::INPUT_TYPE_FINGER) {
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) {
@ -172,15 +178,15 @@ int32_t ewol::eSystemInput::localGetDestinationId(ewol::inputType_te type, ewol:
}
// note if id<0 ==> the it was finger event ...
void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vector2D<float> pos)
void ewol::eSystemInput::Motion(ewol::keyEvent::type_te type, int pointerID, etk::Vector2D<float> pos)
{
// convert position in Open-GL coordonates ...
pos.y = ewol::GetCurrentHeight() - pos.y;
pos.y = pos.y;
InputPoperty_ts *eventTable = NULL;
if (type == ewol::INPUT_TYPE_MOUSE) {
if (type == ewol::keyEvent::typeMouse) {
eventTable = m_eventMouseSaved;
} else if (type == ewol::INPUT_TYPE_FINGER) {
} else if (type == ewol::keyEvent::typeFinger) {
eventTable = m_eventInputSaved;
} else {
EWOL_ERROR("Unknown type of event");
@ -193,7 +199,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec
}
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
// special case for the mouse event 0 that represent the hover event of the system :
if (type == ewol::INPUT_TYPE_MOUSE && pointerID == 0) {
if (type == ewol::keyEvent::typeMouse && pointerID == 0) {
// this event is all time on the good widget ... and manage the enter and leave ...
// NOTE : the "layer widget" force us to get the widget at the specific position all the time :
ewol::Widget* tmpWidget = NULL;
@ -209,7 +215,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec
eventTable[pointerID].isInside = false;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
}
if (false == eventTable[pointerID].isInside) {
// Set the element inside ...
@ -230,11 +236,11 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec
eventTable[pointerID].destinationInputId = 0;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, 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::EVENT_INPUT_TYPE_MOVE, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
} else if (true == eventTable[pointerID].isUsed) {
if (true == eventTable[pointerID].isInside) {
if( eventTable[pointerID].origin.x > pos.x
@ -244,7 +250,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec
eventTable[pointerID].isInside = false;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusLeave, pos);
}
} else {
if( ( eventTable[pointerID].origin.x <= pos.x
@ -254,25 +260,24 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vec
eventTable[pointerID].isInside = true;
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusEnter, 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::EVENT_INPUT_TYPE_MOVE, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusMove, pos);
}
}
void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D<float> pos)
void ewol::eSystemInput::State(ewol::keyEvent::type_te type, int pointerID, bool isDown, etk::Vector2D<float> pos)
{
// convert position in Open-GL coordonates ...
pos.y = ewol::GetCurrentHeight() - pos.y;
InputPoperty_ts *eventTable = NULL;
inputLimit_ts localLimit;
if (type == ewol::INPUT_TYPE_MOUSE) {
if (type == ewol::keyEvent::typeMouse) {
eventTable = m_eventMouseSaved;
localLimit = m_eventMouseLimit;
} else if (type == ewol::INPUT_TYPE_FINGER) {
} else if (type == ewol::keyEvent::typeFinger) {
eventTable = m_eventInputSaved;
localLimit = m_eventInputLimit;
} else {
@ -305,7 +310,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
// generate DOWN Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::keyEvent::statusDown, pos);
} else {
// Mark it used :
eventTable[pointerID].isUsed = true;
@ -331,7 +336,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
// generate DOWN Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, 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);
@ -346,7 +351,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
// generate UP Event
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
eventTable[pointerID].posEvent = pos;
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::keyEvent::statusUp, pos);
// generate event (single)
if( abs(eventTable[pointerID].downStart.x - pos.x) < localLimit.DpiOffset
&& abs(eventTable[pointerID].downStart.y - pos.y) < localLimit.DpiOffset ){
@ -369,7 +374,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
localEventInput(type,
eventTable[pointerID].curentWidgetEvent,
eventTable[pointerID].destinationInputId,
(ewol::eventInputType_te)(ewol::EVENT_INPUT_TYPE_SINGLE + eventTable[pointerID].nbClickEvent-1),
(ewol::keyEvent::status_te)(ewol::keyEvent::statusSingle + eventTable[pointerID].nbClickEvent-1),
pos);
if( eventTable[pointerID].nbClickEvent >= nbClickMax) {
eventTable[pointerID].nbClickEvent = 0;
@ -379,7 +384,7 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
}
}
// specific for tuch event
if (type == ewol::INPUT_TYPE_FINGER) {
if (type == ewol::keyEvent::typeFinger) {
CleanElement(eventTable, pointerID);
}
}

View File

@ -16,17 +16,17 @@ namespace ewol
// internal structure
typedef struct {
bool isUsed;
int32_t destinationInputId;
int64_t lastTimeEvent;
ewol::Widget* curentWidgetEvent;
bool isUsed;
int32_t destinationInputId;
int64_t lastTimeEvent;
ewol::Widget* curentWidgetEvent;
etk::Vector2D<float> origin;
etk::Vector2D<float> size;
etk::Vector2D<float> downStart;
etk::Vector2D<float> posEvent;
bool isDown;
bool isInside;
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
bool isDown;
bool isInside;
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
} InputPoperty_ts;
typedef struct {
@ -46,23 +46,30 @@ namespace ewol
InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT];
void CleanElement(InputPoperty_ts *eventTable, int32_t idInput);
/**
* @brief generate the event on the destinated widger
* @param[in] type Type of the event that might be sended
* @brief generate the event on the destinated widget.
* @param[in] type Type of the event that might be sended.
* @param[in] destWidget Pointer on the requested widget that element might be sended
* @param[in] IdInput Id of the event (PC : [0..9] and touch : [1..9])
* @param[in] typeEvent type of the eventg generated
* @param[in] pos position of the event
* @return true if event has been greped
*/
bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos);
bool localEventInput(ewol::keyEvent::type_te type,
ewol::Widget* destWidget,
int32_t IdInput,
ewol::keyEvent::status_te typeEvent,
etk::Vector2D<float> pos);
/**
* @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 (IHM is not the same
* This function find the next input id unused on the specifiic widget
* ==> 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
* @return the ewol input id
*/
int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId);
int32_t localGetDestinationId(ewol::keyEvent::type_te type,
ewol::Widget* destWidget,
int32_t realInputId);
public:
eSystemInput(void);
~eSystemInput(void);
@ -70,8 +77,8 @@ namespace ewol
void SetDpi(int32_t newDPI);
// note if id<0 ==> the it was finger event ...
void Motion(ewol::inputType_te type, int pointerID, etk::Vector2D<float> pos );
void State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D<float> pos);
void Motion(ewol::keyEvent::type_te type, int pointerID, etk::Vector2D<float> pos );
void State(ewol::keyEvent::type_te type, int pointerID, bool isDown, etk::Vector2D<float> pos);
/**
* @brief Inform object that an other object is removed ...

View File

@ -27,6 +27,7 @@ static jmethodID javaClassActivityEntryPoint__CPP_OrientationChange = 0;
// generic classes
static jclass javaDefaultClassString = 0; // default string class
static int32_t m_currentHeight = 0;
static JavaVM* g_JavaVM = NULL;
@ -369,22 +370,22 @@ extern "C"
* ********************************************************************************************** */
void Java_org_ewol_interfaceJNI_IOInputEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
eSystem::SetInputMotion(pointerID+1, x, y);
eSystem::SetInputMotion(pointerID+1, x, m_currentHeight-y);
}
void Java_org_ewol_interfaceJNI_IOInputEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{
eSystem::SetInputState(pointerID+1, isUp, x, y);
eSystem::SetInputState(pointerID+1, isUp, x, m_currentHeight-y);
}
void Java_org_ewol_interfaceJNI_IOMouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
eSystem::SetMouseMotion(pointerID+1, x, y);
eSystem::SetMouseMotion(pointerID+1, x, m_currentHeight-y);
}
void Java_org_ewol_interfaceJNI_IOMouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{
eSystem::SetMouseState(pointerID+1, isUp, x, y);
eSystem::SetMouseState(pointerID+1, isUp, x, m_currentHeight-y);
}
void Java_org_ewol_interfaceJNI_IOUnknowEvent( JNIEnv* env, jobject thiz, jint pointerID)
@ -454,6 +455,7 @@ extern "C"
void Java_org_ewol_interfaceJNI_RenderResize( JNIEnv* env, jobject thiz, jint w, jint h )
{
m_currentHeight = h;
eSystem::Resize(w, h);
}

View File

@ -23,6 +23,9 @@
#include <sys/time.h>
int32_t m_currentHeight = 0;
int64_t guiInterface::GetTime(void)
{
struct timeval now;
@ -33,7 +36,7 @@ int64_t guiInterface::GetTime(void)
bool inputIsPressed[20];
static ewol::specialKey_ts guiKeyBoardMode;
static ewol::SpecialKey guiKeyBoardMode;
void guiInterface::SetTitle(etk::UString& title)
{
@ -72,7 +75,7 @@ void guiInterface::ChangeSize(etk::Vector2D<int32_t> size)
int title_size = GetSystemMetrics(SM_CYCAPTION);
size.x += border_thickness*2;
size.y += border_thickness*2 + title_size;
//m_currentHeight = size.y;
// TODO : Later
}
@ -247,7 +250,8 @@ int Windows_Run(void)
NULL, NULL, hInstance, NULL );
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION);
eSystem::Resize(800-2*border_thickness, 600-2*border_thickness -title_size);
m_currentHeight = 600-2*border_thickness -title_size;
eSystem::Resize(800-2*border_thickness, m_currentHeight);
// enable OpenGL for the window
EnableOpenGL( hWnd, &hDC, &hRC );
@ -329,7 +333,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// 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);
eSystem::Resize(tmpVal->cx-2*border_thickness, tmpVal->cy - 2*border_thickness - title_size);
m_currentHeight = tmpVal->cy - 2*border_thickness - title_size;
eSystem::Resize(tmpVal->cx-2*border_thickness, m_currentHeight);
}
}
return 0;
@ -463,7 +468,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_LBUTTONDOWN:
mouseButtonId = 1;
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y);
return 0;
@ -473,7 +478,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MBUTTONDOWN:
mouseButtonId = 2;
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y);
return 0;
@ -483,7 +488,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONDOWN:
mouseButtonId = 3;
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y);
return 0;
@ -497,7 +502,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
mouseButtonId = 5;
}
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
eSystem::SetMouseState(mouseButtonId, true, (float)pos.x, (float)pos.y);
eSystem::SetMouseState(mouseButtonId, false, (float)pos.x, (float)pos.y);
return 0;
@ -505,7 +510,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEHOVER:
case WM_MOUSEMOVE:
pos.x = GET_X_LPARAM(lParam);
pos.y = GET_Y_LPARAM(lParam);
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
if (true == inputIsPressed[iii]) {
EWOL_VERBOSE("Windows event: bt=" << iii << " " << message << " = \"WM_MOUSEMOVE\" " << pos );

View File

@ -69,7 +69,7 @@ static int attrListDbl[] = {
None
};
static ewol::specialKey_ts guiKeyBoardMode;
static ewol::SpecialKey guiKeyBoardMode;
extern "C" {
@ -99,6 +99,7 @@ int32_t m_originX = 0;
int32_t m_originY = 0;
int32_t m_cursorEventX = 0;
int32_t m_cursorEventY = 0;
int32_t m_currentHeight = 0;
XVisualInfo * m_visual = NULL;
bool m_doubleBuffered = 0;
bool m_run = 0;
@ -119,6 +120,9 @@ static Atom XAtomeEWOL = 0;
static Atom XAtomeDeleteWindows = 0;
bool CreateX11Context(void)
{
#ifdef DEBUG_X11_EVENT
@ -676,6 +680,7 @@ void X11_Run(void)
#endif
m_originX = event.xconfigure.x;
m_originY = event.xconfigure.y;
m_currentHeight = event.xconfigure.height;
eSystem::Resize(event.xconfigure.width, event.xconfigure.height);
break;
case ButtonPress:
@ -687,25 +692,25 @@ void X11_Run(void)
if (event.xbutton.button < NB_MAX_INPUT) {
inputIsPressed[event.xbutton.button] = true;
}
eSystem::SetMouseState(event.xbutton.button, true, (float)event.xbutton.x, (float)event.xbutton.y);
eSystem::SetMouseState(event.xbutton.button, true, (float)event.xbutton.x, (float)m_cursorEventY);
break;
case ButtonRelease:
#ifdef DEBUG_X11_EVENT
EWOL_INFO("X11 event ButtonRelease");
#endif
m_cursorEventX = event.xbutton.x;
m_cursorEventY = event.xbutton.y;
m_cursorEventY = (m_currentHeight-event.xbutton.y);
if (event.xbutton.button < NB_MAX_INPUT) {
inputIsPressed[event.xbutton.button] = false;
}
eSystem::SetMouseState(event.xbutton.button, false, (float)event.xbutton.x, (float)event.xbutton.y);
eSystem::SetMouseState(event.xbutton.button, false, (float)event.xbutton.x, (float)m_cursorEventY);
break;
case EnterNotify:
#ifdef DEBUG_X11_EVENT
EWOL_INFO("X11 event EnterNotify");
#endif
m_cursorEventX = event.xcrossing.x;
m_cursorEventY = event.xcrossing.y;
m_cursorEventY = (m_currentHeight-event.xcrossing.y);
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (float)event.xcrossing.x << "," << (float)event.xcrossing.y << ")");
//gui_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (float)event.xcrossing.x, (float)event.xcrossing.y);
break;
@ -714,7 +719,7 @@ void X11_Run(void)
EWOL_INFO("X11 event LeaveNotify");
#endif
m_cursorEventX = event.xcrossing.x;
m_cursorEventY = event.xcrossing.y;
m_cursorEventY = (m_currentHeight-event.xcrossing.y);
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (float)event.xcrossing.x << "," << (float)event.xcrossing.y << ")");
break;
case MotionNotify:
@ -722,20 +727,20 @@ void X11_Run(void)
EWOL_INFO("X11 event MotionNotify");
#endif
m_cursorEventX = event.xmotion.x;
m_cursorEventY = event.xmotion.y;
m_cursorEventY = (m_currentHeight-event.xmotion.y);
{
// For compatibility of the Android system :
bool findOne = false;
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
if (true == inputIsPressed[iii]) {
EWOL_VERBOSE("X11 event: bt=" << iii << " " << event.type << " = \"MotionNotify\" (" << (float)event.xmotion.x << "," << (float)event.xmotion.y << ")");
eSystem::SetMouseMotion(iii, (float)event.xmotion.x, (float)event.xmotion.y);
EWOL_VERBOSE("X11 event: bt=" << iii << " " << event.type << " = \"MotionNotify\" (" << (float)event.xmotion.x << "," << (float)(m_currentHeight-event.xmotion.y) << ")");
eSystem::SetMouseMotion(iii, (float)event.xmotion.x, (float)(m_currentHeight-event.xmotion.y));
findOne = true;
}
}
if (false == findOne) {
EWOL_VERBOSE("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << (float)event.xmotion.x << "," << (float)event.xmotion.y << ")");
eSystem::SetMouseMotion(0, (float)event.xmotion.x, (float)event.xmotion.y);
EWOL_VERBOSE("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << (float)event.xmotion.x << "," << (float)(m_currentHeight-event.xmotion.y) << ")");
eSystem::SetMouseMotion(0, (float)event.xmotion.x, (float)(m_currentHeight-event.xmotion.y));
}
}
break;
@ -1073,6 +1078,7 @@ void guiInterface::ChangeSize(etk::Vector2D<int32_t> size)
#ifdef DEBUG_X11_EVENT
EWOL_INFO("X11: ChangeSize");
#endif
m_currentHeight = size.y;
XResizeWindow(m_display, WindowHandle, size.x, size.y);
}
@ -1103,7 +1109,7 @@ void guiInterface::GetAbsPos(etk::Vector2D<int32_t>& pos)
* @param std IO
* @return std IO
*/
int main(int argc, char *argv[])
int guiInterface::main(int argc, const char *argv[])
{
ewol::CmdLine::Clean();
for( int32_t i=1 ; i<argc; i++) {

View File

@ -9,16 +9,17 @@
#ifndef __GUI_INTERFACE_H__
#define __GUI_INTERFACE_H__
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/UString.h>
#include <ewol/widget/Windows.h>
#include <ewol/ewol.h>
#include <ewol/ClipBoard.h>
#include <ewol/clipBoard.h>
#include <etk/os/FSNode.h>
namespace guiInterface
{
int main(int argc, const char *argv[]);
/**
* @brief Get the curent time in micro-second
* @param ---

View File

@ -1,56 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __SIMPLE_CONFIG_FILE_H__
#define __SIMPLE_CONFIG_FILE_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
namespace ewol
{
class SimpleConfigElement
{
public:
etk::UString m_paramName;
private:
etk::UString m_value;
int32_t m_valueInt;
float m_valuefloat;
public:
SimpleConfigElement(etk::UString name) :
m_paramName(name),
m_value(""),
m_valueInt(0),
m_valuefloat(0.0) { };
~SimpleConfigElement(void) { };
void Parse(etk::UString value);
int32_t GetInteger(void) { return m_valueInt; };
float GetFloat(void) { return m_valuefloat; };
etk::UString& GetString(void) { return m_value; };
};
class SimpleConfigFile : public ewol::Resource
{
private:
etk::Vector<ewol::SimpleConfigElement*> m_list;
public:
SimpleConfigFile(etk::UString& filename);
virtual ~SimpleConfigFile(void);
const char* GetType(void) { return "ewol::SimpleConfigFile"; };
void Reload(void);
int32_t Request(etk::UString paramName);
int32_t GetInteger(int32_t id) { return m_list[id]->GetInteger(); };
float GetFloat(int32_t id) { return m_list[id]->GetFloat(); };
etk::UString& GetString(int32_t id) { return m_list[id]->GetString(); };
};
};
#endif

View File

@ -6,10 +6,9 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/os/FSNode.h>
#include <ewol/Debug.h>
#include <ewol/SimpleConfigFile.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/ConfigFile.h>
void ewol::SimpleConfigElement::Parse(etk::UString value)
@ -23,7 +22,7 @@ void ewol::SimpleConfigElement::Parse(etk::UString value)
ewol::SimpleConfigFile::SimpleConfigFile(etk::UString& filename):
ewol::ConfigFile::ConfigFile(etk::UString& filename):
ewol::Resource(filename)
{
EWOL_DEBUG("SFP : load \"" << filename << "\"");
@ -31,7 +30,7 @@ ewol::SimpleConfigFile::SimpleConfigFile(etk::UString& filename):
}
ewol::SimpleConfigFile::~SimpleConfigFile(void)
ewol::ConfigFile::~ConfigFile(void)
{
// remove all element
for (int32_t iii=0; iii<m_list.Size(); iii++){
@ -44,7 +43,7 @@ ewol::SimpleConfigFile::~SimpleConfigFile(void)
}
void ewol::SimpleConfigFile::Reload(void)
void ewol::ConfigFile::Reload(void)
{
// Reset all parameters
for (int32_t iii=0; iii<m_list.Size(); iii++){
@ -129,7 +128,7 @@ void ewol::SimpleConfigFile::Reload(void)
}
int32_t ewol::SimpleConfigFile::Request(etk::UString paramName)
int32_t ewol::ConfigFile::Request(etk::UString paramName)
{
// check if the parameters existed :
for (int32_t iii=0; iii<m_list.Size(); iii++){

View File

@ -0,0 +1,58 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __SIMPLE_CONFIG_FILE_H__
#define __SIMPLE_CONFIG_FILE_H__
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/Resource.h>
namespace ewol
{
class SimpleConfigElement
{
public:
etk::UString m_paramName;
private:
etk::UString m_value;
int32_t m_valueInt;
float m_valuefloat;
public:
SimpleConfigElement(etk::UString name) :
m_paramName(name),
m_value(""),
m_valueInt(0),
m_valuefloat(0.0) { };
~SimpleConfigElement(void) { };
void Parse(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
{
private:
etk::Vector<ewol::SimpleConfigElement*> m_list;
public:
ConfigFile(etk::UString& filename);
virtual ~ConfigFile(void);
const char* GetType(void) { return "ewol::SimpleConfigFile"; };
void Reload(void);
int32_t Request(etk::UString paramName);
int32_t GetInteger(int32_t id) { return m_list[id]->GetInteger(); };
float GetFloat(int32_t id) { return m_list[id]->GetFloat(); };
etk::UString& GetString(int32_t id) { return m_list[id]->GetString(); };
};
};
#endif

View File

@ -6,18 +6,17 @@
* @license BSD v3 (see license file)
*/
#include <ewol/font/Font.h>
#include <ewol/texture/Texture.h>
#include <etk/unicode.h>
#include <etk/Vector.h>
#include <ewol/font/FontFreeType.h>
#include <etk/os/FSNode.h>
#include <ewol/openGL/openGL.h>
extern "C" {
#include <freetype/ft2build.h>
}
#include FT_FREETYPE_H
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/FontFreeType.h>
#include <ewol/renderer/resources/font/FontBase.h>
#undef __class__
#define __class__ "ewol::FontFreeType"
@ -49,7 +48,7 @@ void ewol::FreeTypeUnInit(void)
ewol::FontFreeType::FontFreeType(etk::UString fontName) :
Font(fontName)
FontBase(fontName)
{
m_init = false;
m_FileBuffer = NULL;

View File

@ -9,7 +9,8 @@
#ifndef __EWOL_FONT_FREE_TYPE_H__
#define __EWOL_FONT_FREE_TYPE_H__
#include <ewol/font/Font.h>
#include <etk/types.h>
#include <ewol/renderer/resources/font/FontBase.h>
extern "C" {
#include <freetype/ft2build.h>
@ -19,7 +20,7 @@ extern "C" {
namespace ewol
{
// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
class FontFreeType : public ewol::Font
class FontFreeType : public ewol::FontBase
{
private:
FT_Byte * m_FileBuffer;

View File

@ -6,15 +6,19 @@
* @license BSD v3 (see license file)
*/
#include <ewol/ResourceManager.h>
#include <ewol/texture/TextureFile.h>
#include <ewol/texture/Texture.h>
#include <etk/types.h>
#include <etk/os/FSNode.h>
#include <ewol/texture/TextureBMP.h>
#include <parserSVG/parserSVG.h>
#include <ewol/texture/TexturePNG.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/Image.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/image/ImageBMP.h>
#include <ewol/renderer/resources/image/ImagePNG.h>
ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, etk::Vector2D<int32_t> size) :

View File

@ -9,10 +9,11 @@
#ifndef __EWOL_TEXTURE_FILE_H__
#define __EWOL_TEXTURE_FILE_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <draw/Image.h>
#include <ewol/texture/Texture.h>
#include <ewol/Resource.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/Resource.h>
namespace ewol
{

View File

@ -6,9 +6,9 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <ewol/Mesh/Mesh.h>
#include <ewol/ResourceManager.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/Mesh.h>
#include <ewol/renderer/ResourceManager.h>
ewol::Mesh::Mesh(etk::UString genName) :
@ -61,11 +61,11 @@ void ewol::Mesh::Draw(void)
m_GLprogram->Use();
// set Matrix : translation/positionMatrix
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
tmpMatrix = etk::matrix::Scale(100,100,100)
* etk::matrix::rotate(1,0,0,rotx)
* etk::matrix::rotate(0,1,0,roty)/*
* etk::matrix::Translate(0.01,0,0)
* etk::matrix::rotate(0,0,1,rotz)*/
tmpMatrix = etk::Matrix4::Scale(etk::Vector3D<float>(100,100,100) )
* etk::Matrix4::Rotate(etk::Vector3D<float>(1,0,0), rotx)
* etk::Matrix4::Rotate(etk::Vector3D<float>(0,1,0), roty)/*
* etk::Matrix4::Translate(etk::Vector3D<float>(0.01,0.0,0.0))
* etk::Matrix4::Rotate(etk::Vector3D<float>(0,0,1), rotz)*/
* tmpMatrix;
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
// TextureID

View File

@ -9,11 +9,11 @@
#ifndef __MESH_H__
#define __MESH_H__
#include <etk/Types.h>
#include <ewol/Resource.h>
#include <ewol/texture/TextureFile.h>
#include <ewol/openGL/Shader.h>
#include <ewol/openGL/Program.h>
#include <etk/types.h>
#include <ewol/renderer/resources/Resource.h>
#include <ewol/renderer/resources/Image.h>
#include <ewol/renderer/resources/Shader.h>
#include <ewol/renderer/resources/Program.h>
namespace ewol
{

View File

@ -6,11 +6,13 @@
* @license BSD v3 (see license file)
*/
#include <ewol/Debug.h>
#include <etk/types.h>
#include <etk/Vector.h>
#include <etk/os/FSNode.h>
#include <ewol/Mesh/MeshObj.h>
#include <ewol/ResourceManager.h>
#include <ewol/debug.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/MeshObj.h>
ewol::MeshObj::MeshObj(etk::UString _fileName) :

View File

@ -9,9 +9,9 @@
#ifndef __MESH_OBJ_H__
#define __MESH_OBJ_H__
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/UString.h>
#include <ewol/Mesh/Mesh.h>
#include <ewol/renderer/resources/Mesh.h>
namespace ewol
{

View File

@ -6,10 +6,10 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/openGL/Program.h>
#include <ewol/ResourceManager.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/Program.h>
#include <ewol/renderer/ResourceManager.h>
#include <etk/os/FSNode.h>
//#define LOCAL_DEBUG EWOL_VERBOSE

View File

@ -8,11 +8,12 @@
#ifndef __OPEN_GL__PROGRAM_H__
#define __OPEN_GL__PROGRAM_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
#include <ewol/openGL/openGL.h>
#include <ewol/openGL/Shader.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/resources/Resource.h>
#include <ewol/renderer/resources/Shader.h>
namespace ewol
{

View File

@ -6,13 +6,14 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/UString.h>
#include <ewol/Debug.h>
#ifndef __RESOURCES_H__
#define __RESOURCES_H__
#include <etk/types.h>
#include <etk/UString.h>
#include <ewol/debug.h>
#define MAX_RESOURCE_LEVEL (5)
namespace ewol

View File

@ -6,10 +6,10 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/os/FSNode.h>
#include <ewol/Debug.h>
#include <ewol/openGL/Shader.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/Shader.h>

View File

@ -8,10 +8,11 @@
#ifndef __OPEN_GL__SHADER_H__
#define __OPEN_GL__SHADER_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
#include <ewol/openGL/openGL.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/resources/Resource.h>
namespace ewol
{

View File

@ -6,10 +6,16 @@
* @license BSD v3 (see license file)
*/
#include <ewol/texture/Texture.h>
#include <ewol/openGL/openGL.h>
#include <etk/types.h>
#include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/Texture.h>
/**
* @brief get the next power 2 if the input

View File

@ -9,11 +9,11 @@
#ifndef __EWOL_TEXTURE_H__
#define __EWOL_TEXTURE_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <draw/Image.h>
#include <ewol/openGL/openGL.h>
#include <ewol/Resource.h>
#include <ewol/renderer/openGL.h>
#include <ewol/renderer/resources/Resource.h>
namespace ewol {
class Texture : public ewol::Resource {

View File

@ -6,12 +6,15 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <ewol/font/Font.h>
#include <ewol/font/TexturedFont.h>
#include <ewol/font/FontManager.h>
#include <etk/types.h>
#include <etk/os/FSNode.h>
#include <ewol/ResourceManager.h>
#include <ewol/config.h>
#include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/font/FontBase.h>
#include <ewol/renderer/resources/TexturedFont.h>
static int32_t nextP2(int32_t value)
@ -226,10 +229,10 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
// draw the glyph
m_font[iiiFontId]->DrawGlyph(m_data, m_size, glyphPosition, (m_listElement[iiiFontId])[iii], iiiFontId);
// set video position
(m_listElement[iiiFontId])[iii].m_texturePosStart.u = (float)(glyphPosition.x) / (float)textureWidth;
(m_listElement[iiiFontId])[iii].m_texturePosStart.v = (float)(glyphPosition.y) / (float)textureHeight;
(m_listElement[iiiFontId])[iii].m_texturePosStop.u = (float)(glyphPosition.x + (m_listElement[iiiFontId])[iii].m_sizeTexture.x) / (float)textureWidth;
(m_listElement[iiiFontId])[iii].m_texturePosStop.v = (float)(glyphPosition.y + (m_listElement[iiiFontId])[iii].m_sizeTexture.y) / (float)textureHeight;
(m_listElement[iiiFontId])[iii].m_texturePosStart.x = (float)(glyphPosition.x) / (float)textureWidth;
(m_listElement[iiiFontId])[iii].m_texturePosStart.y = (float)(glyphPosition.y) / (float)textureHeight;
(m_listElement[iiiFontId])[iii].m_texturePosStop.x = (float)(glyphPosition.x + (m_listElement[iiiFontId])[iii].m_sizeTexture.x) / (float)textureWidth;
(m_listElement[iiiFontId])[iii].m_texturePosStop.y = (float)(glyphPosition.y + (m_listElement[iiiFontId])[iii].m_sizeTexture.y) / (float)textureHeight;
// update the maximum of the line hight :
if (CurrentLineHigh<(m_listElement[iiiFontId])[iii].m_sizeTexture.y) {
@ -285,246 +288,6 @@ bool ewol::TexturedFont::HasName(etk::UString& fileName)
}
int32_t ewol::TexturedFont::Draw(etk::Vector2D<float> textPos,
const etk::UString& unicodeString,
etk::Vector<etk::Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex,
etk::Vector<int32_t> & vectDisplayMode,
bool hasClipping,
clipping_ts& clipping,
ewol::font::mode_te displayMode)
{
float totalSize = 0;
etk::Vector2D<float> tmpPos = textPos;
uniChar_t unicodeCharPrevious = 0;
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
int32_t ret;
ret = Draw(tmpPos, unicodeString[iii], coord, coordTex, vectDisplayMode, hasClipping, clipping, displayMode, unicodeCharPrevious);
unicodeCharPrevious = unicodeString[iii];
tmpPos.x += ret;
totalSize += ret;
}
return totalSize;
}
int32_t ewol::TexturedFont::Draw(etk::Vector2D<float> textPos,
const uniChar_t unicodeChar,
etk::Vector<etk::Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex,
etk::Vector<int32_t> & vectDisplayMode,
bool hasClipping,
clipping_ts& clipping,
ewol::font::mode_te displayMode,
const uniChar_t unicodeCharPrevious)
{
float posDrawX = textPos.x;
int32_t charIndex;
if (unicodeChar < 0x20) {
charIndex = 0;
} else if (unicodeChar < 0x80) {
charIndex = unicodeChar - 0x1F;
} else {
charIndex = 0;
for (int32_t iii=0x80-0x20; iii < m_listElement[0].Size(); iii++) {
if ((m_listElement[displayMode])[iii].m_UVal == unicodeChar) {
charIndex = iii;
break;
}
}
}
float kerningOffset = (m_listElement[displayMode])[charIndex].KerningGet(unicodeCharPrevious);
/*
if (kerningOffset != 0) {
EWOL_DEBUG("Kerning between : '" << (char)unicodeCharPrevious << "'&'" << (char)(m_listElement[displayMode])[charIndex].m_UVal << "' value : " << kerningOffset);
}
*/
// 0x01 == 0x20 == ' ';
if (unicodeChar != 0x01) {
/* Bitmap position
* xA xB
* yC *------*
* | |
* | |
* yD *------*
*/
float dxA = posDrawX + (m_listElement[displayMode])[charIndex].m_bearing.x + kerningOffset;
float dxB = dxA + (m_listElement[displayMode])[charIndex].m_sizeTexture.x;
float dyC = textPos.y + (m_listElement[displayMode])[charIndex].m_bearing.y + m_height[displayMode] - m_size;
float dyD = dyC - (m_listElement[displayMode])[charIndex].m_sizeTexture.y;
float tuA = (m_listElement[displayMode])[charIndex].m_texturePosStart.u;
float tuB = (m_listElement[displayMode])[charIndex].m_texturePosStop.u;
float tvC = (m_listElement[displayMode])[charIndex].m_texturePosStart.v;
float tvD = (m_listElement[displayMode])[charIndex].m_texturePosStop.v;
// Clipping and drawing area
if( true == hasClipping
&& ( dxB < clipping.x
|| dxA > clipping.x + clipping.w) ) {
// Nothing to diplay ...
} else {
if (true == hasClipping) {
// generata positions...
float TexSizeX = tuB - tuA;
if (dxA < clipping.x) {
// clip display
float drawSize = clipping.x - dxA;
// Update element start display
dxA = clipping.x;
float addElement = TexSizeX * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x;
// update texture start X Pos
tuA += addElement;
}
if (dxB > clipping.x + clipping.w) {
// clip display
float drawSize = dxB - (clipping.x + clipping.w);
// Update element start display
dxB = clipping.x + clipping.w;
float addElement = TexSizeX * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x;
// update texture start X Pos
tuB -= addElement;
}
float TexSizeY = tvD - tvC;
if (dyC < clipping.y) {
// clip display
float drawSize = clipping.y - dyC;
// Update element start display
dyC = clipping.y;
float addElement = TexSizeY * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x;
// update texture start X Pos
tvC += addElement;
}
if (dyD > clipping.y + clipping.h) {
// clip display
float drawSize = dyD - (clipping.y + clipping.h);
// Update element start display
dyD = clipping.y + clipping.h;
float addElement = TexSizeX * drawSize / (float)(m_listElement[displayMode])[charIndex].m_sizeTexture.x;
// update texture start X Pos
tvD -= addElement;
}
}
if( dxB <= dxA
|| dyD >= dyC) {
// nothing to do ...
} else {
/* Bitmap position
* 0------1
* | |
* | |
* 3------2
*/
etk::Vector2D<int32_t> bitmapDrawPos[4];
bitmapDrawPos[0].x = (int32_t)dxA;
bitmapDrawPos[1].x = (int32_t)dxB;
bitmapDrawPos[2].x = (int32_t)dxB;
bitmapDrawPos[3].x = (int32_t)dxA;
bitmapDrawPos[0].y = (int32_t)dyC;
bitmapDrawPos[1].y = (int32_t)dyC;
bitmapDrawPos[2].y = (int32_t)dyD;
bitmapDrawPos[3].y = (int32_t)dyD;
/* texture Position :
* 0------1
* | |
* | |
* 3------2
*/
texCoord_ts texturePos[4];
texturePos[0].u = tuA+displayMode;
texturePos[1].u = tuB+displayMode;
texturePos[2].u = tuB+displayMode;
texturePos[3].u = tuA+displayMode;
texturePos[0].v = tvC;
texturePos[1].v = tvC;
texturePos[2].v = tvD;
texturePos[3].v = tvD;
// NOTE : Android does not support the Quads elements ...
/* Step 1 :
* ********
* ******
* ****
* **
*
*/
// set texture coordonates :
coordTex.PushBack(texturePos[0]);
coordTex.PushBack(texturePos[1]);
coordTex.PushBack(texturePos[2]);
// set display positions :
coord.PushBack(bitmapDrawPos[0]);
coord.PushBack(bitmapDrawPos[1]);
coord.PushBack(bitmapDrawPos[2]);
/* Step 2 :
*
* **
* ****
* ******
* ********
*/
// set texture coordonates :
coordTex.PushBack(texturePos[0]);
coordTex.PushBack(texturePos[2]);
coordTex.PushBack(texturePos[3]);
// set display positions :
coord.PushBack(bitmapDrawPos[0]);
coord.PushBack(bitmapDrawPos[2]);
coord.PushBack(bitmapDrawPos[3]);
}
}
}
posDrawX += (m_listElement[displayMode])[charIndex].m_advance.x + kerningOffset;
int32_t sizeOut = posDrawX - textPos.x;
textPos.x = posDrawX;
return sizeOut;
}
etk::Vector2D<float> ewol::TexturedFont::GetSize(const etk::UString & unicodeString, const ewol::font::mode_te displayMode)
{
etk::Vector2D<float> outputSize(0,m_height[0]);
uniChar_t unicodeCharPrevious = 0;
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
etk::Vector2D<float> tmpp = GetSize(unicodeString[iii], unicodeCharPrevious, displayMode);
unicodeCharPrevious = unicodeString[iii];
outputSize.x += tmpp.x;
}
return outputSize;
}
etk::Vector2D<float> ewol::TexturedFont::GetSize(const uniChar_t unicodeChar,
const uniChar_t unicodeCharPrevious,
const ewol::font::mode_te displayMode)
{
etk::Vector2D<float> outputSize(0,m_height[0]);
int32_t charIndex;
if (unicodeChar >= 0x80) {
charIndex = 0;
} else if (unicodeChar < 0x20) {
charIndex = 0;
} else if (unicodeChar < 0x80) {
charIndex = unicodeChar - 0x1F;
} else {
for (int32_t iii=0x80-0x20; iii < m_listElement[0].Size(); iii++) {
if ((m_listElement[0])[iii].m_UVal == unicodeChar) {
charIndex = iii;
break;
}
}
// TODO : Update if possible the mapping
charIndex = 0;
}
float kerningOffset = (m_listElement[displayMode])[charIndex].KerningGet(unicodeCharPrevious);
outputSize.x = (m_listElement[0])[charIndex].m_advance.x + kerningOffset;
return outputSize;
}
int32_t ewol::TexturedFont::GetIndex(const uniChar_t charcode, const ewol::font::mode_te displayMode) const
{
if (charcode < 0x20) {

View File

@ -9,9 +9,9 @@
#ifndef __EWOL_TEXTURED_FONT_H__
#define __EWOL_TEXTURED_FONT_H__
#include <ewol/font/Font.h>
#include <ewol/texture/Texture.h>
#include <ewol/Resource.h>
#include <ewol/renderer/resources/font/FontBase.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/Resource.h>
namespace ewol
{
@ -33,7 +33,7 @@ namespace ewol
// specific element to have the the know if the specify element is known...
// ==> otherwise I can just generate italic ...
// ==> Bold is a little more complicated (maybe with the bordersize)
ewol::Font* m_font[4];
ewol::FontBase* m_font[4];
ewol::font::mode_te m_modeWraping[4]; //!< This is a wrapping mode to prevent the fact that no font is define for a specific mode
public:
etk::Vector<GlyphProperty> m_listElement[4];
@ -47,49 +47,6 @@ namespace ewol
virtual bool HasName(etk::UString& fileName);
const char* GetType(void) { return "ewol::TexturedFont"; };
int32_t getFontSize(void) { return m_size; };
// TODO : Remove : DEPRECATED ...
int32_t Draw(etk::Vector2D<float> textPos,
const etk::UString& unicodeString,
etk::Vector<etk::Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex,
etk::Vector<int32_t> & vectDisplayMode,
bool hasClipping,
clipping_ts& clipping,
ewol::font::mode_te displayMode);
// TODO : Remove : DEPRECATED ...
int32_t Draw(etk::Vector2D<float> textPos,
const uniChar_t unicodeChar,
etk::Vector<etk::Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex,
etk::Vector<int32_t> & vectDisplayMode,
bool hasClipping,
clipping_ts& clipping,
ewol::font::mode_te displayMode,
const uniChar_t unicodeCharPrevious = 0);
// TODO : Remove : DEPRECATED ...
/**
* @brief Get the size of the specified String
* @param[in] unicodeString The string that we might calculate the display size
* @param[in] displayMode Mode to display the currrent font
* @return Dimention of the string use
*/
etk::Vector2D<float> GetSize(const etk::UString & unicodeString,
const ewol::font::mode_te displayMode = ewol::font::Regular);
// TODO : Remove : DEPRECATED ...
/**
* @brief Get the size of the specified unicode value
* @param[in] unicodeChar the char that might be displayed
* @param[in] unicodeCharPrevious Previous char of this One ==> 0 no previous char
* @param[in] displayMode Mode to display the currrent font
* @return Dimention of the font use
*/
etk::Vector2D<float> GetSize(const uniChar_t unicodeChar,
const uniChar_t unicodeCharPrevious = 0,
const ewol::font::mode_te displayMode = ewol::font::Regular);
/**
* @brief Get the display height of this font
* @param[in] displayMode Mode to display the currrent font

View File

@ -6,9 +6,9 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/openGL/VirtualBufferObject.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/VirtualBufferObject.h>

View File

@ -8,10 +8,11 @@
#ifndef __OPEN_GL__VIRTUAL_BUFFER_OBJECT_H__
#define __OPEN_GL__VIRTUAL_BUFFER_OBJECT_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Resource.h>
#include <ewol/openGL/openGL.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <ewol/renderer/resources/Resource.h>
#include <ewol/renderer/openGL.h>
namespace ewol
{

View File

@ -9,23 +9,23 @@
#ifndef __EWOL_FONT_H__
#define __EWOL_FONT_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <draw/Image.h>
#include <ewol/texture/Texture.h>
#include <ewol/Resource.h>
#include <ewol/font/GlyphProperty.h>
#include <ewol/renderer/resources/Texture.h>
#include <ewol/renderer/resources/Resource.h>
#include <ewol/renderer/resources/font/GlyphProperty.h>
namespace ewol
{
class Font : public ewol::Resource
class FontBase : public ewol::Resource
{
protected:
public:
Font(etk::UString fontName) : ewol::Resource(fontName) {};
FontBase(etk::UString fontName) : ewol::Resource(fontName) {};
virtual ~Font(void) { };
virtual ~FontBase(void) { };
const char* GetType(void) { return "ewol::Font"; };

View File

@ -9,7 +9,7 @@
#ifndef __EWOL_FONT_GLYPH_PROPERTY_H__
#define __EWOL_FONT_GLYPH_PROPERTY_H__
#include <ewol/font/Kerning.h>
#include <ewol/renderer/resources/font/Kerning.h>
namespace ewol
@ -57,8 +57,8 @@ namespace ewol
etk::Vector2D<int32_t> m_sizeTexture; //!< size of the element to display
etk::Vector2D<int32_t> m_bearing; //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string)
etk::Vector2D<int32_t> m_advance; //!< space use in the display for this specific char
texCoord_ts m_texturePosStart; //!< Texture normalised position (START)
texCoord_ts m_texturePosStop; //!< Texture normalised position (STOP)
etk::Vector2D<float> m_texturePosStart; //!< Texture normalised position (START)
etk::Vector2D<float> m_texturePosStop; //!< Texture normalised position (STOP)
private:
etk::Vector<ewol::Kerning> m_kerning; //!< kerning values of link of all elements
public:

View File

@ -6,9 +6,9 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <draw/Image.h>
#include <ewol/texture/TextureBMP.h>
#include <ewol/renderer/resources/image/ImageBMP.h>
#include <etk/os/FSNode.h>
#pragma pack(push,1)

View File

@ -9,8 +9,8 @@
#ifndef __EWOL_TEXTURE_BITMAP_H__
#define __EWOL_TEXTURE_BITMAP_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <draw/Image.h>
#include <etk/os/FSNode.h>

View File

@ -6,9 +6,9 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <draw/Image.h>
#include <ewol/texture/TexturePNG.h>
#include <ewol/renderer/resources/image/ImagePNG.h>
#include <etk/os/FSNode.h>
#include <png/png.h>

View File

@ -9,8 +9,8 @@
#ifndef __EWOL_TEXTURE_PNG_H__
#define __EWOL_TEXTURE_PNG_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/types.h>
#include <ewol/debug.h>
#include <draw/Image.h>
#include <etk/os/FSNode.h>

View File

@ -1,70 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <ewol/texture/TextureSVG.h>
#include <etk/os/FSNode.h>
#undef __class__
#define __class__ "texture::TextureSVG"
ewol::texture::TextureSVG::TextureSVG(etk::UString & fileName, int32_t width, int32_t height) :
m_elementParsed(fileName)
{
m_loadOK = false;
if (false == m_elementParsed.IsLoadOk()) {
EWOL_ERROR("Error To load SVG file " << fileName );
} else {
m_elementParsed.GenerateAnImage(width, height);
m_loadOK = true;
}
if (width == -1) {
etk::Vector2D<float> elementSize = m_elementParsed.GetDefinedSize();
m_width = elementSize.x;
m_height = elementSize.y;
} else {
m_width = width;
m_height = height;
}
}
ewol::texture::TextureSVG::~TextureSVG(void)
{
}
bool ewol::texture::TextureSVG::LoadOK(void)
{
return m_loadOK;
}
int32_t ewol::texture::TextureSVG::Width(void)
{
return m_width;
}
int32_t ewol::texture::TextureSVG::Height(void)
{
return m_height;
}
uint8_t * ewol::texture::TextureSVG::Data(void)
{
return m_elementParsed.GetPointerOnData();
}
uint32_t ewol::texture::TextureSVG::DataSize(void)
{
return m_elementParsed.GetSizeOnData();
}
void ewol::texture::TextureSVG::Display(void)
{
EWOL_DEBUG("SVG Texture : (" << m_width << "," << m_height << ") loadedOK=" << m_loadOK);
}

View File

@ -1,42 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __EWOL_TEXTURE_SVG_H__
#define __EWOL_TEXTURE_SVG_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <parserSVG/parserSVG.h>
namespace ewol
{
namespace texture {
class TextureSVG
{
private:
svg::Parser m_elementParsed;
int32_t m_width;
int32_t m_height;
int32_t m_size;
uint8_t * m_data;
bool m_loadOK;
public:
TextureSVG(etk::UString & fileName, int32_t width, int32_t height);
~TextureSVG(void);
bool LoadOK(void);
int32_t Width(void);
int32_t Height(void);
uint8_t * Data(void);
uint32_t DataSize(void);
void Display(void);
};
};
};
#endif

View File

@ -304,7 +304,7 @@ void ewol::Widget::ShortCutClean(void)
}
bool ewol::Widget::OnEventShortCut(ewol::specialKey_ts& special, uniChar_t unicodeValue, ewol::eventKbMoveType_te kbMove, bool isDown)
bool ewol::Widget::OnEventShortCut(ewol::SpecialKey& special, uniChar_t unicodeValue, ewol::eventKbMoveType_te kbMove, bool isDown)
{
if (unicodeValue >= 'A' && unicodeValue <='Z') {
unicodeValue += 'a' - 'A';

View File

@ -29,23 +29,13 @@ namespace ewol {
etk::Vector2D<int32_t> m_size;
};
typedef struct {
bool capLock;
bool shift;
bool ctrl;
bool meta;
bool alt;
bool altGr;
bool verNum;
bool insert;
} specialKey_ts;
class EventShortCut {
public:
bool broadcastEvent; // if it is true, then the message is sent to all the system
const char * generateEventId; // Local generated event
etk::UString eventData; // data link with the event
ewol::specialKey_ts specialKey; // special board key
ewol::SpecialKey specialKey; // special board key
uniChar_t unicodeValue; // 0 if not used
ewol::keyEvent::keyboard_te keyboardMoveValue; // ewol::EVENT_KB_MOVE_TYPE_NONE if not used
EventShortCut(void) {
@ -404,7 +394,7 @@ namespace ewol {
* @return false if the event has not been used
* @note To prevent some error when you get an event get it if it is down and Up ... ==> like this it could not generate some ununderstanding error
*/
virtual bool OnEventShortCut(ewol::specialKey_ts& special, uniChar_t unicodeValue, ewol::keyEvent::keyboard_te kbMove, bool isDown);
virtual bool OnEventShortCut(ewol::SpecialKey& special, uniChar_t unicodeValue, ewol::keyEvent::keyboard_te kbMove, bool isDown);
// ----------------------------------------------------------------------------------------------------------------
// -- Drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
// ----------------------------------------------------------------------------------------------------------------

View File

@ -7,60 +7,40 @@ FILE_LIST:= ewol/ewol.cpp \
ewol/commandLine.cpp \
ewol/key.cpp
#PLOPPPPP = \
ewol/renderer/ResourceManager.cpp \
ewol/renderer/resources/SimpleConfigFile.cpp
#FILE_LIST+= ewol/openGL/openGL.cpp \
ewol/openGL/Shader.cpp \
ewol/openGL/Program.cpp \
ewol/openGL/VirtualBufferObject.cpp
# Gui interface
#FILE_LIST+= ewol/os/eSystem.cpp \
ewol/os/eSystemInput.cpp
# Basic Eobject of EWOL
#FILE_LIST+= ewol/eObject/EObject.cpp \
FILE_LIST+= ewol/eObject/EObject.cpp \
ewol/eObject/EObjectManager.cpp
# Game elements
#FILE_LIST+= ewol/game/GameElement.cpp \
ewol/game/GameElementLua.cpp \
ewol/game/SceneElement.cpp
#openGl Basic access abstraction (for the model matrix and include
FILE_LIST+= ewol/renderer/openGL.cpp
# Operating System interface
FILE_LIST+= ewol/renderer/os/eSystem.cpp \
ewol/renderer/os/eSystemInput.cpp
# renderer :
FILE_LIST+= ewol/renderer/resources/Shader.cpp \
ewol/renderer/resources/Program.cpp \
ewol/renderer/resources/VirtualBufferObject.cpp \
ewol/renderer/resources/ConfigFile.cpp \
ewol/renderer/resources/FontFreeType.cpp \
ewol/renderer/resources/TexturedFont.cpp \
ewol/renderer/resources/Mesh.cpp \
ewol/renderer/resources/MeshObj.cpp \
ewol/renderer/resources/Texture.cpp \
ewol/renderer/resources/Image.cpp \
ewol/renderer/resources/image/ImageBMP.cpp \
ewol/renderer/resources/image/ImagePNG.cpp \
ewol/renderer/ResourceManager.cpp
# Compositing
#FILE_LIST+= ewol/compositing/Compositing.cpp \
FILE_LIST+= ewol/compositing/Compositing.cpp \
ewol/compositing/Text.cpp \
ewol/compositing/Drawing.cpp
# Object abstraction for OpenGl
#FILE_LIST+= ewol/oObject/OObject.cpp \
ewol/oObject/2DTextColored.cpp \
ewol/oObject/2DTextShader.cpp \
ewol/oObject/2DColored.cpp \
ewol/oObject/2DTextured.cpp \
ewol/oObject/3DTextured.cpp \
ewol/oObject/Sprite.cpp
# texture management
#FILE_LIST+= ewol/texture/Texture.cpp \
ewol/texture/TextureFile.cpp \
ewol/texture/TextureBMP.cpp \
ewol/texture/TexturePNG.cpp \
ewol/texture/TextureSVG.cpp
# fonst system
#FILE_LIST+= ewol/font/FontManager.cpp \
ewol/font/FontFreeType.cpp \
ewol/font/TexturedFont.cpp \
ewol/font/DistantFieldFont.cpp
# Mesh management
#FILE_LIST+= ewol/Mesh/Mesh.cpp \
ewol/Mesh/MeshObj.cpp
ewol/compositing/Drawing.cpp \
ewol/compositing/Image.cpp \
ewol/compositing/Sprite.cpp \
ewol/compositing/Mesh.cpp
# all widgets