[DEV] set etk::Vector2D and new Matrix(n,m)
This commit is contained in:
parent
d57ac3b94f
commit
37bd7b152a
@ -1 +1 @@
|
||||
Subproject commit 18e51a5e97561222fd352db77cca65928c69e517
|
||||
Subproject commit 4c65a1049ab5f6d97f225ba44394c6b6444eddd7
|
@ -22,12 +22,12 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_DEBUG_H__
|
||||
#define __ETK_DEBUG_H__
|
||||
|
||||
#include <etk/Stream.h>
|
||||
#include <etk/Types.h>
|
||||
|
||||
#ifndef __ETK_DEBUG_H__
|
||||
#define __ETK_DEBUG_H__
|
||||
|
||||
// Log Message System For EDN
|
||||
void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName, const char* libName);
|
||||
void TOOLS_DisplayTime(void);
|
||||
|
@ -22,10 +22,11 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include "etk/Debug.h"
|
||||
|
||||
#ifndef __ETK_DEBUG_INTERNAL_H__
|
||||
#define __ETK_DEBUG_INTERNAL_H__
|
||||
|
||||
#include "etk/Debug.h"
|
||||
|
||||
extern const char * etkLibName;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Mutex.h
|
||||
* @file etk/os/Mutex.h
|
||||
* @brief Ewol Tool Kit : basic mutex system (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 15/08/2012
|
||||
@ -25,8 +25,8 @@
|
||||
#ifndef __ETK_MESSAGE_FIFO_H__
|
||||
#define __ETK_MESSAGE_FIFO_H__
|
||||
|
||||
#include <etk/Mutex.h>
|
||||
#include <etk/Semaphore.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
#include <etk/os/Semaphore.h>
|
||||
#include <etk/Vector.h>
|
||||
|
||||
namespace etk
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <etk/Memory.h>
|
||||
#include <etk/os/Memory.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/Vector.h>
|
||||
|
||||
|
@ -22,16 +22,29 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_STREAM_DEC_H__
|
||||
#define __ETK_STREAM_DEC_H__
|
||||
|
||||
namespace etk{
|
||||
typedef enum {
|
||||
LOG_LEVEL_NONE,
|
||||
LOG_LEVEL_CRITICAL,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARNING,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_VERBOSE
|
||||
} logLevel_te;
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <etk/Types.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
|
||||
#ifndef __ETK_STREAM_H__
|
||||
#define __ETK_STREAM_H__
|
||||
|
||||
//#include <cstdio>
|
||||
//#include <typeinfo>
|
||||
#include <string.h>
|
||||
#include <etk/Types.h>
|
||||
#include <etk/Mutex.h>
|
||||
|
||||
#if defined(__TARGET_OS__Android)
|
||||
# include <android/log.h>
|
||||
# define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "EWOL", __VA_ARGS__))
|
||||
@ -81,15 +94,6 @@ namespace etk{
|
||||
class CEndl{};
|
||||
class CHex{};
|
||||
class CStart{};
|
||||
typedef enum {
|
||||
LOG_LEVEL_NONE,
|
||||
LOG_LEVEL_CRITICAL,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARNING,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_VERBOSE
|
||||
} logLevel_te;
|
||||
class CCout{
|
||||
private:
|
||||
bool hex;
|
||||
|
@ -82,4 +82,4 @@ typedef struct {
|
||||
|
||||
#endif
|
||||
|
||||
#include <etk/TypesCoordonate.h>
|
||||
#include <etk/math/math.h>
|
||||
|
@ -1,342 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/TypesCoordonate.h
|
||||
* @brief Ewol Tool Kit : generique coordonate type abstraction for openGl
|
||||
* @author Edouard DUPIN
|
||||
* @date 07/06/2012
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_TYPES_COORDONATES_H__
|
||||
#define __ETK_TYPES_COORDONATES_H__
|
||||
|
||||
|
||||
template <typename T> class Vector2D
|
||||
{
|
||||
public:
|
||||
T x;
|
||||
T y;
|
||||
public:
|
||||
/*****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
Vector2D(void) : x(0), y(0) { };
|
||||
Vector2D(double _x, double _y) : x(_x), y(_y) { };
|
||||
Vector2D(float _x, float _y) : x(_x), y(_y) { };
|
||||
Vector2D(int32_t _x, int32_t _y) : x(_x), y(_y) { };
|
||||
Vector2D(const Vector2D<double>& obj) : x((T)obj.x), y((T)obj.y) { };
|
||||
Vector2D(const Vector2D<float>& obj) : x((T)obj.x), y((T)obj.y) { };
|
||||
Vector2D(const Vector2D<int32_t>& obj) : x((T)obj.x), y((T)obj.y) { };
|
||||
~Vector2D(void) { };
|
||||
/*****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator= (const Vector2D<T>& obj ) {
|
||||
x = (T)obj.x;
|
||||
y = (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Vector2D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Vector2D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator+= (const Vector2D<T>& obj) {
|
||||
x += (T)obj.x;
|
||||
y += (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator+ (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x += (T)obj.x;
|
||||
tmpp.y += (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator-= (const Vector2D<T>& obj) {
|
||||
x -= (T)obj.x;
|
||||
y -= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator- (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x -= (T)obj.x;
|
||||
tmpp.y -= (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator/= (const Vector2D<T>& obj) {
|
||||
x /= (T)obj.x;
|
||||
y /= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator/ (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x /= (T)obj.x;
|
||||
tmpp.y /= (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator*= (const Vector2D<T>& obj) {
|
||||
x *= (T)obj.x;
|
||||
y *= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator* (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x *= (T)obj.x;
|
||||
tmpp.y *= (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
Vector2D<T>& operator++() // prefix
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
return *this;
|
||||
}
|
||||
Vector2D<T> operator++(int unused) // postfix
|
||||
{
|
||||
Vector2D<T> result = *this;
|
||||
++(*this);
|
||||
return result;
|
||||
}
|
||||
/*****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
Vector2D<T>& operator--() // prefix
|
||||
{
|
||||
--x;
|
||||
--y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector2D<T> operator--(int unused) // postfix
|
||||
{
|
||||
Vector2D<T> result = *this;
|
||||
--(*this);
|
||||
return result;
|
||||
}
|
||||
|
||||
T QuadDist(void)
|
||||
{
|
||||
return x*x + y*y;
|
||||
}
|
||||
|
||||
T Dist(void)
|
||||
{
|
||||
return sqrt(x*x + y*y);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:
|
||||
|
||||
template <typename T> class Vector3D
|
||||
{
|
||||
public:
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
public:
|
||||
/*****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
Vector3D(void) : x(0), y(0), z(0) { };
|
||||
Vector3D(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { };
|
||||
Vector3D(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { };
|
||||
Vector3D(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) { };
|
||||
Vector3D(const Vector3D<double>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
|
||||
Vector3D(const Vector3D<float>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
|
||||
Vector3D(const Vector3D<int32_t>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
|
||||
~Vector3D(void) { };
|
||||
/*****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator= (const Vector3D<T>& obj ) {
|
||||
x = (T)obj.x;
|
||||
y = (T)obj.y;
|
||||
z = (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Vector3D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Vector3D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator+= (const Vector3D<T>& obj) {
|
||||
x += (T)obj.x;
|
||||
y += (T)obj.y;
|
||||
z += (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator+ (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x += (T)obj.x;
|
||||
tmpp.y += (T)obj.y;
|
||||
tmpp.z += (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator-= (const Vector3D<T>& obj) {
|
||||
x -= (T)obj.x;
|
||||
y -= (T)obj.y;
|
||||
z -= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator- (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x -= (T)obj.x;
|
||||
tmpp.y -= (T)obj.y;
|
||||
tmpp.z -= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator/= (const Vector3D<T>& obj) {
|
||||
x /= (T)obj.x;
|
||||
y /= (T)obj.y;
|
||||
z /= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator/ (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x /= (T)obj.x;
|
||||
tmpp.y /= (T)obj.y;
|
||||
tmpp.z /= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator*= (const Vector3D<T>& obj) {
|
||||
x *= (T)obj.x;
|
||||
y *= (T)obj.y;
|
||||
z *= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator* (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x *= (T)obj.x;
|
||||
tmpp.y *= (T)obj.y;
|
||||
tmpp.z *= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
Vector3D<T>& operator++() // prefix
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
++z;
|
||||
return *this;
|
||||
}
|
||||
Vector3D<T> operator++(int unused) // postfix
|
||||
{
|
||||
Vector3D<T> result = *this;
|
||||
++(*this);
|
||||
return result;
|
||||
}
|
||||
/*****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
Vector3D<T>& operator--() // prefix
|
||||
{
|
||||
--x;
|
||||
--y;
|
||||
--z;
|
||||
return *this;
|
||||
}
|
||||
Vector3D<T> operator--(int unused) // postfix
|
||||
{
|
||||
Vector3D<T> result = *this;
|
||||
--(*this);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <etk/UString.h>
|
||||
#include <etk/Memory.h>
|
||||
#include <etk/os/Memory.h>
|
||||
#include <etk/unicode.h>
|
||||
|
||||
int32_t strlen(const uniChar_t * data)
|
||||
|
@ -25,6 +25,7 @@
|
||||
#ifndef __ETK_USTRING_H__
|
||||
#define __ETK_USTRING_H__
|
||||
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <etk/Stream.h>
|
||||
#include <etk/Vector.h>
|
||||
|
||||
|
@ -25,9 +25,9 @@
|
||||
#ifndef __ETK_VECTOR_H__
|
||||
#define __ETK_VECTOR_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <etk/Memory.h>
|
||||
#include <etk/Types.h>
|
||||
#include <etk/os/Memory.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "etk::Vector"
|
||||
@ -252,7 +252,7 @@ namespace etk
|
||||
/**
|
||||
* @brief Destructor of the current Class
|
||||
*/
|
||||
~Vector()
|
||||
~Vector(void)
|
||||
{
|
||||
if (NULL!=m_data) {
|
||||
delete [] m_data;
|
||||
@ -695,6 +695,55 @@ namespace etk
|
||||
// set the new allocation size
|
||||
m_allocated = requestSize;
|
||||
}
|
||||
public :
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Vector<MY_TYPE>& obj) const
|
||||
{
|
||||
// check if it was the same pointer
|
||||
if( this == &obj ) {
|
||||
return true;
|
||||
}
|
||||
// fiist step : check the size ...
|
||||
if (m_size!=obj.m_size) {
|
||||
return false;
|
||||
}
|
||||
if( NULL==m_data
|
||||
|| NULL==obj.m_data) {
|
||||
return false;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_size; iii++) {
|
||||
if (m_data[iii]!=obj.m_data[iii]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Vector<MY_TYPE>& obj) const
|
||||
{
|
||||
// check if it was the same pointer
|
||||
if( this == &obj ) {
|
||||
return false;
|
||||
}
|
||||
// fiist step : check the size ...
|
||||
if (m_size!=obj.m_size) {
|
||||
return true;
|
||||
}
|
||||
if( NULL==m_data
|
||||
|| NULL==obj.m_data) {
|
||||
return false;
|
||||
}
|
||||
for (int32_t iii=0; iii<m_size; iii++) {
|
||||
if (m_data[iii]!=obj.m_data[iii]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
326
Sources/libetk/etk/math/Matrix.h
Normal file
326
Sources/libetk/etk/math/Matrix.h
Normal file
@ -0,0 +1,326 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Matix.h
|
||||
* @brief Ewol Tool Kit : generique Matrix type (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 29/08/2012
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_TYPES_MATRIX_H__
|
||||
#define __ETK_TYPES_MATRIX_H__
|
||||
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/Vector.h>
|
||||
|
||||
namespace etk {
|
||||
template <typename T> class Matrix
|
||||
{
|
||||
private:
|
||||
Vector2D<int32_t> m_size;
|
||||
Vector<T> m_data;
|
||||
public:
|
||||
/*****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
Matrix(Vector2D<int32_t> size, T* defaultVal=NULL) :
|
||||
m_size(size),
|
||||
etk::Vector2D<T>(size.x* size.y)
|
||||
{
|
||||
if (NULL != defaultVal) {
|
||||
// copy all the elements
|
||||
for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) {
|
||||
// cast and set value :
|
||||
m_data[iii] = (T)defaultVal++;
|
||||
}
|
||||
} else {
|
||||
Clear();
|
||||
}
|
||||
};
|
||||
Matrix(int32_t width=0, int32_t heigh=0, T* defaultVal=NULL) :
|
||||
m_size(width, heigh),
|
||||
etk::Vector2D<T>(width*heigh)
|
||||
{
|
||||
if (NULL != defaultVal) {
|
||||
// copy all the elements
|
||||
for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) {
|
||||
// cast and set value :
|
||||
m_data[iii] = (T)defaultVal++;
|
||||
}
|
||||
} else {
|
||||
Clear();
|
||||
}
|
||||
};
|
||||
Matrix(const Matrix<double>& obj) :
|
||||
m_size(obj.m_size.x, obj.m_size.y),
|
||||
etk::Vector2D<T>(obj.m_size.x* obj.m_size.y)
|
||||
{
|
||||
// copy all the elements
|
||||
for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) {
|
||||
// cast and set value :
|
||||
m_data[iii] = (T)obj.m_data[iii];
|
||||
}
|
||||
};
|
||||
Matrix(const Matrix<float>& obj) :
|
||||
m_size(obj.m_size.x, obj.m_size.y),
|
||||
etk::Vector2D<T>(obj.m_size.x* obj.m_size.y)
|
||||
{
|
||||
// copy all the elements
|
||||
for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) {
|
||||
// cast and set value :
|
||||
m_data[iii] = (T)obj.m_data[iii];
|
||||
}
|
||||
};
|
||||
Matrix(const Matrix<int32_t>& obj) :
|
||||
m_size(obj.m_size.x, obj.m_size.y),
|
||||
etk::Vector2D<T>(obj.m_size.x* obj.m_size.y)
|
||||
{
|
||||
// copy all the elements
|
||||
for(int32_t iii=0; iii<=m_size.x*m_size.y; iii++) {
|
||||
// cast and set value :
|
||||
m_data[iii] = (T)obj.m_data[iii];
|
||||
}
|
||||
};
|
||||
/*****************************************************
|
||||
* Destructor
|
||||
*****************************************************/
|
||||
virtual ~Matrix(void) {};
|
||||
|
||||
/*****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const Matrix<T>& operator= (const Matrix<T>& obj )
|
||||
{
|
||||
// check if it was the same pointer
|
||||
if( this == &obj ) {
|
||||
return *this;
|
||||
}
|
||||
// copy data :
|
||||
m_size = obj.m_size;
|
||||
m_data = obj.m_data;
|
||||
return *this;
|
||||
};
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Matrix<T>& obj) const
|
||||
{
|
||||
return (m_data == obj.m_data);
|
||||
};
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Matrix<T>& obj) const
|
||||
{
|
||||
return (m_data != obj.m_data);
|
||||
};
|
||||
/*****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const Matrix<T>& operator+= (const Matrix<T>& obj)
|
||||
{
|
||||
if (m_size != obj.m_size) {
|
||||
//TK_CRITICAL("add 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix");
|
||||
etk::Matrix<T> tmpMatrix(etk_max(m_size.x,obj.m_size.x), etk_max(m_size.y,obj.m_size.y));
|
||||
for (int32_t jjj=0; jjj< m_size.y; jjj++) {
|
||||
T* tmpPointer = tmpMatrix[jjj];
|
||||
T* tmpPointerIn = (*this)[jjj];
|
||||
for (int32_t iii=0; iii< m_size.x; iii++) {
|
||||
tmpPointer[iii] = tmpPointerIn[iii];
|
||||
}
|
||||
}
|
||||
for (int32_t jjj=0; jjj< obj.m_size.y; jjj++) {
|
||||
T* tmpPointer = tmpMatrix[jjj];
|
||||
T* tmpPointerIn = obj[jjj];
|
||||
for (int32_t iii=0; iii< obj.m_size.x; iii++) {
|
||||
tmpPointer[iii] += tmpPointerIn[iii];
|
||||
}
|
||||
}
|
||||
// copy in local :
|
||||
m_size = tmpMatrix.m_size;
|
||||
m_data = tmpMatrix.m_data;
|
||||
} else {
|
||||
// copy data for the same size :
|
||||
for (int32_t iii=0; iii< m_data.Size(); iii++) {
|
||||
m_data[iii] += obj.m_data[iii];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
/*****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Matrix<T> operator+ (const Matrix<T>& obj) {
|
||||
Matrix<T> tmpp(*this);
|
||||
tmpp += obj;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const Matrix<T>& operator-= (const Matrix<T>& obj)
|
||||
{
|
||||
if (m_size != obj.m_size) {
|
||||
//TK_CRITICAL("less 2 Matrix with différent size ... ==> generate the max size of all the 2 matrix");
|
||||
etk::Matrix<T> tmpMatrix(etk_max(m_size.x,obj.m_size.x), etk_max(m_size.y,obj.m_size.y));
|
||||
for (int32_t jjj=0; jjj< m_size.y; jjj++) {
|
||||
T* tmpPointer = tmpMatrix[jjj];
|
||||
T* tmpPointerIn = (*this)[jjj];
|
||||
for (int32_t iii=0; iii< m_size.x; iii++) {
|
||||
tmpPointer[iii] = tmpPointerIn[iii];
|
||||
}
|
||||
}
|
||||
for (int32_t jjj=0; jjj< obj.m_size.y; jjj++) {
|
||||
T* tmpPointer = tmpMatrix[jjj];
|
||||
T* tmpPointerIn = obj[jjj];
|
||||
for (int32_t iii=0; iii< obj.m_size.x; iii++) {
|
||||
tmpPointer[iii] -= tmpPointerIn[iii];
|
||||
}
|
||||
}
|
||||
// copy in local :
|
||||
m_size = tmpMatrix.m_size;
|
||||
m_data = tmpMatrix.m_data;
|
||||
} else {
|
||||
// copy data for the same size :
|
||||
for (int32_t iii=0; iii< m_data.Size(); iii++) {
|
||||
m_data[iii] -= obj.m_data[iii];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
/*****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Matrix<T> operator- (const Matrix<T>& obj) {
|
||||
Matrix<T> tmpp(*this);
|
||||
tmpp += obj;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const Matrix<T>& operator*= (const Matrix<T>& obj)
|
||||
{
|
||||
if( m_size.x != obj.m_size.y
|
||||
|| m_size.y != obj.m_size.x) {
|
||||
//TK_CRITICAL("Error while multipliying 2 matrix with different size ==> impossible case ...");
|
||||
return *this;
|
||||
}
|
||||
etk::Matrix<T> tmpMatrix(m_size);
|
||||
for (int32_t jjj=0; jjj< obj.m_size.y; jjj++) {
|
||||
for (int32_t iii=0; iii< obj.m_size.x; iii++) {
|
||||
T tmpVal = 0;
|
||||
for (int32_t kkk=0; kkk< obj.m_size.x; kkk++) {
|
||||
tmpVal += (*this)[jjj][iii+kkk] * obj[jjj+kkk][iii];
|
||||
}
|
||||
tmpMatrix[jjj][iii] = tmpVal;
|
||||
}
|
||||
}
|
||||
// copy in local :
|
||||
m_data = tmpMatrix.m_data;
|
||||
return *this;
|
||||
};
|
||||
/*****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Matrix<T> operator* (const Matrix<T>& obj) {
|
||||
Matrix tmpp(*this);
|
||||
tmpp *= obj;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* [] operator
|
||||
*****************************************************/
|
||||
const T* operator[] (int32_t line) const {
|
||||
return &m_data[line*m_size.x];
|
||||
}
|
||||
T* operator[] (int32_t line) {
|
||||
return &m_data[line*m_size.x];
|
||||
}
|
||||
/**
|
||||
* @ brief Transpose Matrix
|
||||
* @ return the transpose matrix
|
||||
*/
|
||||
Matrix<T> Transpose(void)
|
||||
{
|
||||
// create a matrix with the inverted size
|
||||
Matrix<T> tmpMatrix(m_size.x, m_size.y);
|
||||
for (int32_t jjj=0; jjj< m_size.y; jjj++) {
|
||||
for (int32_t iii=0; iii< m_size.x; iii++) {
|
||||
tmpMatrix[jjj][iii] = (*this)[iii][jjj];
|
||||
}
|
||||
}
|
||||
return tmpMatrix;
|
||||
};
|
||||
/*****************************************************
|
||||
* other stupid action :
|
||||
*****************************************************/
|
||||
Vector2D<int32_t> Size(void) { return m_size; };
|
||||
void Clear(void)
|
||||
{
|
||||
// copy data for the same size :
|
||||
for (int32_t iii=0; iii< m_size.x*m_size.y; iii++) {
|
||||
m_data[iii] = (T)0;
|
||||
}
|
||||
};
|
||||
void Identity(void)
|
||||
{
|
||||
// copy data for the same size :
|
||||
for (int32_t iii=0; iii< etk_min(m_size.x, m_size.y); iii++) {
|
||||
(*this)[iii][iii] = (T)1;
|
||||
}
|
||||
};
|
||||
|
||||
void Set(int32_t iii, int32_t jjj, T value)
|
||||
{
|
||||
m_data[iii*m_size.x+jjj] = value;
|
||||
}
|
||||
T Get(int32_t iii, int32_t jjj)
|
||||
{
|
||||
return m_data[iii*m_size.x+jjj];
|
||||
}
|
||||
void Display(void)
|
||||
{
|
||||
/*
|
||||
TK_INFO("Matrix display : ");
|
||||
for (int32_t jjj=0; jjj< m_size.y; jjj++) {
|
||||
if (m_size.x == 0) {
|
||||
TK_INFO(" --- , ");
|
||||
} else if (m_size.x == 1) {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , ");
|
||||
} else if (m_size.x == 2) {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , ");
|
||||
} else if (m_size.x == 3) {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , ");
|
||||
} else if (m_size.x == 4) {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , ");
|
||||
} else if (m_size.x == 5) {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , " << (*this)[jjj][4] << " , ");
|
||||
} else if (m_size.x == 6) {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , " << (*this)[jjj][4] << " , " << (*this)[jjj][5] << " , ");
|
||||
} else {
|
||||
TK_INFO(" " << (*this)[jjj][0] << " , " << (*this)[jjj][1] << " , " << (*this)[jjj][2] << " , " << (*this)[jjj][3] << " , " << (*this)[jjj][4] << " , " << (*this)[jjj][5] << " , " << (*this)[jjj][6] << " , ");
|
||||
}
|
||||
}
|
||||
*/
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Matix.cpp
|
||||
* @brief Ewol Tool Kit : generique Matrix type (Sources)
|
||||
* @file etk/math/Matix4.cpp
|
||||
* @brief Ewol Tool Kit : generique Matrix4 type (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 29/08/2012
|
||||
* @par Project
|
||||
@ -25,13 +25,13 @@
|
||||
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/Matrix.h>
|
||||
#include <etk/math/Matrix4.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <math.h>
|
||||
|
||||
etk::Matrix etk::matrix::Perspective(float left, float right, float bottom, float top, float nearVal, float farVal)
|
||||
etk::Matrix4 etk::matrix::Perspective(float left, float right, float bottom, float top, float nearVal, float farVal)
|
||||
{
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
tmp.m_mat[iii] = 0;
|
||||
}
|
||||
@ -47,9 +47,9 @@ etk::Matrix etk::matrix::Perspective(float left, float right, float bottom, floa
|
||||
return tmp;
|
||||
}
|
||||
|
||||
etk::Matrix etk::matrix::Translate(float x, float y, float z)
|
||||
etk::Matrix4 etk::matrix::Translate(float x, float y, float z)
|
||||
{
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
// set translation :
|
||||
tmp.m_mat[3] = x;
|
||||
tmp.m_mat[7] = y;
|
||||
@ -59,9 +59,9 @@ etk::Matrix etk::matrix::Translate(float x, float y, float z)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
etk::Matrix etk::matrix::Scale(float x, float y, float z)
|
||||
etk::Matrix4 etk::matrix::Scale(float x, float y, float z)
|
||||
{
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
// set scale :
|
||||
tmp.m_mat[0] = x;
|
||||
tmp.m_mat[5] = y;
|
||||
@ -71,9 +71,9 @@ etk::Matrix etk::matrix::Scale(float x, float y, float z)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
etk::Matrix etk::matrix::rotate(float x, float y, float z, float angleRad)
|
||||
etk::Matrix4 etk::matrix::rotate(float x, float y, float z, float angleRad)
|
||||
{
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
float cosVal = cos(angleRad);
|
||||
float sinVal = sin(angleRad);
|
||||
float invVal = 1.0-cosVal;
|
||||
@ -93,7 +93,7 @@ etk::Matrix etk::matrix::rotate(float x, float y, float z, float angleRad)
|
||||
}
|
||||
|
||||
|
||||
void etk::matrix::Display(etk::Matrix& tmp)
|
||||
void etk::matrix::Display(etk::Matrix4& tmp)
|
||||
{
|
||||
TK_INFO("matrix : (" << tmp.m_mat[0] << " , " << tmp.m_mat[1] << " , " << tmp.m_mat[2] << " , " << tmp.m_mat[3] << " , ");
|
||||
TK_INFO(" " << tmp.m_mat[4] << " , " << tmp.m_mat[5] << " , " << tmp.m_mat[6] << " , " << tmp.m_mat[7] << " , ");
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Matix.h
|
||||
* @brief Ewol Tool Kit : generique Matrix type (header)
|
||||
* @file etk/math/Matix4.h
|
||||
* @brief Ewol Tool Kit : generique Matrix4 type (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 29/08/2012
|
||||
* @par Project
|
||||
@ -22,12 +22,12 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_TYPES_MATRIX_H__
|
||||
#define __ETK_TYPES_MATRIX_H__
|
||||
#ifndef __ETK_TYPES_MATRIX4_H__
|
||||
#define __ETK_TYPES_MATRIX4_H__
|
||||
|
||||
namespace etk {
|
||||
|
||||
class Matrix
|
||||
class Matrix4
|
||||
{
|
||||
public:
|
||||
float m_mat[4*4];
|
||||
@ -43,15 +43,15 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
Matrix(void) {
|
||||
Matrix4(void) {
|
||||
Identity();
|
||||
}
|
||||
Matrix(const Matrix& obj) {
|
||||
Matrix4(const Matrix4& obj) {
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
m_mat[iii] = obj.m_mat[iii];
|
||||
}
|
||||
}
|
||||
Matrix(float a1, float b1, float c1, float d1,
|
||||
Matrix4(float a1, float b1, float c1, float d1,
|
||||
float a2, float b2, float c2, float d2,
|
||||
float a3, float b3, float c3, float d3,
|
||||
float a4, float b4, float c4, float d4) {
|
||||
@ -72,7 +72,7 @@ namespace etk {
|
||||
m_mat[14] = c4;
|
||||
m_mat[15] = d4;
|
||||
}
|
||||
Matrix(float * obj) {
|
||||
Matrix4(float * obj) {
|
||||
if (NULL == obj) {
|
||||
Identity();
|
||||
return;
|
||||
@ -84,13 +84,13 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* Destructor
|
||||
*****************************************************/
|
||||
~Matrix() {
|
||||
virtual ~Matrix4(void) {
|
||||
|
||||
}
|
||||
/*****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const Matrix& operator= (const Matrix& obj ) {
|
||||
const Matrix4& operator= (const Matrix4& obj ) {
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
m_mat[iii] = obj.m_mat[iii];
|
||||
}
|
||||
@ -99,7 +99,7 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Matrix& obj) const {
|
||||
bool operator== (const Matrix4& obj) const {
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
if(m_mat[iii] != obj.m_mat[iii]) {
|
||||
return false;
|
||||
@ -110,7 +110,7 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Matrix& obj) const {
|
||||
bool operator!= (const Matrix4& obj) const {
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
if(m_mat[iii] != obj.m_mat[iii]) {
|
||||
return true;
|
||||
@ -121,7 +121,7 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const Matrix& operator+= (const Matrix& obj) {
|
||||
const Matrix4& operator+= (const Matrix4& obj) {
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
m_mat[iii] += obj.m_mat[iii];
|
||||
}
|
||||
@ -130,15 +130,15 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Matrix operator+ (const Matrix& obj) {
|
||||
Matrix tmpp(*this);
|
||||
Matrix4 operator+ (const Matrix4& obj) {
|
||||
Matrix4 tmpp(*this);
|
||||
tmpp += obj;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const Matrix& operator-= (const Matrix& obj) {
|
||||
const Matrix4& operator-= (const Matrix4& obj) {
|
||||
for(int32_t iii=0; iii<4*4 ; iii++) {
|
||||
m_mat[iii] -= obj.m_mat[iii];
|
||||
}
|
||||
@ -147,15 +147,15 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Matrix operator- (const Matrix& obj) {
|
||||
Matrix tmpp(*this);
|
||||
Matrix4 operator- (const Matrix4& obj) {
|
||||
Matrix4 tmpp(*this);
|
||||
tmpp += obj;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const Matrix& operator*= (const Matrix& obj) {
|
||||
const Matrix4& operator*= (const Matrix4& obj) {
|
||||
// output Matrix
|
||||
float matrixOut[4*4];
|
||||
for(int32_t jjj=0; jjj<4 ; jjj++) {
|
||||
@ -181,8 +181,8 @@ namespace etk {
|
||||
/*****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Matrix operator* (const Matrix& obj) {
|
||||
Matrix tmpp(*this);
|
||||
Matrix4 operator* (const Matrix4& obj) {
|
||||
Matrix4 tmpp(*this);
|
||||
tmpp *= obj;
|
||||
return tmpp;
|
||||
}
|
||||
@ -218,11 +218,11 @@ namespace etk {
|
||||
}
|
||||
};
|
||||
namespace matrix {
|
||||
Matrix Perspective(float left, float right, float bottom, float top, float nearVal, float farVal);
|
||||
Matrix Translate(float x=0.0, float y=0.0, float z=0.0);
|
||||
Matrix Scale(float x=1.0, float y=1.0, float z=1.0);
|
||||
Matrix rotate(float x, float y, float z, float angleRad=0.0);
|
||||
void Display(Matrix& tmp);
|
||||
Matrix4 Perspective(float left, float right, float bottom, float top, float nearVal, float farVal);
|
||||
Matrix4 Translate(float x=0.0, float y=0.0, float z=0.0);
|
||||
Matrix4 Scale(float x=1.0, float y=1.0, float z=1.0);
|
||||
Matrix4 rotate(float x, float y, float z, float angleRad=0.0);
|
||||
void Display(Matrix4& tmp);
|
||||
};
|
||||
};
|
||||
|
185
Sources/libetk/etk/math/Vector2D.h
Normal file
185
Sources/libetk/etk/math/Vector2D.h
Normal file
@ -0,0 +1,185 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/math/Vector2D.h
|
||||
* @brief Ewol Tool Kit : Vector 2 dimention (x,y)
|
||||
* @author Edouard DUPIN
|
||||
* @date 26/10/2012
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_MATH_VECTOR2D_H__
|
||||
#define __ETK_MATH_VECTOR2D_H__
|
||||
|
||||
namespace etk
|
||||
{
|
||||
template <typename T> class Vector2D
|
||||
{
|
||||
public:
|
||||
T x;
|
||||
T y;
|
||||
public:
|
||||
/*****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
Vector2D(void) : x(0), y(0) { };
|
||||
Vector2D(double _x, double _y) : x(_x), y(_y) { };
|
||||
Vector2D(float _x, float _y) : x(_x), y(_y) { };
|
||||
Vector2D(int32_t _x, int32_t _y) : x(_x), y(_y) { };
|
||||
Vector2D(const Vector2D<double>& obj) : x((T)obj.x), y((T)obj.y) { };
|
||||
Vector2D(const Vector2D<float>& obj) : x((T)obj.x), y((T)obj.y) { };
|
||||
Vector2D(const Vector2D<int32_t>& obj) : x((T)obj.x), y((T)obj.y) { };
|
||||
~Vector2D(void) { };
|
||||
/*****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator= (const Vector2D<T>& obj ) {
|
||||
x = (T)obj.x;
|
||||
y = (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Vector2D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Vector2D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator+= (const Vector2D<T>& obj) {
|
||||
x += (T)obj.x;
|
||||
y += (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator+ (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x += (T)obj.x;
|
||||
tmpp.y += (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator-= (const Vector2D<T>& obj) {
|
||||
x -= (T)obj.x;
|
||||
y -= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator- (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x -= (T)obj.x;
|
||||
tmpp.y -= (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator/= (const Vector2D<T>& obj) {
|
||||
x /= (T)obj.x;
|
||||
y /= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator/ (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x /= (T)obj.x;
|
||||
tmpp.y /= (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const Vector2D<T>& operator*= (const Vector2D<T>& obj) {
|
||||
x *= (T)obj.x;
|
||||
y *= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator* (const Vector2D<T>& obj) {
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x *= (T)obj.x;
|
||||
tmpp.y *= (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
Vector2D<T>& operator++() // prefix
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
return *this;
|
||||
}
|
||||
Vector2D<T> operator++(int unused) // postfix
|
||||
{
|
||||
Vector2D<T> result = *this;
|
||||
++(*this);
|
||||
return result;
|
||||
}
|
||||
/*****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
Vector2D<T>& operator--() // prefix
|
||||
{
|
||||
--x;
|
||||
--y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector2D<T> operator--(int unused) // postfix
|
||||
{
|
||||
Vector2D<T> result = *this;
|
||||
--(*this);
|
||||
return result;
|
||||
}
|
||||
|
||||
T QuadDist(void)
|
||||
{
|
||||
return x*x + y*y;
|
||||
}
|
||||
|
||||
T Dist(void)
|
||||
{
|
||||
return sqrt(x*x + y*y);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
188
Sources/libetk/etk/math/Vector3D.h
Normal file
188
Sources/libetk/etk/math/Vector3D.h
Normal file
@ -0,0 +1,188 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/math/Vector3D.h
|
||||
* @brief Ewol Tool Kit : Vector 3 dimention (x, y, z)
|
||||
* @author Edouard DUPIN
|
||||
* @date 26/10/2012
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_MATH_VECTOR3D_H__
|
||||
#define __ETK_MATH_VECTOR3D_H__
|
||||
|
||||
namespace etk
|
||||
{
|
||||
template <typename T> class Vector3D
|
||||
{
|
||||
public:
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
public:
|
||||
/*****************************************************
|
||||
* Constructor
|
||||
*****************************************************/
|
||||
Vector3D(void) : x(0), y(0), z(0) { };
|
||||
Vector3D(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { };
|
||||
Vector3D(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { };
|
||||
Vector3D(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) { };
|
||||
Vector3D(const Vector3D<double>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
|
||||
Vector3D(const Vector3D<float>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
|
||||
Vector3D(const Vector3D<int32_t>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
|
||||
~Vector3D(void) { };
|
||||
/*****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator= (const Vector3D<T>& obj ) {
|
||||
x = (T)obj.x;
|
||||
y = (T)obj.y;
|
||||
z = (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const Vector3D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const Vector3D<T>& obj) const {
|
||||
if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator+= (const Vector3D<T>& obj) {
|
||||
x += (T)obj.x;
|
||||
y += (T)obj.y;
|
||||
z += (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator+ (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x += (T)obj.x;
|
||||
tmpp.y += (T)obj.y;
|
||||
tmpp.z += (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator-= (const Vector3D<T>& obj) {
|
||||
x -= (T)obj.x;
|
||||
y -= (T)obj.y;
|
||||
z -= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator- (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x -= (T)obj.x;
|
||||
tmpp.y -= (T)obj.y;
|
||||
tmpp.z -= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator/= (const Vector3D<T>& obj) {
|
||||
x /= (T)obj.x;
|
||||
y /= (T)obj.y;
|
||||
z /= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator/ (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x /= (T)obj.x;
|
||||
tmpp.y /= (T)obj.y;
|
||||
tmpp.z /= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const Vector3D<T>& operator*= (const Vector3D<T>& obj) {
|
||||
x *= (T)obj.x;
|
||||
y *= (T)obj.y;
|
||||
z *= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator* (const Vector3D<T>& obj) {
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x *= (T)obj.x;
|
||||
tmpp.y *= (T)obj.y;
|
||||
tmpp.z *= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
Vector3D<T>& operator++() // prefix
|
||||
{
|
||||
++x;
|
||||
++y;
|
||||
++z;
|
||||
return *this;
|
||||
}
|
||||
Vector3D<T> operator++(int unused) // postfix
|
||||
{
|
||||
Vector3D<T> result = *this;
|
||||
++(*this);
|
||||
return result;
|
||||
}
|
||||
/*****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
Vector3D<T>& operator--() // prefix
|
||||
{
|
||||
--x;
|
||||
--y;
|
||||
--z;
|
||||
return *this;
|
||||
}
|
||||
Vector3D<T> operator--(int unused) // postfix
|
||||
{
|
||||
Vector3D<T> result = *this;
|
||||
--(*this);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
34
Sources/libetk/etk/math/Vector4D.h
Normal file
34
Sources/libetk/etk/math/Vector4D.h
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/math/Vector4D.h
|
||||
* @brief Ewol Tool Kit : Vector 4 dimention (x, y, z, w) or (x, y, width, height)
|
||||
* @author Edouard DUPIN
|
||||
* @date 26/10/2012
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ETK_MATH_VECTOR4D_H__
|
||||
#define __ETK_MATH_VECTOR4D_H__
|
||||
|
||||
namespace etk
|
||||
{
|
||||
//template <typename T> class Vector4D
|
||||
};
|
||||
|
||||
#endif
|
||||
|
33
Sources/libetk/etk/math/math.h
Normal file
33
Sources/libetk/etk/math/math.h
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/math/math.h
|
||||
* @brief Ewol Tool Kit : Include all mathematic system of etk (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 29/10/2012
|
||||
* @par Project
|
||||
* Ewol TK
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <etk/math/Vector3D.h>
|
||||
#include <etk/math/Vector4D.h>
|
||||
#include <etk/math/Matrix.h>
|
||||
#include <etk/math/Matrix4.h>
|
||||
#include <etk/math/Plane.h>
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <etk/tool.h>
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/File.h
|
||||
* @file etk/os/File.h
|
||||
* @brief Ewol Tool Kit : File folder and name abstraction (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 16/07/2011
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/Memory.h>
|
||||
#include <etk/os/Memory.h>
|
||||
|
||||
// General
|
||||
#if ETK_MEMORY_CHECKER > 0
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Memory.h
|
||||
* @file etk/os/Memory.h
|
||||
* @brief Ewol Tool Kit : Memory implementation (headers)
|
||||
* @author Edouard DUPIN
|
||||
* @date 12/01/2011
|
@ -22,7 +22,7 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/Mutex.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
|
||||
etk::Mutex::Mutex(void)
|
@ -22,7 +22,7 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/Mutex.h>
|
||||
#include <etk/os/Mutex.h>
|
||||
|
||||
etk::Mutex::Mutex(void)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Mutex.h
|
||||
* @file etk/os/Mutex.h
|
||||
* @brief Ewol Tool Kit : basic mutex system (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 15/08/2012
|
||||
@ -22,11 +22,11 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
|
||||
#ifndef __ETK_MUTEX_H__
|
||||
#define __ETK_MUTEX_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
|
||||
#ifdef __TARGET_OS__Windows
|
||||
#include <windows.h>
|
||||
#else
|
@ -22,7 +22,7 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/Semaphore.h>
|
||||
#include <etk/os/Semaphore.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <etk/Semaphore.h>
|
||||
#include <etk/os/Semaphore.h>
|
||||
#include <etk/DebugInternal.h>
|
||||
|
||||
etk::Semaphore::Semaphore(uint32_t nbBasicElement, uint32_t nbMessageMax)
|
0
Sources/libetk/etk/os/Semaphore.cpp
Normal file
0
Sources/libetk/etk/os/Semaphore.cpp
Normal file
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file etk/Semaphore.h
|
||||
* @file etk/os/Semaphore.h
|
||||
* @brief Ewol Tool Kit : basic semaphore system (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 15/08/2012
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
// for the rand ...
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
@ -3,20 +3,29 @@
|
||||
FILE_LIST = \
|
||||
etk/Debug.cpp \
|
||||
etk/DebugInternal.cpp \
|
||||
etk/Memory.cpp \
|
||||
etk/unicode.cpp \
|
||||
etk/unicodeTable.cpp \
|
||||
etk/UString.cpp \
|
||||
etk/Stream.cpp \
|
||||
etk/File.cpp \
|
||||
etk/RegExp.cpp \
|
||||
etk/tool.cpp \
|
||||
etk/Matrix.cpp
|
||||
etk/tool.cpp
|
||||
|
||||
|
||||
|
||||
FILE_LIST+= \
|
||||
etk/math/Matrix4.cpp
|
||||
|
||||
|
||||
FILE_LIST+= \
|
||||
etk/os/File.cpp \
|
||||
etk/os/Memory.cpp \
|
||||
|
||||
|
||||
|
||||
ifeq ("$(TARGET_OS)","Windows")
|
||||
FILE_LIST += etk/Mutex.Windows.cpp
|
||||
FILE_LIST += etk/Semaphore.Windows.cpp
|
||||
FILE_LIST += etk/os/Mutex.Windows.cpp
|
||||
FILE_LIST += etk/os/Semaphore.Windows.cpp
|
||||
else
|
||||
FILE_LIST += etk/Mutex.Generic.cpp
|
||||
FILE_LIST += etk/Semaphore.Generic.cpp
|
||||
FILE_LIST += etk/os/Mutex.Generic.cpp
|
||||
FILE_LIST += etk/os/Semaphore.Generic.cpp
|
||||
endif
|
||||
|
@ -325,9 +325,9 @@ static int32_t nextP2(int32_t value)
|
||||
return val;
|
||||
}
|
||||
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, Vector2D<int32_t> size)
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D<int32_t> size)
|
||||
{
|
||||
Vector2D<int32_t> size2(nextP2(size.x), nextP2(size.y));
|
||||
etk::Vector2D<int32_t> size2(nextP2(size.x), nextP2(size.y));
|
||||
etk::UString TmpFilename = filename;
|
||||
TmpFilename += ":";
|
||||
TmpFilename += size2.x;
|
||||
|
@ -61,7 +61,7 @@ namespace ewol
|
||||
bool Keep(etk::UString& filename, ewol::DistantFieldFont*& object);
|
||||
#endif
|
||||
bool Keep(ewol::Texture*& object); // no name needed here ...
|
||||
bool Keep(etk::UString& filename, ewol::TextureFile*& object, Vector2D<int32_t> size);
|
||||
bool Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D<int32_t> size);
|
||||
bool Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& object);
|
||||
|
||||
void Release(ewol::Resource*& object);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <ewol/audio/decWav.h>
|
||||
#include <ewol/Debug.h>
|
||||
|
||||
|
@ -50,17 +50,17 @@ void ewol::Stop(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::ChangeSize(Vector2D<int32_t> size)
|
||||
void ewol::ChangeSize(etk::Vector2D<int32_t> size)
|
||||
{
|
||||
guiInterface::ChangeSize(size);
|
||||
}
|
||||
|
||||
void ewol::ChangePos(Vector2D<int32_t> pos)
|
||||
void ewol::ChangePos(etk::Vector2D<int32_t> pos)
|
||||
{
|
||||
guiInterface::ChangePos(pos);
|
||||
}
|
||||
|
||||
void ewol::GetAbsPos(Vector2D<int32_t>& pos)
|
||||
void ewol::GetAbsPos(etk::Vector2D<int32_t>& pos)
|
||||
{
|
||||
guiInterface::GetAbsPos(pos);
|
||||
}
|
||||
@ -133,13 +133,13 @@ etk::UString ewol::GetVersion(void)
|
||||
|
||||
int32_t ewol::GetCurrentWidth(void)
|
||||
{
|
||||
Vector2D<int32_t> tmpSize = eSystem::GetSize();
|
||||
etk::Vector2D<int32_t> tmpSize = eSystem::GetSize();
|
||||
return tmpSize.x;
|
||||
}
|
||||
|
||||
int32_t ewol::GetCurrentHeight(void)
|
||||
{
|
||||
Vector2D<int32_t> tmpSize = eSystem::GetSize();
|
||||
etk::Vector2D<int32_t> tmpSize = eSystem::GetSize();
|
||||
return tmpSize.y;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Windows.h>
|
||||
|
||||
@ -38,9 +38,9 @@ namespace ewol {
|
||||
void Stop(void);
|
||||
void DisplayWindows(ewol::Windows * windows);
|
||||
// only on computer
|
||||
void ChangeSize(Vector2D<int32_t> size);
|
||||
void ChangePos(Vector2D<int32_t> pos);
|
||||
void GetAbsPos(Vector2D<int32_t>& pos);
|
||||
void ChangeSize(etk::Vector2D<int32_t> size);
|
||||
void ChangePos(etk::Vector2D<int32_t> pos);
|
||||
void GetAbsPos(etk::Vector2D<int32_t>& pos);
|
||||
void KeyboardShow(void);
|
||||
void KeyboardHide(void);
|
||||
void ForceRedrawAll(void);
|
||||
|
@ -129,17 +129,17 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) :
|
||||
|
||||
EWOL_DEBUG("Generate a text texture for char(" << nbRaws << "," << nbLine << ") with size=(" << textureWidth << "," << textureHeight << ")");
|
||||
// resize must be done on the texture ...
|
||||
SetImageSize(Vector2D<int32_t>(textureWidth,textureHeight));
|
||||
SetImageSize(etk::Vector2D<int32_t>(textureWidth,textureHeight));
|
||||
// now we can acces directly on the image
|
||||
m_data.SetFillColor(draw::Color(0xFFFFFF00));
|
||||
m_data.Clear();
|
||||
|
||||
m_height = m_font->GetHeight(m_size);
|
||||
|
||||
draw::Image tmpUpScaledImage(Vector2D<int32_t>(1024,1024));
|
||||
draw::Image tmpUpScaledImage(etk::Vector2D<int32_t>(1024,1024));
|
||||
|
||||
int32_t CurrentLineHigh = 0;
|
||||
Vector2D<int32_t> glyphPosition(1,1);
|
||||
etk::Vector2D<int32_t> glyphPosition(1,1);
|
||||
for (int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
||||
if (true == m_font->GetGlyphProperty(m_size, m_listElement[iii].property)) {
|
||||
EWOL_DEBUG("Generate Font Element : '" << m_listElement[iii].property.m_UVal << "'= '" << (char)m_listElement[iii].property.m_UVal << "'");
|
||||
@ -165,7 +165,7 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) :
|
||||
CurrentLineHigh = 0;
|
||||
}
|
||||
// draw the glyph
|
||||
m_font->DrawGlyph(tmpUpScaledImage, m_size*SPECIAL_UPSCALER, Vector2D<int32_t>(SPECIAL_BORDER*SPECIAL_UPSCALER,SPECIAL_BORDER*SPECIAL_UPSCALER), m_listElement[iii].property);
|
||||
m_font->DrawGlyph(tmpUpScaledImage, m_size*SPECIAL_UPSCALER, etk::Vector2D<int32_t>(SPECIAL_BORDER*SPECIAL_UPSCALER,SPECIAL_BORDER*SPECIAL_UPSCALER), m_listElement[iii].property);
|
||||
// set video position
|
||||
m_listElement[iii].posStart.u = (float)(glyphPosition.x) / (float)textureWidth;
|
||||
m_listElement[iii].posStart.v = (float)(glyphPosition.y) / (float)textureHeight;
|
||||
@ -179,12 +179,12 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) :
|
||||
EWOL_DEBUG(" m_advance =" << m_listElement[iii].property.m_advance );
|
||||
*/
|
||||
// generate the distance field from this element ...
|
||||
tmpUpScaledImage.DistanceField(Vector2D<int32_t>(0,0), m_listElement[iii].property.m_sizeTexture*Vector2D<int32_t>(SPECIAL_UPSCALER,SPECIAL_UPSCALER)+Vector2D<int32_t>(2*SPECIAL_BORDER*SPECIAL_UPSCALER,2*SPECIAL_BORDER*SPECIAL_UPSCALER), SPECIAL_UPSCALER, SPECIAL_UPSCALER/2);
|
||||
tmpUpScaledImage.DistanceField(etk::Vector2D<int32_t>(0,0), m_listElement[iii].property.m_sizeTexture*etk::Vector2D<int32_t>(SPECIAL_UPSCALER,SPECIAL_UPSCALER)+etk::Vector2D<int32_t>(2*SPECIAL_BORDER*SPECIAL_UPSCALER,2*SPECIAL_BORDER*SPECIAL_UPSCALER), SPECIAL_UPSCALER, SPECIAL_UPSCALER/2);
|
||||
// copy data with downscaling : (subSampling)
|
||||
Vector2D<int32_t> tmpPos(0,0);
|
||||
etk::Vector2D<int32_t> tmpPos(0,0);
|
||||
for (tmpPos.y = 0; tmpPos.y<m_listElement[iii].property.m_sizeTexture.y+2*SPECIAL_BORDER; tmpPos.y++) {
|
||||
for (tmpPos.x = 0; tmpPos.x<m_listElement[iii].property.m_sizeTexture.x+2*SPECIAL_BORDER; tmpPos.x++) {
|
||||
m_data.Set(glyphPosition + tmpPos, tmpUpScaledImage.Get(tmpPos*Vector2D<int32_t>(SPECIAL_UPSCALER,SPECIAL_UPSCALER) + Vector2D<int32_t>(SPECIAL_UPSCALER/2,SPECIAL_UPSCALER/2)) );
|
||||
m_data.Set(glyphPosition + tmpPos, tmpUpScaledImage.Get(tmpPos*etk::Vector2D<int32_t>(SPECIAL_UPSCALER,SPECIAL_UPSCALER) + etk::Vector2D<int32_t>(SPECIAL_UPSCALER/2,SPECIAL_UPSCALER/2)) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,11 +204,11 @@ ewol::DistantFieldFont::DistantFieldFont(etk::UString fontName) :
|
||||
draw::Color tlpppp(0xFF,0xFF,0xFF,0x00);
|
||||
for(int32_t jjj=0; jjj < textureHeight;jjj++) {
|
||||
for(int32_t iii=0; iii < textureWidth; iii++){
|
||||
tlpppp = m_data.Get(Vector2D<int32_t>(iii, jjj) );
|
||||
tlpppp = m_data.Get(etk::Vector2D<int32_t>(iii, jjj) );
|
||||
// set only alpha :
|
||||
tlpppp.a = etk_min( tlpppp.a+0x60, 0xFF);
|
||||
// real set of color
|
||||
m_data.Set(Vector2D<int32_t>(iii, jjj), tlpppp );
|
||||
m_data.Set(etk::Vector2D<int32_t>(iii, jjj), tlpppp );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -236,13 +236,13 @@ bool ewol::DistantFieldFont::HasName(etk::UString& fileName)
|
||||
|
||||
|
||||
|
||||
int32_t ewol::DistantFieldFont::Draw(Vector2D<float> textPos,
|
||||
int32_t ewol::DistantFieldFont::Draw(etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex)
|
||||
{
|
||||
float totalSize = 0;
|
||||
Vector2D<float> tmpPos = textPos;
|
||||
etk::Vector2D<float> tmpPos = textPos;
|
||||
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
|
||||
int32_t ret = Draw(tmpPos, unicodeString[iii], coord, coordTex);
|
||||
tmpPos.x += ret;
|
||||
@ -258,7 +258,7 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D<float> textPos,
|
||||
* | |
|
||||
* 3------2
|
||||
*/
|
||||
Vector2D<float> bitmapDrawPos[4];
|
||||
etk::Vector2D<float> bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].x = 10;
|
||||
bitmapDrawPos[1].x = 400;
|
||||
bitmapDrawPos[2].x = 400;
|
||||
@ -322,9 +322,9 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D<float> textPos,
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
int32_t ewol::DistantFieldFont::Draw(Vector2D<float> textPos,
|
||||
int32_t ewol::DistantFieldFont::Draw(etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex)
|
||||
{
|
||||
float posDrawX = textPos.x;
|
||||
@ -374,7 +374,7 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D<float> textPos,
|
||||
* | |
|
||||
* 3------2
|
||||
*/
|
||||
Vector2D<int32_t> bitmapDrawPos[4];
|
||||
etk::Vector2D<int32_t> bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].x = (int32_t)dxA;
|
||||
bitmapDrawPos[1].x = (int32_t)dxB;
|
||||
bitmapDrawPos[2].x = (int32_t)dxB;
|
||||
@ -442,20 +442,20 @@ int32_t ewol::DistantFieldFont::Draw(Vector2D<float> textPos,
|
||||
return sizeOut;
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::DistantFieldFont::GetSize(const etk::UString & unicodeString)
|
||||
etk::Vector2D<float> ewol::DistantFieldFont::GetSize(const etk::UString & unicodeString)
|
||||
{
|
||||
Vector2D<float> outputSize(0,m_height);
|
||||
etk::Vector2D<float> outputSize(0,m_height);
|
||||
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
|
||||
Vector2D<float> tmpp = GetSize(unicodeString[iii]);
|
||||
etk::Vector2D<float> tmpp = GetSize(unicodeString[iii]);
|
||||
outputSize.x += tmpp.x;
|
||||
}
|
||||
return outputSize;
|
||||
}
|
||||
|
||||
|
||||
Vector2D<float> ewol::DistantFieldFont::GetSize(const uniChar_t unicodeChar)
|
||||
etk::Vector2D<float> ewol::DistantFieldFont::GetSize(const uniChar_t unicodeChar)
|
||||
{
|
||||
Vector2D<float> outputSize(0,m_height);
|
||||
etk::Vector2D<float> outputSize(0,m_height);
|
||||
int32_t charIndex;
|
||||
if (unicodeChar >= 0x80) {
|
||||
charIndex = 0;
|
||||
|
@ -46,7 +46,7 @@ namespace ewol
|
||||
ewol::Font* m_font;
|
||||
etk::Vector<freeTypeFontElement_ts> m_listElement;
|
||||
// for the texture generation :
|
||||
Vector2D<int32_t> m_lastGlyphPos;
|
||||
etk::Vector2D<int32_t> m_lastGlyphPos;
|
||||
int32_t m_lastRawHeigh;
|
||||
public:
|
||||
DistantFieldFont(etk::UString fontName);
|
||||
@ -54,16 +54,16 @@ namespace ewol
|
||||
virtual bool HasName(etk::UString& fileName);
|
||||
const char* GetType(void) { return "ewol::TexturedFont"; };
|
||||
int32_t getFontSize(void) { return m_size; };
|
||||
int32_t Draw(Vector2D<float> textPos,
|
||||
int32_t Draw(etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex);
|
||||
int32_t Draw(Vector2D<float> textPos,
|
||||
int32_t Draw(etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex);
|
||||
Vector2D<float> GetSize(const etk::UString & unicodeString);
|
||||
Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
etk::Vector2D<float> GetSize(const etk::UString & unicodeString);
|
||||
etk::Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
// TODO : Remove this element, it is stupid ...
|
||||
int32_t GetHeight(void) { return m_height; };
|
||||
int32_t GetFontSize(void) { return m_size; };
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <draw/Image.h>
|
||||
#include <ewol/texture/Texture.h>
|
||||
#include <ewol/Resource.h>
|
||||
@ -72,9 +72,9 @@ namespace ewol
|
||||
typedef struct {
|
||||
uniChar_t m_UVal; // Unicode value
|
||||
int32_t m_glyphIndex; // Glyph index in the system
|
||||
Vector2D<int32_t> m_sizeTexture; // size of the element to display
|
||||
Vector2D<int32_t> m_bearing; // offset to display the data (can be negatif id the texture sise is bigger than the théoric places in the string)
|
||||
Vector2D<int32_t> m_advance; // space use in the display for this specific char
|
||||
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 théoric places in the string)
|
||||
etk::Vector2D<int32_t> m_advance; // space use in the display for this specific char
|
||||
} GlyphProperty;
|
||||
|
||||
class Font : public ewol::Resource
|
||||
@ -85,21 +85,21 @@ namespace ewol
|
||||
const char* GetType(void) { return "ewol::Font"; };
|
||||
virtual int32_t Draw(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<float> textPos,
|
||||
etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
draw::Color& textColor) = 0;
|
||||
virtual int32_t Draw(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<float> textPos,
|
||||
etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
draw::Color& textColor) = 0;
|
||||
virtual bool GetGlyphProperty(int32_t fontSize,
|
||||
ewol::GlyphProperty& property) = 0;
|
||||
virtual bool DrawGlyph(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<int32_t> glyphPosition,
|
||||
etk::Vector2D<int32_t> glyphPosition,
|
||||
ewol::GlyphProperty& property) = 0;
|
||||
virtual Vector2D<float> GetSize(int32_t fontSize, const etk::UString & unicodeString) = 0;
|
||||
virtual etk::Vector2D<float> GetSize(int32_t fontSize, const etk::UString & unicodeString) = 0;
|
||||
virtual int32_t GetHeight(int32_t fontSize) = 0;
|
||||
};
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ ewol::FontFreeType::~FontFreeType(void)
|
||||
|
||||
int32_t ewol::FontFreeType::Draw(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<float> textPos,
|
||||
etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
draw::Color& textColor)
|
||||
{
|
||||
@ -133,7 +133,7 @@ int32_t ewol::FontFreeType::Draw(draw::Image& imageOut,
|
||||
|
||||
int32_t ewol::FontFreeType::Draw(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<float> textPos,
|
||||
etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
draw::Color& textColor)
|
||||
{
|
||||
@ -144,13 +144,13 @@ int32_t ewol::FontFreeType::Draw(draw::Image& imageOut,
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::FontFreeType::GetSize(int32_t fontSize, const etk::UString & unicodeString)
|
||||
etk::Vector2D<float> ewol::FontFreeType::GetSize(int32_t fontSize, const etk::UString & unicodeString)
|
||||
{
|
||||
if(false==m_init) {
|
||||
return Vector2D<float>(0,0);
|
||||
return etk::Vector2D<float>(0,0);
|
||||
}
|
||||
// TODO : ...
|
||||
Vector2D<float> outputSize(0,0);
|
||||
etk::Vector2D<float> outputSize(0,0);
|
||||
return outputSize;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ bool ewol::FontFreeType::GetGlyphProperty(int32_t fontSize,
|
||||
|
||||
bool ewol::FontFreeType::DrawGlyph(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<int32_t> glyphPosition,
|
||||
etk::Vector2D<int32_t> glyphPosition,
|
||||
ewol::GlyphProperty& property)
|
||||
{
|
||||
|
||||
@ -245,7 +245,7 @@ bool ewol::FontFreeType::DrawGlyph(draw::Image& imageOut,
|
||||
// set only alpha :
|
||||
tlpppp.a = slot->bitmap.buffer[iii + slot->bitmap.width*jjj];
|
||||
// real set of color
|
||||
imageOut.Set(Vector2D<int32_t>(glyphPosition.x+iii, glyphPosition.y+jjj), tlpppp );
|
||||
imageOut.Set(etk::Vector2D<int32_t>(glyphPosition.x+iii, glyphPosition.y+jjj), tlpppp );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -48,21 +48,21 @@ namespace ewol
|
||||
~FontFreeType(void);
|
||||
int32_t Draw(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<float> textPos,
|
||||
etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
draw::Color& textColor);
|
||||
int32_t Draw(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<float> textPos,
|
||||
etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
draw::Color& textColor);
|
||||
bool GetGlyphProperty(int32_t fontSize,
|
||||
ewol::GlyphProperty& property);
|
||||
bool DrawGlyph(draw::Image& imageOut,
|
||||
int32_t fontSize,
|
||||
Vector2D<int32_t> glyphPosition,
|
||||
etk::Vector2D<int32_t> glyphPosition,
|
||||
ewol::GlyphProperty& property);
|
||||
Vector2D<float> GetSize(int32_t fontSize, const etk::UString & unicodeString);
|
||||
etk::Vector2D<float> GetSize(int32_t fontSize, const etk::UString & unicodeString);
|
||||
int32_t GetHeight(int32_t fontSize);
|
||||
};
|
||||
void FreeTypeInit(void);
|
||||
|
@ -127,7 +127,7 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||
|
||||
EWOL_DEBUG("Generate a text texture for char(" << nbRaws << "," << nbLine << ") with size=(" << textureWidth << "," << textureHeight << ")");
|
||||
// resize must be done on the texture ...
|
||||
SetImageSize(Vector2D<int32_t>(textureWidth,textureHeight));
|
||||
SetImageSize(etk::Vector2D<int32_t>(textureWidth,textureHeight));
|
||||
// now we can acces directly on the image
|
||||
m_data.SetFillColor(draw::Color(0xFFFFFF00));
|
||||
m_data.Clear();
|
||||
@ -135,7 +135,7 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||
m_height = m_font->GetHeight(m_size);
|
||||
|
||||
int32_t CurrentLineHigh = 0;
|
||||
Vector2D<int32_t> glyphPosition(1,1);
|
||||
etk::Vector2D<int32_t> glyphPosition(1,1);
|
||||
for (int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
||||
if (true == m_font->GetGlyphProperty(m_size, m_listElement[iii].property)) {
|
||||
/*
|
||||
@ -187,11 +187,11 @@ ewol::TexturedFont::TexturedFont(etk::UString fontName) :
|
||||
draw::Color tlpppp(0xFF,0xFF,0xFF,0x00);
|
||||
for(int32_t jjj=0; jjj < textureHeight;jjj++) {
|
||||
for(int32_t iii=0; iii < textureWidth; iii++){
|
||||
tlpppp = m_data.Get(Vector2D<int32_t>(iii, jjj) );
|
||||
tlpppp = m_data.Get(etk::Vector2D<int32_t>(iii, jjj) );
|
||||
// set only alpha :
|
||||
tlpppp.a = etk_min( tlpppp.a+0x60, 0xFF);
|
||||
// real set of color
|
||||
m_data.Set(Vector2D<int32_t>(iii, jjj), tlpppp );
|
||||
m_data.Set(etk::Vector2D<int32_t>(iii, jjj), tlpppp );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -219,15 +219,15 @@ bool ewol::TexturedFont::HasName(etk::UString& fileName)
|
||||
|
||||
|
||||
|
||||
int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,
|
||||
int32_t ewol::TexturedFont::Draw(etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex,
|
||||
bool hasClipping,
|
||||
clipping_ts& clipping)
|
||||
{
|
||||
float totalSize = 0;
|
||||
Vector2D<float> tmpPos = textPos;
|
||||
etk::Vector2D<float> tmpPos = textPos;
|
||||
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
|
||||
int32_t ret = Draw(tmpPos, unicodeString[iii], coord, coordTex, hasClipping, clipping);
|
||||
tmpPos.x += ret;
|
||||
@ -243,7 +243,7 @@ int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,
|
||||
* | |
|
||||
* 3------2
|
||||
*/
|
||||
Vector2D<float> bitmapDrawPos[4];
|
||||
etk::Vector2D<float> bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].x = 10;
|
||||
bitmapDrawPos[1].x = 400;
|
||||
bitmapDrawPos[2].x = 400;
|
||||
@ -307,9 +307,9 @@ int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,
|
||||
int32_t ewol::TexturedFont::Draw(etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex,
|
||||
bool hasClipping,
|
||||
clipping_ts& clipping)
|
||||
@ -407,7 +407,7 @@ int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,
|
||||
* | |
|
||||
* 3------2
|
||||
*/
|
||||
Vector2D<int32_t> bitmapDrawPos[4];
|
||||
etk::Vector2D<int32_t> bitmapDrawPos[4];
|
||||
bitmapDrawPos[0].x = (int32_t)dxA;
|
||||
bitmapDrawPos[1].x = (int32_t)dxB;
|
||||
bitmapDrawPos[2].x = (int32_t)dxB;
|
||||
@ -475,20 +475,20 @@ int32_t ewol::TexturedFont::Draw(Vector2D<float> textPos,
|
||||
return sizeOut;
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::TexturedFont::GetSize(const etk::UString & unicodeString)
|
||||
etk::Vector2D<float> ewol::TexturedFont::GetSize(const etk::UString & unicodeString)
|
||||
{
|
||||
Vector2D<float> outputSize(0,m_height);
|
||||
etk::Vector2D<float> outputSize(0,m_height);
|
||||
for(int32_t iii=0; iii<unicodeString.Size(); iii++) {
|
||||
Vector2D<float> tmpp = GetSize(unicodeString[iii]);
|
||||
etk::Vector2D<float> tmpp = GetSize(unicodeString[iii]);
|
||||
outputSize.x += tmpp.x;
|
||||
}
|
||||
return outputSize;
|
||||
}
|
||||
|
||||
|
||||
Vector2D<float> ewol::TexturedFont::GetSize(const uniChar_t unicodeChar)
|
||||
etk::Vector2D<float> ewol::TexturedFont::GetSize(const uniChar_t unicodeChar)
|
||||
{
|
||||
Vector2D<float> outputSize(0,m_height);
|
||||
etk::Vector2D<float> outputSize(0,m_height);
|
||||
int32_t charIndex;
|
||||
if (unicodeChar >= 0x80) {
|
||||
charIndex = 0;
|
||||
|
@ -46,7 +46,7 @@ namespace ewol
|
||||
ewol::Font* m_font;
|
||||
etk::Vector<freeTypeFontElement_ts> m_listElement;
|
||||
// for the texture generation :
|
||||
Vector2D<int32_t> m_lastGlyphPos;
|
||||
etk::Vector2D<int32_t> m_lastGlyphPos;
|
||||
int32_t m_lastRawHeigh;
|
||||
public:
|
||||
TexturedFont(etk::UString fontName);
|
||||
@ -54,20 +54,20 @@ namespace ewol
|
||||
virtual bool HasName(etk::UString& fileName);
|
||||
const char* GetType(void) { return "ewol::TexturedFont"; };
|
||||
int32_t getFontSize(void) { return m_size; };
|
||||
int32_t Draw(Vector2D<float> textPos,
|
||||
int32_t Draw(etk::Vector2D<float> textPos,
|
||||
const etk::UString& unicodeString,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex,
|
||||
bool hasClipping,
|
||||
clipping_ts& clipping);
|
||||
int32_t Draw(Vector2D<float> textPos,
|
||||
int32_t Draw(etk::Vector2D<float> textPos,
|
||||
const uniChar_t unicodeChar,
|
||||
etk::Vector<Vector2D<float> > & coord,
|
||||
etk::Vector<etk::Vector2D<float> > & coord,
|
||||
etk::Vector<texCoord_ts> & coordTex,
|
||||
bool hasClipping,
|
||||
clipping_ts& clipping);
|
||||
Vector2D<float> GetSize(const etk::UString & unicodeString);
|
||||
Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
etk::Vector2D<float> GetSize(const etk::UString & unicodeString);
|
||||
etk::Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
// TODO : Remove this element, it is stupid ...
|
||||
int32_t GetHeight(void) { return m_height; };
|
||||
int32_t GetFontSize(void) { return m_size; };
|
||||
|
@ -57,7 +57,7 @@ ewol::GameElement::GameElement(SceneElement & sceneElement, etk::UString& tmpNam
|
||||
|
||||
|
||||
|
||||
float quadDist(Vector2D<float> pos1, Vector2D<float> pos2)
|
||||
float quadDist(etk::Vector2D<float> pos1, etk::Vector2D<float> pos2)
|
||||
{
|
||||
float tmpVal1 = pos1.x - pos2.x;
|
||||
float tmpVal2 = pos1.y - pos2.y;
|
||||
@ -66,7 +66,7 @@ float quadDist(Vector2D<float> pos1, Vector2D<float> pos2)
|
||||
}
|
||||
|
||||
|
||||
bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
|
||||
bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, etk::Vector2D<float> position, float size)
|
||||
{
|
||||
if (true != m_canHaveImpact) {
|
||||
return false;
|
||||
|
@ -42,23 +42,23 @@ namespace ewol {
|
||||
private:
|
||||
etk::UString m_fileNameConfig;
|
||||
protected:
|
||||
SceneElement & m_sceneElement; //!< All element neede in the scene
|
||||
uint16_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element)
|
||||
uint16_t m_group; //!< General group Id More than 65000 group can be really interesting to create supid game ...
|
||||
float m_life; //!< Current life of the element
|
||||
int32_t m_type; //!<
|
||||
float m_power; //!< Current power of the element
|
||||
bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ...
|
||||
Vector2D<float> m_position; //!< Current position of the element
|
||||
float m_speed; //!< Speed of the element (only one value, the angle is generated by the m_angle
|
||||
float m_angle; //!< Angle of the speed
|
||||
float m_mass; //!< Current element Mass ==> for the physical calculation
|
||||
float m_size; //!< Current size of the element more specific size can be done in the under class => this is for simplify calculation ==> all is consider like sphere...
|
||||
float m_sizeDisplay; //!< Current diplay size of the element
|
||||
bool m_canBeCibled; //!< This is for automatic finding on an ennemy
|
||||
bool m_canHaveImpact; //!< detection of impact is done with this ...
|
||||
float m_specialParam[NB_SPECIAL_PARAM]; //!< specific game user parameter
|
||||
bool m_enable; //!< Use to add element that can not be detected by the other when user select a place
|
||||
SceneElement & m_sceneElement; //!< All element neede in the scene
|
||||
uint16_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element)
|
||||
uint16_t m_group; //!< General group Id More than 65000 group can be really interesting to create supid game ...
|
||||
float m_life; //!< Current life of the element
|
||||
int32_t m_type; //!<
|
||||
float m_power; //!< Current power of the element
|
||||
bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ...
|
||||
etk::Vector2D<float> m_position; //!< Current position of the element
|
||||
float m_speed; //!< Speed of the element (only one value, the angle is generated by the m_angle
|
||||
float m_angle; //!< Angle of the speed
|
||||
float m_mass; //!< Current element Mass ==> for the physical calculation
|
||||
float m_size; //!< Current size of the element more specific size can be done in the under class => this is for simplify calculation ==> all is consider like sphere...
|
||||
float m_sizeDisplay; //!< Current diplay size of the element
|
||||
bool m_canBeCibled; //!< This is for automatic finding on an ennemy
|
||||
bool m_canHaveImpact; //!< detection of impact is done with this ...
|
||||
float m_specialParam[NB_SPECIAL_PARAM]; //!< specific game user parameter
|
||||
bool m_enable; //!< Use to add element that can not be detected by the other when user select a place
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor : here are requested all the needed sprite and effect that can be used in the game
|
||||
@ -83,8 +83,8 @@ namespace ewol {
|
||||
void SetVisible(bool state) { m_visible = state; StatusUpdate();};
|
||||
bool IsEnable(void) { return m_enable; };
|
||||
void SetEnable(bool state) { m_enable = state; StatusUpdate();};
|
||||
Vector2D<float> PositionGet(void) { return m_position; };
|
||||
void PositionSet(Vector2D<float> state) { m_position = state; StatusUpdate();};
|
||||
etk::Vector2D<float> PositionGet(void) { return m_position; };
|
||||
void PositionSet(etk::Vector2D<float> state) { m_position = state; StatusUpdate();};
|
||||
void PositionSet(float xxx, float yyy) { m_position.x = xxx; m_position.y = yyy; StatusUpdate();};
|
||||
float SpeedGet(void) { return m_speed; };
|
||||
void SpeedSet(float state) { m_speed = state; StatusUpdate();};
|
||||
@ -145,8 +145,8 @@ namespace ewol {
|
||||
* @return ---
|
||||
*/
|
||||
virtual void RemoveElement(int32_t idOfElement) { };
|
||||
virtual bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
|
||||
virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power) { return false; } ;
|
||||
virtual bool HaveImpact(int32_t group, int32_t type, etk::Vector2D<float> position, float size);
|
||||
virtual bool Explosion(int32_t group, int32_t type, etk::Vector2D<float> position, float pxAtenuation, float power) { return false; } ;
|
||||
|
||||
virtual etk::UString Message(etk::UString control, etk::UString message) { return ""; } ;
|
||||
virtual void StatusUpdate(void) { };
|
||||
@ -156,6 +156,6 @@ namespace ewol {
|
||||
|
||||
#include <ewol/widget/Scene.h>
|
||||
|
||||
float quadDist(Vector2D<float> pos1, Vector2D<float> pos2);
|
||||
float quadDist(etk::Vector2D<float> pos1, etk::Vector2D<float> pos2);
|
||||
|
||||
#endif
|
||||
|
@ -141,7 +141,7 @@ LUAMOD_API int lua_GetPos(lua_State *L)
|
||||
lua_pushnumber(L, (lua_Number)0 );
|
||||
return 2;
|
||||
}
|
||||
Vector2D<float> tmpPos = tmpObj->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = tmpObj->PositionGet();
|
||||
lua_pushnumber(L, (lua_Number)tmpPos.x );
|
||||
lua_pushnumber(L, (lua_Number)tmpPos.y );
|
||||
// return number of parameters
|
||||
@ -156,7 +156,7 @@ LUAMOD_API int lua_SetPos(lua_State *L)
|
||||
}
|
||||
float x = luaL_checknumber(L, 1);
|
||||
float y = luaL_checknumber(L, 2);
|
||||
Vector2D<float> tmpPos;
|
||||
etk::Vector2D<float> tmpPos;
|
||||
tmpPos.x = x;
|
||||
tmpPos.y = y;
|
||||
tmpObj->PositionSet(tmpPos);
|
||||
@ -354,7 +354,7 @@ LUAMOD_API int lua_SpriteUnLoad(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
float a = luaL_checkint(L, 1);
|
||||
Vector2D<float> tmpPos = tmpObj->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = tmpObj->PositionGet();
|
||||
tmpPos.y = a;
|
||||
tmpObj->PositionSet(tmpPos);
|
||||
*/
|
||||
@ -370,7 +370,7 @@ LUAMOD_API int lua_SpriteDraw(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
float spriteID = luaL_checknumber(L, 1);
|
||||
Vector2D<float> tmpPos;
|
||||
etk::Vector2D<float> tmpPos;
|
||||
tmpPos.x = luaL_checknumber(L, 2);
|
||||
tmpPos.y = luaL_checknumber(L, 3);
|
||||
float angle = luaL_checknumber(L, 4);
|
||||
@ -424,7 +424,7 @@ LUAMOD_API int lua_ElementSetPos(lua_State *L)
|
||||
int32_t idElement = luaL_checkint(L, 1);
|
||||
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
|
||||
if (NULL != tmpElem) {
|
||||
Vector2D<float> tmpPos;
|
||||
etk::Vector2D<float> tmpPos;
|
||||
tmpPos.x = luaL_checknumber(L, 2);
|
||||
tmpPos.y = luaL_checknumber(L, 3);
|
||||
tmpElem->PositionSet(tmpPos);
|
||||
@ -447,7 +447,7 @@ LUAMOD_API int lua_ElementGetPos(lua_State *L)
|
||||
int32_t idElement = luaL_checkint(L, 1);
|
||||
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
|
||||
if (NULL != tmpElem) {
|
||||
Vector2D<float> tmpPos = tmpElem->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = tmpElem->PositionGet();
|
||||
lua_pushnumber(L, (lua_Number)tmpPos.x );
|
||||
lua_pushnumber(L, (lua_Number)tmpPos.y );
|
||||
} else {
|
||||
@ -809,7 +809,7 @@ void ewol::GameElementLua::Draw(void)
|
||||
}
|
||||
|
||||
|
||||
bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
|
||||
bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, etk::Vector2D<float> position, float size)
|
||||
{
|
||||
// todo set a flag that permit lua to direct control of this ...
|
||||
if (false == ewol::GameElement::HaveImpact(group, type, position, size) ) {
|
||||
@ -852,7 +852,7 @@ bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, Vector2D<floa
|
||||
}
|
||||
|
||||
|
||||
bool ewol::GameElementLua::Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power)
|
||||
bool ewol::GameElementLua::Explosion(int32_t group, int32_t type, etk::Vector2D<float> position, float pxAtenuation, float power)
|
||||
{
|
||||
tmpObj = this;
|
||||
bool retVal = false;
|
||||
|
@ -47,8 +47,8 @@ namespace ewol {
|
||||
virtual void UnInit(void);
|
||||
virtual bool Process(int64_t time, int32_t deltaTime);
|
||||
virtual void Draw(void);
|
||||
virtual bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
|
||||
virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
|
||||
virtual bool HaveImpact(int32_t group, int32_t type, etk::Vector2D<float> position, float size);
|
||||
virtual bool Explosion(int32_t group, int32_t type, etk::Vector2D<float> position, float pxAtenuation, float power);
|
||||
virtual etk::UString Message(etk::UString control, etk::UString message);
|
||||
};
|
||||
void RegisterLuaElementInFolder(ewol::SceneElement & sceneElement, etk::UString folder);
|
||||
|
@ -242,7 +242,7 @@ ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement)
|
||||
}
|
||||
|
||||
|
||||
uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange)
|
||||
uint32_t ewol::SceneElement::GetNearestEnemy(etk::Vector2D<float> position, int32_t groupId, float maxRange)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
float lastQuadDistance = 9999999999999999.0;
|
||||
@ -261,7 +261,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t g
|
||||
if (NULL != listAnimatedElements[gId][iii]) {
|
||||
if( true == listAnimatedElements[gId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if( distance <= lastQuadDistance
|
||||
&& maxRange >= distance ) {
|
||||
@ -276,7 +276,7 @@ uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t g
|
||||
return result;
|
||||
}
|
||||
|
||||
void ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list)
|
||||
void ewol::SceneElement::GetNearestEnemy(etk::Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list)
|
||||
{
|
||||
// remove all elements..
|
||||
list.Clear();
|
||||
@ -295,7 +295,7 @@ void ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t group
|
||||
if (NULL != listAnimatedElements[gId][iii]) {
|
||||
if( true == listAnimatedElements[gId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if(maxRange >= distance) {
|
||||
uint32_t tmpp = createUniqueId(listAnimatedElements[gId][iii]->GetUniqueId(), iii);
|
||||
@ -308,7 +308,7 @@ void ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t group
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t groupId, uint32_t us)
|
||||
uint32_t ewol::SceneElement::GetNearestFriend(etk::Vector2D<float> position, int32_t groupId, uint32_t us)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
float lastQuadDistance = 9999999999999999.0;
|
||||
@ -321,7 +321,7 @@ uint32_t ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t
|
||||
if (NULL != listAnimatedElements[gId][iii]) {
|
||||
if( true == listAnimatedElements[gId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if( distance <= lastQuadDistance
|
||||
&& us != listAnimatedElements[gId][iii]->GetUniqueId() ) {
|
||||
@ -335,7 +335,7 @@ uint32_t ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t
|
||||
}
|
||||
|
||||
|
||||
void ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list, uint32_t us)
|
||||
void ewol::SceneElement::GetNearestFriend(etk::Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list, uint32_t us)
|
||||
{
|
||||
// remove all elements..
|
||||
list.Clear();
|
||||
@ -348,7 +348,7 @@ void ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t grou
|
||||
if (NULL != listAnimatedElements[groupId][iii]) {
|
||||
if( true == listAnimatedElements[groupId][iii]->IsEnable()
|
||||
&& true == listAnimatedElements[groupId][iii]->CanBeCibledGet()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[groupId][iii]->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = listAnimatedElements[groupId][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if( maxRange >= distance
|
||||
&& us != listAnimatedElements[groupId][iii]->GetUniqueId() ) {
|
||||
@ -360,7 +360,7 @@ void ewol::SceneElement::GetNearestFriend(Vector2D<float> position, int32_t grou
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
|
||||
bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, etk::Vector2D<float> position, float size)
|
||||
{
|
||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||
if (group != jjj) {
|
||||
@ -377,7 +377,7 @@ bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float>
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power)
|
||||
void ewol::SceneElement::Explosion(int32_t group, int32_t type, etk::Vector2D<float> position, float pxAtenuation, float power)
|
||||
{
|
||||
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
|
||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
||||
@ -392,7 +392,7 @@ void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D<float>
|
||||
}
|
||||
|
||||
|
||||
uint32_t ewol::SceneElement::GetElementAtPos(Vector2D<float> position, int32_t maxDistanceDetection)
|
||||
uint32_t ewol::SceneElement::GetElementAtPos(etk::Vector2D<float> position, int32_t maxDistanceDetection)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
float lastQuadDistance = 9999999999999999.0;
|
||||
@ -400,7 +400,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D<float> position, int32_t m
|
||||
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
|
||||
if (NULL != listAnimatedElements[jjj][iii]) {
|
||||
if( true == listAnimatedElements[jjj][iii]->IsEnable()) {
|
||||
Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
|
||||
etk::Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
|
||||
float distance = quadDist(position, tmpPos);
|
||||
if (distance <= lastQuadDistance) {
|
||||
lastQuadDistance = distance;
|
||||
@ -416,7 +416,7 @@ uint32_t ewol::SceneElement::GetElementAtPos(Vector2D<float> position, int32_t m
|
||||
return result;
|
||||
}
|
||||
|
||||
void ewol::SceneElement::SetEventInput(uint32_t id, Vector2D<float> position)
|
||||
void ewol::SceneElement::SetEventInput(uint32_t id, etk::Vector2D<float> position)
|
||||
{
|
||||
EWOL_TODO("but when ...");
|
||||
}
|
||||
|
@ -67,14 +67,14 @@ namespace ewol {
|
||||
uint32_t AddElement(int32_t group, ewol::GameElement* newElement);
|
||||
uint32_t AddElementNamed(int32_t group, etk::UString &elementName);
|
||||
ewol::GameElement* GetElement(uint32_t idElement);
|
||||
uint32_t GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange=9999999999999999.0);
|
||||
void GetNearestEnemy(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list);
|
||||
uint32_t GetNearestFriend(Vector2D<float> position, int32_t groupId, uint32_t us);
|
||||
void GetNearestFriend(Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list, uint32_t us);
|
||||
bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
|
||||
void Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
|
||||
uint32_t GetElementAtPos(Vector2D<float> position, int32_t maxDistanceDetection);
|
||||
void SetEventInput(uint32_t id, Vector2D<float> position);
|
||||
uint32_t GetNearestEnemy(etk::Vector2D<float> position, int32_t groupId, float maxRange=9999999999999999.0);
|
||||
void GetNearestEnemy(etk::Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list);
|
||||
uint32_t GetNearestFriend(etk::Vector2D<float> position, int32_t groupId, uint32_t us);
|
||||
void GetNearestFriend(etk::Vector2D<float> position, int32_t groupId, float maxRange, etk::Vector<uint32_t>& list, uint32_t us);
|
||||
bool HaveImpact(int32_t group, int32_t type, etk::Vector2D<float> position, float size);
|
||||
void Explosion(int32_t group, int32_t type, etk::Vector2D<float> position, float pxAtenuation, float power);
|
||||
uint32_t GetElementAtPos(etk::Vector2D<float> position, int32_t maxDistanceDetection);
|
||||
void SetEventInput(uint32_t id, etk::Vector2D<float> position);
|
||||
void SetEventExternButton(uint32_t id, int32_t btId, int32_t state);
|
||||
void SetEventExternJoystick(uint32_t id, int32_t joyId, float angle, float distance, int32_t state);
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ void ewol::OObject2DColored::Draw(void)
|
||||
//glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix tmpMatrix = ewol::openGL::GetMatrix();
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
@ -110,7 +110,7 @@ void ewol::OObject2DColored::Clear(void)
|
||||
}
|
||||
|
||||
|
||||
void generatePolyGone(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2D<float> > & output )
|
||||
void generatePolyGone(etk::Vector<etk::Vector2D<float> > & input, etk::Vector<etk::Vector2D<float> > & output )
|
||||
{
|
||||
if (input.Size()<3) {
|
||||
return;
|
||||
@ -124,7 +124,7 @@ void generatePolyGone(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2
|
||||
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
|
||||
}
|
||||
|
||||
void SutherlandHodgman(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2D<float> > & output, float sx, float sy, float ex, float ey)
|
||||
void SutherlandHodgman(etk::Vector<etk::Vector2D<float> > & input, etk::Vector<etk::Vector2D<float> > & output, float sx, float sy, float ex, float ey)
|
||||
{
|
||||
// with Sutherland-Hodgman-Algorithm
|
||||
if (input.Size() <0) {
|
||||
@ -132,8 +132,8 @@ void SutherlandHodgman(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector
|
||||
}
|
||||
//int32_t sizeInit=input.Size();
|
||||
// last element :
|
||||
Vector2D<float> destPoint;
|
||||
Vector2D<float> lastElement = input[input.Size()-1];
|
||||
etk::Vector2D<float> destPoint;
|
||||
etk::Vector2D<float> lastElement = input[input.Size()-1];
|
||||
bool inside = true;
|
||||
if (lastElement.x < sx) {
|
||||
inside = false;
|
||||
@ -356,10 +356,10 @@ void ewol::OObject2DColored::SetColor(float red, float green, float blue, float
|
||||
|
||||
}
|
||||
|
||||
void ewol::OObject2DColored::SetPoint(Vector2D<float> point)
|
||||
void ewol::OObject2DColored::SetPoint(etk::Vector2D<float> point)
|
||||
{
|
||||
// TODO : Clean this :
|
||||
Vector2D<float> tmpElement;
|
||||
etk::Vector2D<float> tmpElement;
|
||||
tmpElement.x = point.x;
|
||||
tmpElement.y = point.y;
|
||||
m_triangle[m_triElement] = tmpElement;
|
||||
|
@ -43,7 +43,7 @@ namespace ewol {
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
#endif
|
||||
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
draw::Colorf m_color[3];
|
||||
@ -52,14 +52,14 @@ namespace ewol {
|
||||
draw::Color m_color[3];
|
||||
#endif
|
||||
int32_t m_triElement;
|
||||
Vector2D<float> m_triangle[3];
|
||||
etk::Vector2D<float> m_triangle[3];
|
||||
void GenerateTriangle(void);
|
||||
void ResetCount(void);
|
||||
public:
|
||||
void Clear(void);
|
||||
void SetColor(float red, float green, float blue, float alpha = 1.0);
|
||||
void SetColor(draw::Color color);
|
||||
void SetPoint(Vector2D<float> point);
|
||||
void SetPoint(etk::Vector2D<float> point);
|
||||
void SetPoint(float x, float y);
|
||||
void Line(float sx, float sy, float ex, float ey, float thickness);
|
||||
void Rectangle(float x, float y, float w, float h);
|
||||
|
@ -137,7 +137,7 @@ void ewol::OObject2DTextColored::Draw(void)
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix tmpMatrix = ewol::openGL::GetMatrix();
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_font->GetId());
|
||||
@ -175,7 +175,7 @@ void ewol::OObject2DTextColored::Clear(void)
|
||||
m_coordColor.Clear();
|
||||
}
|
||||
|
||||
int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const etk::UString& unicodeString)
|
||||
int32_t ewol::OObject2DTextColored::Text(etk::Vector2D<float> textPos, const etk::UString& unicodeString)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
@ -191,7 +191,7 @@ int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const etk::USt
|
||||
return size;
|
||||
}
|
||||
|
||||
int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const uniChar_t unicodeChar)
|
||||
int32_t ewol::OObject2DTextColored::Text(etk::Vector2D<float> textPos, const uniChar_t unicodeChar)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
@ -218,20 +218,20 @@ void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, fl
|
||||
m_color = draw::Color(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::OObject2DTextColored::GetSize(const uniChar_t unicodeChar)
|
||||
etk::Vector2D<float> ewol::OObject2DTextColored::GetSize(const uniChar_t unicodeChar)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
return Vector2D<float>(0,0);
|
||||
return etk::Vector2D<float>(0,0);
|
||||
}
|
||||
return m_font->GetSize(unicodeChar);
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::OObject2DTextColored::GetSize(const etk::UString& unicodeString)
|
||||
etk::Vector2D<float> ewol::OObject2DTextColored::GetSize(const etk::UString& unicodeString)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
return Vector2D<float>(0,0);
|
||||
return etk::Vector2D<float>(0,0);
|
||||
}
|
||||
return m_font->GetSize(unicodeString);
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ namespace ewol {
|
||||
void SetColor(draw::Color color);
|
||||
// set a specific text
|
||||
void Clear(void);
|
||||
int32_t Text(Vector2D<float> textPos, const etk::UString& unicodeString);
|
||||
int32_t Text(Vector2D<float> textPos, const uniChar_t unicodeChar);
|
||||
int32_t Text(etk::Vector2D<float> textPos, const etk::UString& unicodeString);
|
||||
int32_t Text(etk::Vector2D<float> textPos, const uniChar_t unicodeChar);
|
||||
protected:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
@ -55,7 +55,7 @@ namespace ewol {
|
||||
#endif
|
||||
ewol::TexturedFont* m_font; //!< ewol font system
|
||||
draw::Color m_color; //!< tmp text color ...
|
||||
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
@ -67,8 +67,8 @@ namespace ewol {
|
||||
void SetSize(int32_t fontSize);
|
||||
void SetFontProperty(etk::UString fontName, int32_t fontSize);
|
||||
int32_t GetHeight(void) { return (NULL!=m_font)?m_font->GetHeight():10; };
|
||||
Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
Vector2D<float> GetSize(const etk::UString& unicodeString);
|
||||
etk::Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
etk::Vector2D<float> GetSize(const etk::UString& unicodeString);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -143,7 +143,7 @@ void ewol::OObject2DTextShader::Draw(void)
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix tmpMatrix = ewol::openGL::GetMatrix();
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_font->GetId());
|
||||
@ -169,7 +169,7 @@ void ewol::OObject2DTextShader::Clear(void)
|
||||
m_coordColor.Clear();
|
||||
}
|
||||
|
||||
int32_t ewol::OObject2DTextShader::Text(Vector2D<float> textPos, const etk::UString& unicodeString)
|
||||
int32_t ewol::OObject2DTextShader::Text(etk::Vector2D<float> textPos, const etk::UString& unicodeString)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
@ -189,7 +189,7 @@ int32_t ewol::OObject2DTextShader::Text(Vector2D<float> textPos, const etk::UStr
|
||||
return size;
|
||||
}
|
||||
|
||||
int32_t ewol::OObject2DTextShader::Text(Vector2D<float> textPos, const uniChar_t unicodeChar)
|
||||
int32_t ewol::OObject2DTextShader::Text(etk::Vector2D<float> textPos, const uniChar_t unicodeChar)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
@ -220,20 +220,20 @@ void ewol::OObject2DTextShader::SetColor(float red, float green, float blue, flo
|
||||
m_color = draw::Color(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::OObject2DTextShader::GetSize(const uniChar_t unicodeChar)
|
||||
etk::Vector2D<float> ewol::OObject2DTextShader::GetSize(const uniChar_t unicodeChar)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
return Vector2D<float>(0,0);
|
||||
return etk::Vector2D<float>(0,0);
|
||||
}
|
||||
return m_font->GetSize(unicodeChar);
|
||||
}
|
||||
|
||||
Vector2D<float> ewol::OObject2DTextShader::GetSize(const etk::UString& unicodeString)
|
||||
etk::Vector2D<float> ewol::OObject2DTextShader::GetSize(const etk::UString& unicodeString)
|
||||
{
|
||||
if (m_font == NULL) {
|
||||
EWOL_ERROR("Font Id is not corectly defined");
|
||||
return Vector2D<float>(0,0);
|
||||
return etk::Vector2D<float>(0,0);
|
||||
}
|
||||
return m_font->GetSize(unicodeString);
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ namespace ewol {
|
||||
void SetColor(draw::Color color);
|
||||
// set a specific text
|
||||
void Clear(void);
|
||||
int32_t Text(Vector2D<float> textPos, const etk::UString& unicodeString);
|
||||
int32_t Text(Vector2D<float> textPos, const uniChar_t unicodeChar);
|
||||
int32_t Text(etk::Vector2D<float> textPos, const etk::UString& unicodeString);
|
||||
int32_t Text(etk::Vector2D<float> textPos, const uniChar_t unicodeChar);
|
||||
protected:
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
@ -58,7 +58,7 @@ namespace ewol {
|
||||
int32_t m_GLSoftEdge;
|
||||
ewol::DistantFieldFont* m_font; //!< ewol font system
|
||||
draw::Color m_color; //!< tmp text color ...
|
||||
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
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<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
bool m_bold;
|
||||
@ -70,8 +70,8 @@ namespace ewol {
|
||||
void SetSize(int32_t fontSize);
|
||||
void SetFontProperty(etk::UString fontName, int32_t fontSize);
|
||||
int32_t GetHeight(void) { return (NULL!=m_font)?m_font->GetHeight():10; };
|
||||
Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
Vector2D<float> GetSize(const etk::UString& unicodeString);
|
||||
etk::Vector2D<float> GetSize(const uniChar_t unicodeChar);
|
||||
etk::Vector2D<float> GetSize(const etk::UString& unicodeString);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@ ewol::OObject2DTextured::OObject2DTextured(etk::UString textureName, float sizeX
|
||||
{
|
||||
EWOL_VERBOSE("Create OObject textured : \"" << textureName << "\"");
|
||||
ewol::TextureFile* resourceFile = NULL;
|
||||
if (false == ewol::resource::Keep(textureName, resourceFile, Vector2D<int32_t>(sizeX,sizeY)) ) {
|
||||
if (false == ewol::resource::Keep(textureName, resourceFile, etk::Vector2D<int32_t>(sizeX,sizeY)) ) {
|
||||
EWOL_CRITICAL("can not get a resource Texture");
|
||||
}
|
||||
m_resource = resourceFile;
|
||||
@ -58,7 +58,7 @@ ewol::OObject2DTextured::OObject2DTextured( float sizeX, float sizeY)
|
||||
EWOL_CRITICAL("can not get a resource Texture");
|
||||
}
|
||||
if (NULL!=m_resource) {
|
||||
m_resource->SetImageSize(Vector2D<int32_t>(sizeX,sizeY));
|
||||
m_resource->SetImageSize(etk::Vector2D<int32_t>(sizeX,sizeY));
|
||||
draw::Image& tmpImage = m_resource->Get();
|
||||
tmpImage.SetFillColor(draw::color::black);
|
||||
tmpImage.Clear();
|
||||
@ -105,7 +105,7 @@ void ewol::OObject2DTextured::Draw(void)
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix tmpMatrix = ewol::openGL::GetMatrix();
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
|
||||
@ -159,7 +159,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
h -= 6;
|
||||
*/
|
||||
//EWOL_DEBUG("Add rectangle : ...");
|
||||
Vector2D<float> point;
|
||||
etk::Vector2D<float> point;
|
||||
texCoord_ts tex;
|
||||
|
||||
tex.u = texX;
|
||||
|
@ -50,7 +50,7 @@ namespace ewol {
|
||||
int32_t m_GLtexID;
|
||||
#endif
|
||||
ewol::Texture* m_resource; //!< texture resources
|
||||
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
|
@ -33,7 +33,7 @@
|
||||
ewol::OObject3DTextured::OObject3DTextured(etk::UString textureName, float sizeX, float sizeY)
|
||||
{
|
||||
EWOL_VERBOSE("Create OObject textured : \"" << textureName << "\"");
|
||||
if (false == ewol::resource::Keep(textureName, m_resource, Vector2D<int32_t>(sizeX,sizeY)) ) {
|
||||
if (false == ewol::resource::Keep(textureName, m_resource, etk::Vector2D<int32_t>(sizeX,sizeY)) ) {
|
||||
EWOL_CRITICAL("can not get a resource Texture");
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
@ -78,7 +78,7 @@ void ewol::OObject3DTextured::Draw(void)
|
||||
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix tmpMatrix = ewol::openGL::GetMatrix();
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
|
||||
@ -132,7 +132,7 @@ void ewol::OObject3DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
h -= 6;
|
||||
*/
|
||||
//EWOL_DEBUG("Add rectangle : ...");
|
||||
Vector3D<float> point;
|
||||
etk::Vector3D<float> point;
|
||||
texCoord_ts tex;
|
||||
point.z = 0;
|
||||
|
||||
|
@ -48,13 +48,13 @@ namespace ewol {
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
#endif
|
||||
ewol::TextureFile* m_resource; //!< texture resources
|
||||
etk::Vector<Vector3D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
ewol::TextureFile* m_resource; //!< texture resources
|
||||
etk::Vector<etk::Vector3D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
#else
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/font/Font.h>
|
||||
#include <etk/Vector.h>
|
||||
@ -47,14 +47,14 @@ namespace ewol {
|
||||
int32_t m_nbLoadedTime; //!< specific in case of non multiple allocation
|
||||
bool m_hasClipping;
|
||||
clipping_ts m_clipping;
|
||||
Vector2D<float> m_scaling; //!< scaling ol the object
|
||||
etk::Vector2D<float> m_scaling; //!< scaling ol the object
|
||||
public:
|
||||
OObject(void);
|
||||
virtual ~OObject(void);
|
||||
void clippingSet(clipping_ts clip) {m_clipping = clip; m_hasClipping = true;};
|
||||
void clippingDisable(void) {m_hasClipping = false;};
|
||||
void clippingEnable(void) {m_hasClipping = true;};
|
||||
void scalingSet(Vector2D<float> scale) {m_scaling = scale;};
|
||||
void scalingSet(etk::Vector2D<float> scale) {m_scaling = scale;};
|
||||
virtual void Draw(void) = 0;
|
||||
/**
|
||||
* @brief Increase the number of element registered on this class ==> this is specific to decrese the memory usage in special case (scene)
|
||||
|
@ -43,25 +43,25 @@ ewol::Sprite::~Sprite(void)
|
||||
|
||||
}
|
||||
|
||||
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle)
|
||||
void ewol::Sprite::Element(etk::Vector2D<float> pos, float size, float angle)
|
||||
{
|
||||
draw::Color tmpColor(0xFFFFFFFF);
|
||||
Vector3D<float> pos2;
|
||||
etk::Vector3D<float> pos2;
|
||||
pos2.x = pos.x;
|
||||
pos2.y = pos.y;
|
||||
pos2.z = 0.0;
|
||||
Element(pos2, size, angle, tmpColor);
|
||||
}
|
||||
|
||||
void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle)
|
||||
void ewol::Sprite::Element(etk::Vector3D<float> pos, float size, float angle)
|
||||
{
|
||||
draw::Color tmpColor(0xFFFFFFFF);
|
||||
Element(pos, size, angle, tmpColor);
|
||||
}
|
||||
|
||||
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle, draw::Color tmpColor)
|
||||
void ewol::Sprite::Element(etk::Vector2D<float> pos, float size, float angle, draw::Color tmpColor)
|
||||
{
|
||||
Vector3D<float> pos2;
|
||||
etk::Vector3D<float> pos2;
|
||||
pos2.x = pos.x;
|
||||
pos2.y = pos.y;
|
||||
pos2.z = 0.0;
|
||||
@ -69,7 +69,7 @@ void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle, draw::C
|
||||
}
|
||||
|
||||
|
||||
void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle, draw::Color tmpColor)
|
||||
void ewol::Sprite::Element(etk::Vector3D<float> pos, float size, float angle, draw::Color tmpColor)
|
||||
{
|
||||
angle -= M_PI/4;
|
||||
size *= 0.7;
|
||||
@ -88,7 +88,7 @@ void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle, draw::C
|
||||
#else
|
||||
draw::Color localColor = tmpColor;
|
||||
#endif
|
||||
Vector3D<float> point = pos;
|
||||
etk::Vector3D<float> point = pos;
|
||||
float yyySin = sin(angle) * size;
|
||||
float xxxCos = cos(angle) * size;
|
||||
|
||||
|
@ -36,10 +36,10 @@ namespace ewol {
|
||||
public:
|
||||
Sprite(etk::UString spriteName, float sizeX=-1, float sizeY=-1);
|
||||
virtual ~Sprite(void);
|
||||
void Element(Vector2D<float> pos, float size, float angle);
|
||||
void Element(Vector3D<float> pos, float size, float angle);
|
||||
void Element(Vector2D<float> pos, float size, float angle, draw::Color tmpColor);
|
||||
void Element(Vector3D<float> pos, float size, float angle, draw::Color tmpColor);
|
||||
void Element(etk::Vector2D<float> pos, float size, float angle);
|
||||
void Element(etk::Vector3D<float> pos, float size, float angle);
|
||||
void Element(etk::Vector2D<float> pos, float size, float angle, draw::Color tmpColor);
|
||||
void Element(etk::Vector3D<float> pos, float size, float angle, draw::Color tmpColor);
|
||||
bool HasName(etk::UString& name) { return name == m_name; };
|
||||
};
|
||||
};
|
||||
|
@ -301,7 +301,7 @@ void ewol::Program::SendAttribute(int32_t idElem, int32_t nbElement, void* point
|
||||
}
|
||||
|
||||
|
||||
void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix _matrix, bool transpose)
|
||||
void ewol::Program::UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix4 _matrix, bool transpose)
|
||||
{
|
||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||
EWOL_ERROR("idElem = " << idElem << " not in [0.." << (m_elementList.Size()-1) << "]");
|
||||
|
@ -57,7 +57,7 @@
|
||||
void SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample=0);
|
||||
int32_t GetUniform(etk::UString tmpElement);
|
||||
|
||||
void UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix pointer, bool transpose=true);
|
||||
void UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix4 pointer, bool transpose=true);
|
||||
|
||||
void Uniform1f(int32_t idElem, float value1);
|
||||
void Uniform2f(int32_t idElem, float value1, float value2);
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/openGL/Shader.h>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/openGL/VirtualBufferObject.h>
|
||||
|
||||
|
@ -68,13 +68,13 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
etk::Vector<etk::Matrix> l_matrixList;
|
||||
etk::Vector<etk::Matrix4> l_matrixList;
|
||||
|
||||
void ewol::openGL::Init(void)
|
||||
{
|
||||
// remove deprecated pb ...
|
||||
l_matrixList.Clear();
|
||||
etk::Matrix tmpMat;
|
||||
etk::Matrix4 tmpMat;
|
||||
l_matrixList.PushBack(tmpMat);
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ void ewol::openGL::UnInit(void)
|
||||
l_matrixList.Clear();
|
||||
}
|
||||
|
||||
void ewol::openGL::SetBasicMatrix(etk::Matrix& newOne)
|
||||
void ewol::openGL::SetBasicMatrix(etk::Matrix4& newOne)
|
||||
{
|
||||
if (l_matrixList.Size()!=1) {
|
||||
EWOL_ERROR("matrix is not corect size in the stack : " << l_matrixList.Size());
|
||||
@ -93,7 +93,7 @@ void ewol::openGL::SetBasicMatrix(etk::Matrix& newOne)
|
||||
l_matrixList.PushBack(newOne);
|
||||
}
|
||||
|
||||
void ewol::openGL::SetMatrix(etk::Matrix& newOne)
|
||||
void ewol::openGL::SetMatrix(etk::Matrix4& newOne)
|
||||
{
|
||||
if (l_matrixList.Size()==0) {
|
||||
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
|
||||
@ -107,11 +107,11 @@ void ewol::openGL::Push(void)
|
||||
{
|
||||
if (l_matrixList.Size()==0) {
|
||||
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
l_matrixList.PushBack(tmp);
|
||||
return;
|
||||
}
|
||||
etk::Matrix tmp = l_matrixList[l_matrixList.Size()-1];
|
||||
etk::Matrix4 tmp = l_matrixList[l_matrixList.Size()-1];
|
||||
l_matrixList.PushBack(tmp);
|
||||
}
|
||||
|
||||
@ -120,18 +120,18 @@ void ewol::openGL::Pop(void)
|
||||
if (l_matrixList.Size()<=1) {
|
||||
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
|
||||
l_matrixList.Clear();
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
l_matrixList.PushBack(tmp);
|
||||
return;
|
||||
}
|
||||
l_matrixList.PopBack();
|
||||
}
|
||||
|
||||
etk::Matrix& ewol::openGL::GetMatrix(void)
|
||||
etk::Matrix4& ewol::openGL::GetMatrix(void)
|
||||
{
|
||||
if (l_matrixList.Size()==0) {
|
||||
EWOL_ERROR("set matrix list is not corect size in the stack : " << l_matrixList.Size());
|
||||
etk::Matrix tmp;
|
||||
etk::Matrix4 tmp;
|
||||
l_matrixList.PushBack(tmp);
|
||||
}
|
||||
return l_matrixList[l_matrixList.Size()-1];
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef __OPEN_GL_H__
|
||||
#define __OPEN_GL_H__
|
||||
|
||||
#include <etk/Matrix.h>
|
||||
#include <etk/math/Matrix4.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -85,12 +85,12 @@ namespace ewol {
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
// reset the basic element at this one ... remove all previous
|
||||
void SetBasicMatrix(etk::Matrix& newOne);
|
||||
void SetBasicMatrix(etk::Matrix4& newOne);
|
||||
// this is the same system as openGL-ES-1 but in openGL-ES-2 (here is the abstraction)
|
||||
void SetMatrix(etk::Matrix& newOne);
|
||||
void SetMatrix(etk::Matrix4& newOne);
|
||||
void Push(void);
|
||||
void Pop(void);
|
||||
etk::Matrix& GetMatrix(void);
|
||||
etk::Matrix4& GetMatrix(void);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/MessageFifo.h>
|
||||
@ -41,7 +41,7 @@
|
||||
#include <ewol/font/FontManager.h>
|
||||
|
||||
static ewol::Windows* windowsCurrent = NULL;
|
||||
static Vector2D<int32_t> windowsSize(320, 480);
|
||||
static etk::Vector2D<int32_t> windowsSize(320, 480);
|
||||
static ewol::eSystemInput l_managementInput;
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ void ewolProcessEvents(void)
|
||||
case THREAD_INPUT_MOTION:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
|
||||
{
|
||||
Vector2D<float> pos;
|
||||
etk::Vector2D<float> pos;
|
||||
pos.x = data.input.x;
|
||||
pos.y = data.input.y;
|
||||
l_managementInput.Motion(data.input.type, data.input.pointerID, pos);
|
||||
@ -144,7 +144,7 @@ void ewolProcessEvents(void)
|
||||
case THREAD_INPUT_STATE:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
|
||||
{
|
||||
Vector2D<float> pos;
|
||||
etk::Vector2D<float> pos;
|
||||
pos.x = data.input.x;
|
||||
pos.y = data.input.y;
|
||||
l_managementInput.State(data.input.type, data.input.pointerID, data.input.state, pos);
|
||||
@ -583,7 +583,7 @@ ewol::Windows* eSystem::GetCurrentWindows(void)
|
||||
* @param ---
|
||||
* @return the current size ...
|
||||
*/
|
||||
Vector2D<int32_t> eSystem::GetSize(void)
|
||||
etk::Vector2D<int32_t> eSystem::GetSize(void)
|
||||
{
|
||||
return windowsSize;
|
||||
}
|
||||
@ -598,7 +598,7 @@ void eSystem::ForceRedrawAll(void)
|
||||
{
|
||||
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
|
||||
if (NULL != tmpWindows) {
|
||||
Vector2D<int32_t> tmpSize = eSystem::GetSize();
|
||||
etk::Vector2D<int32_t> tmpSize = eSystem::GetSize();
|
||||
tmpWindows->CalculateSize(tmpSize.x, tmpSize.y);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ namespace eSystem
|
||||
* @param ---
|
||||
* @return the current size ...
|
||||
*/
|
||||
Vector2D<int32_t> GetSize(void);
|
||||
etk::Vector2D<int32_t> GetSize(void);
|
||||
|
||||
/**
|
||||
* @brief Redraw all the windows
|
||||
|
@ -89,7 +89,7 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp
|
||||
* @param[in] pos position of the event
|
||||
* @return true if event has been greped
|
||||
*/
|
||||
bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::eSystemInput::localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
if (NULL != destWidget) {
|
||||
if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) {
|
||||
@ -221,7 +221,7 @@ 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, Vector2D<float> pos)
|
||||
void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, etk::Vector2D<float> pos)
|
||||
{
|
||||
// convert position in Open-GL coordonates ...
|
||||
pos.y = ewol::GetCurrentHeight() - pos.y;
|
||||
@ -312,7 +312,7 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D<float> pos)
|
||||
void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDown, etk::Vector2D<float> pos)
|
||||
{
|
||||
// convert position in Open-GL coordonates ...
|
||||
pos.y = ewol::GetCurrentHeight() - pos.y;
|
||||
|
@ -38,10 +38,10 @@ namespace ewol
|
||||
int32_t destinationInputId;
|
||||
int64_t lastTimeEvent;
|
||||
ewol::Widget* curentWidgetEvent;
|
||||
Vector2D<float> origin;
|
||||
Vector2D<float> size;
|
||||
Vector2D<float> downStart;
|
||||
Vector2D<float> posEvent;
|
||||
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
|
||||
@ -63,7 +63,7 @@ namespace ewol
|
||||
InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT];
|
||||
InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT];
|
||||
void CleanElement(InputPoperty_ts *eventTable, int32_t idInput);
|
||||
bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId);
|
||||
public:
|
||||
eSystemInput(void);
|
||||
@ -72,8 +72,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, Vector2D<float> pos );
|
||||
void State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D<float> pos);
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
|
@ -607,17 +607,17 @@ void guiInterface::KeyboardHide(void)
|
||||
SendJava_KeyboardShow(false);
|
||||
}
|
||||
|
||||
void guiInterface::ChangeSize(Vector2D<int32_t> size)
|
||||
void guiInterface::ChangeSize(etk::Vector2D<int32_t> size)
|
||||
{
|
||||
// The size can not be change on android platform
|
||||
}
|
||||
|
||||
void guiInterface::ChangePos(Vector2D<int32_t> size)
|
||||
void guiInterface::ChangePos(etk::Vector2D<int32_t> size)
|
||||
{
|
||||
// The position can not be change on Android platform
|
||||
}
|
||||
|
||||
void guiInterface::GetAbsPos(Vector2D<int32_t>& size)
|
||||
void guiInterface::GetAbsPos(etk::Vector2D<int32_t>& size)
|
||||
{
|
||||
size.x = 0;
|
||||
size.y = 0;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
#include <etk/TypesCoordonate.h>
|
||||
#include <etk/math/math.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/unicode.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
@ -106,7 +106,7 @@ void guiInterface::KeyboardHide(void)
|
||||
* @param size The requested size
|
||||
* @return ---
|
||||
*/
|
||||
void guiInterface::ChangeSize(Vector2D<int32_t> size)
|
||||
void guiInterface::ChangeSize(etk::Vector2D<int32_t> size)
|
||||
{
|
||||
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
int title_size = GetSystemMetrics(SM_CYCAPTION);
|
||||
@ -121,7 +121,7 @@ void guiInterface::ChangeSize(Vector2D<int32_t> size)
|
||||
* @param pos The position where the winsdows might be placed.
|
||||
* @return ---
|
||||
*/
|
||||
void guiInterface::ChangePos(Vector2D<int32_t> pos)
|
||||
void guiInterface::ChangePos(etk::Vector2D<int32_t> pos)
|
||||
{
|
||||
// TODO : Later
|
||||
}
|
||||
@ -131,7 +131,7 @@ void guiInterface::ChangePos(Vector2D<int32_t> pos)
|
||||
* @param pos The position where the winsdows is.
|
||||
* @return ---
|
||||
*/
|
||||
void guiInterface::GetAbsPos(Vector2D<int32_t>& size)
|
||||
void guiInterface::GetAbsPos(etk::Vector2D<int32_t>& size)
|
||||
{
|
||||
// TODO : Later
|
||||
size.x = 0;
|
||||
@ -346,7 +346,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
bool buttonIsDown = true;
|
||||
int32_t mouseButtonId = 0;
|
||||
Vector2D<int32_t> pos;
|
||||
etk::Vector2D<int32_t> pos;
|
||||
// to know all message : http://wiki.winehq.org/List_Of_Windows_Messages
|
||||
switch (message)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ bool CreateX11Context(void)
|
||||
XSetWMProtocols(m_display, WindowHandle, &m_delAtom, 1);
|
||||
}
|
||||
|
||||
Vector2D<int32_t> tmpSize(400, 300);
|
||||
etk::Vector2D<int32_t> tmpSize(400, 300);
|
||||
guiInterface::ChangeSize(tmpSize);
|
||||
|
||||
return true;
|
||||
@ -1088,7 +1088,7 @@ void guiInterface::KeyboardHide(void)
|
||||
* @param size The requested size
|
||||
* @return ---
|
||||
*/
|
||||
void guiInterface::ChangeSize(Vector2D<int32_t> size)
|
||||
void guiInterface::ChangeSize(etk::Vector2D<int32_t> size)
|
||||
{
|
||||
#ifdef DEBUG_X11_EVENT
|
||||
EWOL_INFO("X11: ChangeSize");
|
||||
@ -1102,7 +1102,7 @@ void guiInterface::ChangeSize(Vector2D<int32_t> size)
|
||||
* @param pos The position where the winsdows might be placed.
|
||||
* @return ---
|
||||
*/
|
||||
void guiInterface::ChangePos(Vector2D<int32_t> pos)
|
||||
void guiInterface::ChangePos(etk::Vector2D<int32_t> pos)
|
||||
{
|
||||
#ifdef DEBUG_X11_EVENT
|
||||
EWOL_INFO("X11: ChangePos");
|
||||
@ -1116,7 +1116,7 @@ void guiInterface::ChangePos(Vector2D<int32_t> pos)
|
||||
* @param pos The position where the winsdows is.
|
||||
* @return ---
|
||||
*/
|
||||
void guiInterface::GetAbsPos(Vector2D<int32_t>& pos)
|
||||
void guiInterface::GetAbsPos(etk::Vector2D<int32_t>& pos)
|
||||
{
|
||||
#ifdef DEBUG_X11_EVENT
|
||||
EWOL_INFO("X11: GetAbsPos");
|
||||
|
@ -52,19 +52,19 @@ namespace guiInterface
|
||||
* @param size The requested size
|
||||
* @return ---
|
||||
*/
|
||||
void ChangeSize(Vector2D<int32_t> size);
|
||||
void ChangeSize(etk::Vector2D<int32_t> size);
|
||||
/**
|
||||
* @brief Change the current Windows position
|
||||
* @param pos The position where the winsdows might be placed.
|
||||
* @return ---
|
||||
*/
|
||||
void ChangePos(Vector2D<int32_t> pos);
|
||||
void ChangePos(etk::Vector2D<int32_t> pos);
|
||||
/**
|
||||
* @brief Get the current Windows position
|
||||
* @param pos The position where the winsdows is.
|
||||
* @return ---
|
||||
*/
|
||||
void GetAbsPos(Vector2D<int32_t>& pos);
|
||||
void GetAbsPos(etk::Vector2D<int32_t>& pos);
|
||||
/**
|
||||
* @brief Display the virtal keyboard (for touch system only)
|
||||
* @param ---
|
||||
|
@ -123,7 +123,7 @@ void ewol::Texture::Flush(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Texture::SetImageSize(Vector2D<int32_t> newSize)
|
||||
void ewol::Texture::SetImageSize(etk::Vector2D<int32_t> newSize)
|
||||
{
|
||||
newSize.x = nextP2(newSize.x);
|
||||
newSize.y = nextP2(newSize.y);
|
||||
|
@ -39,7 +39,7 @@ namespace ewol {
|
||||
// OpenGl textureID :
|
||||
GLuint m_texId;
|
||||
// some image are not square ==> we need to sqared it to prevent some openGl api error the the displayable size is not all the time 0.0 -> 1.0
|
||||
Vector2D<float> m_endPointSize;
|
||||
etk::Vector2D<float> m_endPointSize;
|
||||
// internal state of the openGl system :
|
||||
bool m_loaded;
|
||||
// Ewol internal API:
|
||||
@ -50,14 +50,14 @@ namespace ewol {
|
||||
// middleware interface:
|
||||
public:
|
||||
GLuint GetId(void) { return m_texId; };
|
||||
Vector2D<float> GetUsableSize(void) { return m_endPointSize; };
|
||||
etk::Vector2D<float> GetUsableSize(void) { return m_endPointSize; };
|
||||
// Public API:
|
||||
public:
|
||||
Texture(etk::UString tmpName);
|
||||
~Texture(void);
|
||||
virtual const char* GetType(void) { return "ewol::Texture"; };
|
||||
// you must set the size here, because it will be set in multiple of pow(2)
|
||||
void SetImageSize(Vector2D<int32_t> newSize);
|
||||
void SetImageSize(etk::Vector2D<int32_t> newSize);
|
||||
// get the reference on this image to draw nomething on it ...
|
||||
inline draw::Image& Get(void) { return m_data; };
|
||||
// Flush the data to send it at the OpenGl system
|
||||
|
@ -135,7 +135,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag
|
||||
m_width = m_InfoHeader.biWidth;
|
||||
m_height = m_InfoHeader.biHeight;
|
||||
// reallocate the image
|
||||
ouputImage.Resize(Vector2D<int32_t>(m_width,m_height));
|
||||
ouputImage.Resize(etk::Vector2D<int32_t>(m_width,m_height));
|
||||
|
||||
uint8_t* m_data = NULL;
|
||||
if(0 != m_InfoHeader.biSizeImage)
|
||||
@ -161,7 +161,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag
|
||||
tmpColor.g = (int8_t)((*pointer & 0x07E0) >> 3);
|
||||
tmpColor.b = (int8_t)(*pointer << 3);
|
||||
tmpColor.a = 0xFF;
|
||||
ouputImage.Set(Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
ouputImage.Set(etk::Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
pointer++;
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag
|
||||
tmpColor.g = (int8_t)((*pointer & 0x03E0) >> 2);
|
||||
tmpColor.b = (int8_t)(*pointer << 3);
|
||||
tmpColor.a = 0xFF;
|
||||
ouputImage.Set(Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
ouputImage.Set(etk::Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
pointer++;
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag
|
||||
tmpColor.g = *pointer++;
|
||||
tmpColor.b = *pointer++;
|
||||
tmpColor.a = 0xFF;
|
||||
ouputImage.Set(Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
ouputImage.Set(etk::Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -206,7 +206,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag
|
||||
tmpColor.g = *pointer++;
|
||||
tmpColor.b = *pointer++;
|
||||
tmpColor.a = 0xFF;
|
||||
ouputImage.Set(Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
ouputImage.Set(etk::Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,7 +220,7 @@ void ewol::imageBMP::GenerateImage(etk::File & fileName, draw::Image & ouputImag
|
||||
tmpColor.g = *pointer++;
|
||||
tmpColor.b = *pointer++;
|
||||
tmpColor.a = *pointer++;
|
||||
ouputImage.Set(Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
ouputImage.Set(etk::Vector2D<int32_t>(xxx,yyy), tmpColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <draw/Image.h>
|
||||
|
||||
namespace ewol
|
||||
|
@ -32,7 +32,7 @@
|
||||
//#include <ewol/texture/TexturePNG.h>
|
||||
|
||||
|
||||
ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, Vector2D<int32_t> size) :
|
||||
ewol::TextureFile::TextureFile(etk::UString genName, etk::UString tmpfileName, etk::Vector2D<int32_t> size) :
|
||||
Texture(genName)
|
||||
{
|
||||
// load data
|
||||
|
@ -35,7 +35,7 @@ namespace ewol
|
||||
class TextureFile : public ewol::Texture
|
||||
{
|
||||
public:
|
||||
TextureFile(etk::UString genName, etk::UString fileName, Vector2D<int32_t> size);
|
||||
TextureFile(etk::UString genName, etk::UString fileName, etk::Vector2D<int32_t> size);
|
||||
~TextureFile(void) { };
|
||||
virtual const char* GetType(void) { return "ewol::TextureFile"; };
|
||||
};
|
||||
|
@ -41,7 +41,7 @@ ewol::texture::TextureSVG::TextureSVG(etk::File & fileName, int32_t width, int32
|
||||
m_loadOK = true;
|
||||
}
|
||||
if (width == -1) {
|
||||
Vector2D<float> elementSize = m_elementParsed.GetDefinedSize();
|
||||
etk::Vector2D<float> elementSize = m_elementParsed.GetDefinedSize();
|
||||
m_width = elementSize.x;
|
||||
m_height = elementSize.y;
|
||||
} else {
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/File.h>
|
||||
#include <etk/os/File.h>
|
||||
#include <parserSVG/parserSVG.h>
|
||||
|
||||
namespace ewol
|
||||
|
@ -106,14 +106,14 @@ void ewol::Button::SetImage(etk::UString imageName)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Button::SetPadding(Vector2D<float> newPadding)
|
||||
void ewol::Button::SetPadding(etk::Vector2D<float> newPadding)
|
||||
{
|
||||
m_padding = newPadding;
|
||||
}
|
||||
|
||||
bool ewol::Button::CalculateMinSize(void)
|
||||
{
|
||||
Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
m_minSize.x = m_padding.x*2 + minSize.x;
|
||||
m_minSize.y = m_padding.y*2 + minSize.y;
|
||||
// Add the image element ...
|
||||
@ -192,7 +192,7 @@ void ewol::Button::OnRegenerateDisplay(void)
|
||||
tmpSizeX -= 2*m_padding.x;
|
||||
tmpSizeY -= 2*m_padding.y;
|
||||
|
||||
Vector2D<float> textPos(tmpTextOriginX, tmpTextOriginY);
|
||||
etk::Vector2D<float> textPos(tmpTextOriginX, tmpTextOriginY);
|
||||
|
||||
/*ewol::OObject2DTextured * tmpImage = NULL;
|
||||
if (true == m_hasAnImage) {
|
||||
@ -230,7 +230,7 @@ void ewol::Button::OnRegenerateDisplay(void)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -62,7 +62,7 @@ namespace ewol {
|
||||
void SetValue(bool val);
|
||||
bool GetValue(void);
|
||||
void SetAlignement(textAlignement_te typeAlign);
|
||||
void SetPadding(Vector2D<float> newPadding);
|
||||
void SetPadding(etk::Vector2D<float> newPadding);
|
||||
void SetColorBg(draw::Color newColor) { m_textColorBg = newColor; };
|
||||
void SetColorFg(draw::Color newColor) { m_textColorFg = newColor; };
|
||||
private:
|
||||
@ -72,7 +72,7 @@ namespace ewol {
|
||||
bool m_hasAnImage;
|
||||
etk::UString m_imageSelected;
|
||||
textAlignement_te m_alignement;
|
||||
Vector2D<float> m_padding;
|
||||
etk::Vector2D<float> m_padding;
|
||||
etk::UString m_label;
|
||||
draw::Color m_textColorFg; //!< Text color
|
||||
draw::Color m_textColorBg; //!< Background color
|
||||
@ -88,7 +88,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
|
||||
|
@ -88,14 +88,14 @@ ewol::ButtonColor::~ButtonColor(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::ButtonColor::SetPadding(Vector2D<float> newPadding)
|
||||
void ewol::ButtonColor::SetPadding(etk::Vector2D<float> newPadding)
|
||||
{
|
||||
m_padding = newPadding;
|
||||
}
|
||||
|
||||
bool ewol::ButtonColor::CalculateMinSize(void)
|
||||
{
|
||||
Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
m_minSize.x = m_padding.x*2 + minSize.x;
|
||||
m_minSize.y = m_padding.y*2 + minSize.y;
|
||||
MarkToRedraw();
|
||||
@ -167,7 +167,7 @@ void ewol::ButtonColor::OnRegenerateDisplay(void)
|
||||
} else {
|
||||
m_textColorFg = draw::color::white;
|
||||
}
|
||||
Vector2D<float> textPos;
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = tmpTextOriginX;
|
||||
textPos.y = tmpTextOriginY;
|
||||
clipping_ts drawClipping;
|
||||
@ -195,7 +195,7 @@ void ewol::ButtonColor::OnRegenerateDisplay(void)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
@ -213,7 +213,7 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e
|
||||
return true;
|
||||
}
|
||||
// Get the button widget :
|
||||
Vector2D<float> newPosition;
|
||||
etk::Vector2D<float> newPosition;
|
||||
newPosition.x = m_origin.x + m_size.x/2;
|
||||
newPosition.y = m_origin.y;
|
||||
|
||||
|
@ -55,12 +55,12 @@ namespace ewol {
|
||||
void SetValue(bool val);
|
||||
bool GetValue(void);
|
||||
void SetAlignement(textAlignement_te typeAlign);
|
||||
void SetPadding(Vector2D<float> newPadding);
|
||||
void SetPadding(etk::Vector2D<float> newPadding);
|
||||
private:
|
||||
ewol::OObject2DTextColored m_oObjectText;
|
||||
ewol::OObject2DColored m_oObjectDecoration;
|
||||
textAlignement_te m_alignement;
|
||||
Vector2D<float> m_padding;
|
||||
etk::Vector2D<float> m_padding;
|
||||
etk::UString m_label;
|
||||
draw::Color m_textColorFg; //!< Text color
|
||||
draw::Color m_textColorBg; //!< Background color
|
||||
@ -79,7 +79,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
draw::Color GetCurrentColor(void) { return m_selectedColor; };
|
||||
void SetCurrentColor(draw::Color color);
|
||||
/**
|
||||
|
@ -212,7 +212,7 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
@ -246,7 +246,7 @@ bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, e
|
||||
} else if (0 == IdInput) {
|
||||
if( ewol::EVENT_INPUT_TYPE_ENTER == typeEvent
|
||||
|| ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
Vector2D<float> relPos = RelativePosition(pos);
|
||||
etk::Vector2D<float> relPos = RelativePosition(pos);
|
||||
|
||||
// check if over :
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
|
@ -81,7 +81,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ ewol::CheckBox::~CheckBox(void)
|
||||
|
||||
bool ewol::CheckBox::CalculateMinSize(void)
|
||||
{
|
||||
Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
float boxSize = etk_max(20, minSize.y) + 5;
|
||||
m_minSize.x = boxSize+minSize.x;
|
||||
m_minSize.y = etk_max(boxSize, minSize.y)+3;
|
||||
@ -110,14 +110,14 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
int32_t borderWidth = 2;
|
||||
|
||||
|
||||
Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
float boxSize = etk_max(20, minSize.y) + 5;
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - minSize.y - 6)/2 + 3;
|
||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||
|
||||
|
||||
Vector2D<float> textPos;
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = boxSize+5;
|
||||
textPos.y = posy;
|
||||
clipping_ts drawClipping;
|
||||
@ -150,7 +150,7 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on checkbox ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -71,7 +71,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
|
||||
|
@ -215,9 +215,9 @@ void ewol::ColorBar::OnRegenerateDisplay(void)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
Vector2D<float> relativePos = RelativePosition(pos);
|
||||
etk::Vector2D<float> relativePos = RelativePosition(pos);
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
relativePos.x = etk_max(etk_min(relativePos.x, m_size.x),0);
|
||||
|
@ -49,8 +49,8 @@ namespace ewol {
|
||||
void SetCurrentColor(draw::Color newOne);
|
||||
private:
|
||||
draw::Color m_currentColor;
|
||||
Vector2D<float> m_currentUserPos;
|
||||
Vector2D<float> m_padding;
|
||||
etk::Vector2D<float> m_currentUserPos;
|
||||
etk::Vector2D<float> m_padding;
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
@ -63,7 +63,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -64,8 +64,8 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY)
|
||||
m_size.y = availlableY;
|
||||
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> subWidgetSize;
|
||||
Vector2D<float> subWidgetOrigin;
|
||||
etk::Vector2D<float> subWidgetSize;
|
||||
etk::Vector2D<float> subWidgetOrigin;
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
@ -140,7 +140,7 @@ bool ewol::ContextMenu::CalculateMinSize(void)
|
||||
m_minSize.y = 50.0;
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
Vector2D<float> tmpSize = m_subWidget->GetMinSize();
|
||||
etk::Vector2D<float> tmpSize = m_subWidget->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
}
|
||||
@ -202,8 +202,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
|
||||
AddOObject(BGOObjects);
|
||||
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
etk::Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
etk::Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
|
||||
// display border ...
|
||||
BGOObjects->SetColor(m_colorBorder);
|
||||
@ -257,14 +257,14 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
|
||||
* @return NULL No widget found
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D<float> pos)
|
||||
ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
// calculate relative position
|
||||
Vector2D<float> relativePos = RelativePosition(pos);
|
||||
etk::Vector2D<float> relativePos = RelativePosition(pos);
|
||||
// Check for sub Element
|
||||
if (NULL != m_subWidget) {
|
||||
Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
etk::Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
etk::Vector2D<float> tmpOrigin = m_subWidget->GetOrigin();
|
||||
if( (tmpOrigin.x <= relativePos.x && tmpOrigin.x + tmpSize.x >= relativePos.x)
|
||||
&& (tmpOrigin.y <= relativePos.y && tmpOrigin.y + tmpSize.y >= relativePos.y) )
|
||||
{
|
||||
@ -283,7 +283,7 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(Vector2D<float> pos)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_INFO("Event ouside the context menu");
|
||||
if (IdInput > 0) {
|
||||
@ -304,7 +304,7 @@ bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, e
|
||||
}
|
||||
|
||||
|
||||
void ewol::ContextMenu::SetPositionMark(markPosition_te position, Vector2D<float> arrowPos)
|
||||
void ewol::ContextMenu::SetPositionMark(markPosition_te position, etk::Vector2D<float> arrowPos)
|
||||
{
|
||||
EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")");
|
||||
m_arrawBorder = position;
|
||||
|
@ -59,15 +59,15 @@ namespace ewol {
|
||||
private:
|
||||
draw::Color m_colorBackGroung;
|
||||
draw::Color m_colorBorder;
|
||||
Vector2D<float> m_padding;
|
||||
Vector2D<float> m_arrowPos;
|
||||
etk::Vector2D<float> m_padding;
|
||||
etk::Vector2D<float> m_arrowPos;
|
||||
float m_offset;
|
||||
markPosition_te m_arrawBorder;
|
||||
ewol::Widget* m_subWidget;
|
||||
public:
|
||||
void SubWidgetSet(ewol::Widget* newWidget);
|
||||
void SubWidgetRemove(void);
|
||||
void SetPositionMark(markPosition_te position, Vector2D<float> arrowPos);
|
||||
void SetPositionMark(markPosition_te position, etk::Vector2D<float> arrowPos);
|
||||
protected:
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
@ -79,7 +79,7 @@ namespace ewol {
|
||||
* @return NULL No widget found
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
|
||||
virtual ewol::Widget * GetWidgetAtPos(etk::Vector2D<float> pos);
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
@ -89,7 +89,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -137,7 +137,7 @@ etk::UString ewol::Entry::GetValue(void)
|
||||
|
||||
void ewol::Entry::SetPoint(float x, float y)
|
||||
{
|
||||
Vector2D<float> triangle(x, y);
|
||||
etk::Vector2D<float> triangle(x, y);
|
||||
m_coord.PushBack(triangle);
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ void ewol::Entry::OnDraw(DrawProperty& displayProp)
|
||||
//glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix tmpMatrix = ewol::openGL::GetMatrix();
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
@ -268,7 +268,7 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
||||
tmpSizeY -= 2*m_paddingSize;
|
||||
|
||||
|
||||
Vector2D<float> textPos;
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = tmpTextOriginX + m_displayStartPosition;
|
||||
textPos.y = tmpTextOriginY;
|
||||
clipping_ts drawClipping;
|
||||
@ -303,9 +303,9 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
||||
m_oObjectDecoration.SetColor(m_textColorFg);
|
||||
m_oObjectDecoration.clippingSet(drawClipping);
|
||||
etk::UString tmpDisplay = m_data.Extract(0, pos1);
|
||||
Vector2D<int32_t> minSize = m_oObjectText.GetSize(tmpDisplay);
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(tmpDisplay);
|
||||
tmpDisplay = m_data.Extract(0, pos2);
|
||||
Vector2D<int32_t> maxSize = m_oObjectText.GetSize(tmpDisplay);
|
||||
etk::Vector2D<int32_t> maxSize = m_oObjectText.GetSize(tmpDisplay);
|
||||
|
||||
int32_t XPos = minSize.x + m_borderSize + 2*m_paddingSize + m_displayStartPosition;
|
||||
int32_t XPosEnd = maxSize.x + m_borderSize + 2*m_paddingSize + m_displayStartPosition;
|
||||
@ -318,7 +318,7 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
||||
if (true == m_displayCursor) {
|
||||
m_oObjectDecoration.SetColor(m_textColorFg);
|
||||
etk::UString tmpDisplay = m_data.Extract(0, m_displayCursorPos);
|
||||
Vector2D<int32_t> minSize = m_oObjectText.GetSize(tmpDisplay);
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(tmpDisplay);
|
||||
int32_t XCursorPos = minSize.x + m_borderSize + 2*m_paddingSize + m_displayStartPosition;
|
||||
if (XCursorPos >= m_borderSize + 2*m_paddingSize) {
|
||||
m_oObjectDecoration.Line(XCursorPos, tmpTextOriginY, XCursorPos, tmpTextOriginY + minSize.y, 1);
|
||||
@ -333,9 +333,9 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
||||
* @note The display is automaticly requested when change apear.
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::Entry::UpdateCursorPosition(Vector2D<float>& pos, bool selection)
|
||||
void ewol::Entry::UpdateCursorPosition(etk::Vector2D<float>& pos, bool selection)
|
||||
{
|
||||
Vector2D<float> relPos = RelativePosition(pos);
|
||||
etk::Vector2D<float> relPos = RelativePosition(pos);
|
||||
relPos.x += -m_displayStartPosition - 2*m_paddingSize - m_borderSize;
|
||||
// try to find the new cursor position :
|
||||
etk::UString tmpDisplay = m_data.Extract(0, m_displayStartPosition);
|
||||
@ -424,7 +424,7 @@ void ewol::Entry::CopySelectionToClipBoard(ewol::clipBoard::clipboardListe_te cl
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on Entry ... type=" << (int32_t)type << " id=" << IdInput);
|
||||
if (1 == IdInput) {
|
||||
|
@ -58,7 +58,7 @@ namespace ewol {
|
||||
float m_pos[4];
|
||||
int32_t m_GLposText;
|
||||
int32_t m_GLstate;
|
||||
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
draw::Colorf m_color[3];
|
||||
void SetPoint(float x, float y);
|
||||
void Rectangle(float x, float y, float w, float h);
|
||||
@ -121,7 +121,7 @@ namespace ewol {
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos);
|
||||
/**
|
||||
* @brief Event on the keybord (if no shortcut has been detected before).
|
||||
* @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP)
|
||||
@ -164,7 +164,7 @@ namespace ewol {
|
||||
* @note The display is automaticly requested when change apear.
|
||||
* @return ---
|
||||
*/
|
||||
virtual void UpdateCursorPosition(Vector2D<float>& pos, bool Selection=false);
|
||||
virtual void UpdateCursorPosition(etk::Vector2D<float>& pos, bool Selection=false);
|
||||
/**
|
||||
* @brief Update the display position start ==> depending of the position of the Cursor and the size of the Data inside
|
||||
* @param ---
|
||||
|
@ -80,7 +80,7 @@ ewol::Image::~Image(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Image::SetPadding(Vector2D<float> newPadding)
|
||||
void ewol::Image::SetPadding(etk::Vector2D<float> newPadding)
|
||||
{
|
||||
m_padding = newPadding;
|
||||
}
|
||||
@ -153,7 +153,7 @@ void ewol::Image::OnRegenerateDisplay(void)
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos)
|
||||
bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user