[DEV] init random and set public the setter of text program on text

This commit is contained in:
Edouard DUPIN 2014-02-19 21:10:53 +01:00
parent 0cf3f29466
commit b20f6db4ea
5 changed files with 25 additions and 29 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 7f26881c3e8e26b1813b039b6ffd973a5126d1a4 Subproject commit 89d9bc87ad5570400a54be781b6750dabcbafd35

View File

@ -53,6 +53,7 @@ ewol::compositing::TextBase::~TextBase(void) {
void ewol::compositing::TextBase::loadProgram(const std::string& _shaderName) { void ewol::compositing::TextBase::loadProgram(const std::string& _shaderName) {
// get the shader resource : // get the shader resource :
m_GLPosition = 0; m_GLPosition = 0;
ewol::resource::Program* old = m_GLprogram;
m_GLprogram = ewol::resource::Program::keep(_shaderName); m_GLprogram = ewol::resource::Program::keep(_shaderName);
if (m_GLprogram != NULL) { if (m_GLprogram != NULL) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d"); m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
@ -62,7 +63,13 @@ void ewol::compositing::TextBase::loadProgram(const std::string& _shaderName) {
m_GLtexID = m_GLprogram->getUniform("EW_texID"); m_GLtexID = m_GLprogram->getUniform("EW_texID");
m_GLtextWidth = m_GLprogram->getUniform("EW_texWidth"); m_GLtextWidth = m_GLprogram->getUniform("EW_texWidth");
m_GLtextHeight = m_GLprogram->getUniform("EW_texHeight"); m_GLtextHeight = m_GLprogram->getUniform("EW_texHeight");
} else {
EWOL_ERROR("Can not load the program => keep previous one...");
m_GLprogram = old;
old = NULL;
} }
// Release old program if needed ...
ewol::resource::Program::release(old);
} }
void ewol::compositing::TextBase::translate(const vec3& _vect) { void ewol::compositing::TextBase::translate(const vec3& _vect) {

View File

@ -92,7 +92,7 @@ namespace ewol {
std::vector<vec3 > m_coord; //!< internal coord of the object std::vector<vec3 > m_coord; //!< internal coord of the object
std::vector<vec2 > m_coordTex; //!< internal texture coordinate for every point std::vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
std::vector<etk::Color<float> > m_coordColor; //!< internal color of the different point std::vector<etk::Color<float> > m_coordColor; //!< internal color of the different point
protected: public:
/** /**
* @brief load the openGL program and get all the ID needed * @brief load the openGL program and get all the ID needed
*/ */
@ -117,9 +117,7 @@ namespace ewol {
void draw(bool _disableDepthTest=true) { void draw(bool _disableDepthTest=true) {
drawD(_disableDepthTest); drawD(_disableDepthTest);
} }
/** //! @previous
* @previous
*/
void draw(const mat4& _transformationMatrix, bool _enableDepthTest=false) { void draw(const mat4& _transformationMatrix, bool _enableDepthTest=false) {
drawMT(_transformationMatrix, _enableDepthTest); drawMT(_transformationMatrix, _enableDepthTest);
} }
@ -127,9 +125,7 @@ namespace ewol {
* @brief draw All the refistered text in the current element on openGL * @brief draw All the refistered text in the current element on openGL
*/ */
virtual void drawD(bool _disableDepthTest) = 0; virtual void drawD(bool _disableDepthTest) = 0;
/** //! @previous
* @previous
*/
virtual void drawMT(const mat4& _transformationMatrix, bool _enableDepthTest) = 0; virtual void drawMT(const mat4& _transformationMatrix, bool _enableDepthTest) = 0;
/** /**
* @brief clear all the registered element in the current element * @brief clear all the registered element in the current element
@ -151,9 +147,7 @@ namespace ewol {
* @param[in] _pos Position of the text (in 3D) * @param[in] _pos Position of the text (in 3D)
*/ */
void setPos(const vec3& _pos); void setPos(const vec3& _pos);
/** //! @previous
* @previous
*/
inline void setPos(const vec2& _pos) { inline void setPos(const vec2& _pos) {
setPos(vec3(_pos.x(),_pos.y(),0)); setPos(vec3(_pos.x(),_pos.y(),0));
}; };
@ -162,9 +156,7 @@ namespace ewol {
* @param[in] _pos ofset apply of the text (in 3D) * @param[in] _pos ofset apply of the text (in 3D)
*/ */
void setRelPos(const vec3& _pos); void setRelPos(const vec3& _pos);
/** //! @previous
* @previous
*/
inline void setRelPos(const vec2& _pos) { inline void setRelPos(const vec2& _pos) {
setRelPos(vec3(_pos.x(),_pos.y(),0)); setRelPos(vec3(_pos.x(),_pos.y(),0));
}; };
@ -202,9 +194,7 @@ namespace ewol {
void setClippingWidth(const vec3& _pos, const vec3& _width) { void setClippingWidth(const vec3& _pos, const vec3& _width) {
setClipping(_pos, _pos+_width); setClipping(_pos, _pos+_width);
} }
/** //! @previous
* @previous
*/
void setClippingWidth(const vec2& _pos, const vec2& _width) { void setClippingWidth(const vec2& _pos, const vec2& _width) {
setClipping(_pos, _pos+_width); setClipping(_pos, _pos+_width);
}; };
@ -214,9 +204,7 @@ namespace ewol {
* @param[in] _posEnd End position of the clipping * @param[in] _posEnd End position of the clipping
*/ */
void setClipping(const vec3& _pos, const vec3& _posEnd); void setClipping(const vec3& _pos, const vec3& _posEnd);
/** //! @previous
* @previous
*/
void setClipping(const vec2& _pos, const vec2& _posEnd) { void setClipping(const vec2& _pos, const vec2& _posEnd) {
setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) ); setClipping(vec3(_pos.x(),_pos.y(),-1), vec3(_posEnd.x(),_posEnd.y(),1) );
}; };
@ -277,9 +265,7 @@ namespace ewol {
* @param[in] _text The string to display. * @param[in] _text The string to display.
*/ */
void print(const std::string& _text); void print(const std::string& _text);
/** //! @previous
* @previous
*/
void print(const std::u32string& _text); void print(const std::u32string& _text);
/** /**
* @brief display a compleat string in the current element with the generic decoration specification. (basic html data) * @brief display a compleat string in the current element with the generic decoration specification. (basic html data)
@ -396,7 +382,7 @@ namespace ewol {
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 calculateSizeHTML(const std::string& _text); vec3 calculateSizeHTML(const std::string& _text);
//!@previous //! @previous
vec3 calculateSizeHTML(const std::u32string& _text); vec3 calculateSizeHTML(const std::u32string& _text);
/** /**
* @brief calculate a theoric text size * @brief calculate a theoric text size
@ -404,7 +390,7 @@ namespace ewol {
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 calculateSizeDecorated(const std::string& _text); vec3 calculateSizeDecorated(const std::string& _text);
//!@previous //! @previous
vec3 calculateSizeDecorated(const std::u32string& _text); vec3 calculateSizeDecorated(const std::u32string& _text);
/** /**
* @brief calculate a theoric text size * @brief calculate a theoric text size
@ -412,7 +398,7 @@ namespace ewol {
* @return The theoric size used. * @return The theoric size used.
*/ */
vec3 calculateSize(const std::string& _text); vec3 calculateSize(const std::string& _text);
//!@previous //! @previous
vec3 calculateSize(const std::u32string& _text); vec3 calculateSize(const std::u32string& _text);
/** /**
* @brief calculate a theoric charcode size * @brief calculate a theoric charcode size
@ -445,9 +431,7 @@ namespace ewol {
* @return false if we find '\n' * @return false if we find '\n'
*/ */
bool extrapolateLastId(const std::string& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace); bool extrapolateLastId(const std::string& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
/** //! @previous
* @previous
*/
bool extrapolateLastId(const std::u32string& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace); bool extrapolateLastId(const std::u32string& _text, const int32_t _start, int32_t& _stop, int32_t& _space, int32_t& _freeSpace);
protected: protected:
// this section is reserved for HTML parsing and display: // this section is reserved for HTML parsing and display:

View File

@ -10,6 +10,7 @@
#include <etk/types.h> #include <etk/types.h>
#include <etk/tool.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
#include <etk/os/Mutex.h> #include <etk/os/Mutex.h>
@ -29,6 +30,7 @@
#include <ewol/widget/Manager.h> #include <ewol/widget/Manager.h>
/** /**
* @brief get the main ewol mutex (event or periodic call mutex). * @brief get the main ewol mutex (event or periodic call mutex).
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time. * @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
@ -289,6 +291,8 @@ ewol::Context::Context(int32_t _argc, const char* _argv[]) :
m_windowsSize(320,480) { m_windowsSize(320,480) {
m_commandLine.parse(_argc, _argv); m_commandLine.parse(_argc, _argv);
EWOL_INFO(" == > Ewol system init (BEGIN)"); EWOL_INFO(" == > Ewol system init (BEGIN)");
// Reset the random system to be sure have real random values...
etk::tool::resetRandom();
// set the curent interface : // set the curent interface :
lockContext(); lockContext();
// By default we set 2 themes (1 color and 1 shape ...) : // By default we set 2 themes (1 color and 1 shape ...) :

View File

@ -39,6 +39,7 @@ ewol::widget::Label::Label(std::string _newLabel) :
m_label = std::to_u32string(_newLabel); m_label = std::to_u32string(_newLabel);
addEventId(eventPressed); addEventId(eventPressed);
setCanHaveFocus(false); setCanHaveFocus(false);
setMouseLimit(1);
registerConfig(configValue, "string", NULL, "displayed value string"); // TODO : do not store in attibute... registerConfig(configValue, "string", NULL, "displayed value string"); // TODO : do not store in attibute...
} }