Maybe a not good modif ...

This commit is contained in:
Edouard Dupin 2012-04-26 18:18:06 +02:00
parent 7b94a21fca
commit d489e1df83
3 changed files with 20 additions and 18 deletions
Sources
libewol/ewol/Game
libparsersvg/parserSVG

@ -31,7 +31,7 @@
* @param --- * @param ---
* @return --- * @return ---
*/ */
ewol::GameElement::GameElement(SceneElement & sceneElement) : m_sceneElement(sceneElement) ewol::GameElement::GameElement(SceneElement & sceneElement, etk::UString& tmpName) : m_sceneElement(sceneElement), m_fileNameConfig(tmpName)
{ {
m_group = -1; m_group = -1;
m_type = -1; m_type = -1;

@ -35,24 +35,25 @@ namespace ewol {
class GameElement class GameElement
{ {
private:
etk::UString m_fileNameConfig;
protected: protected:
SceneElement & m_sceneElement; //!< all element neede in the scene SceneElement & m_sceneElement; //!< all element neede in the scene
protected: int32_t m_group;
int32_t m_group; int32_t m_type;
int32_t m_type; bool m_visible;
bool m_visible; coord2D_ts m_position;
coord2D_ts m_position; coord2D_ts m_speed;
coord2D_ts m_speed; etkFloat_t m_size;
etkFloat_t m_size; etkFloat_t m_angle;
etkFloat_t m_angle; etkFloat_t m_gravity;
etkFloat_t m_gravity;
public: public:
/** /**
* @brief Constructor : here are requested all the needed sprite and effect that can be used in the game * @brief Constructor : here are requested all the needed sprite and effect that can be used in the game
* @param --- * @param ---
* @return --- * @return ---
*/ */
GameElement(SceneElement & sceneElement); GameElement(SceneElement & sceneElement, etk::UString& tmpName);
/** /**
* @brief Destructor : This does not remove the sprite requested, they will be supressed when the scene is removed ... * @brief Destructor : This does not remove the sprite requested, they will be supressed when the scene is removed ...
* @param --- * @param ---
@ -60,6 +61,7 @@ namespace ewol {
*/ */
virtual ~GameElement(void) { }; virtual ~GameElement(void) { };
bool HasName(etk::UString tmpName) { return (tmpName == m_fileNameConfig); };
bool IsVisible(void) { return m_visible; }; bool IsVisible(void) { return m_visible; };
void SetVisible(bool state) { m_visible = state; }; void SetVisible(bool state) { m_visible = state; };
coord2D_ts PositionGet(void) { return m_position; }; coord2D_ts PositionGet(void) { return m_position; };

@ -299,38 +299,38 @@ void svg::Base::ParsePaintAttr(const TiXmlNode *node)
for( const char *sss=extractPartOfStyle(content, outputType, outputValue, 1024); for( const char *sss=extractPartOfStyle(content, outputType, outputValue, 1024);
NULL != sss; NULL != sss;
sss=extractPartOfStyle(sss, outputType, outputValue, 1024) ) { sss=extractPartOfStyle(sss, outputType, outputValue, 1024) ) {
SVG_INFO(" style parse : \"" << outputType << "\" with value : \"" << outputValue << "\""); SVG_VERBOSE(" style parse : \"" << outputType << "\" with value : \"" << outputValue << "\"");
if (0 == strcmp(outputType, "fill") ) { if (0 == strcmp(outputType, "fill") ) {
m_paint.fill = ParseColor(outputValue); m_paint.fill = ParseColor(outputValue);
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); SVG_VERBOSE(" input : \"" << outputValue << "\" ==> " << m_paint.fill);
if (m_paint.fill.alpha == 0) { if (m_paint.fill.alpha == 0) {
fillNone = true; fillNone = true;
} }
} else if (0 == strcmp(outputType, "stroke") ) { } else if (0 == strcmp(outputType, "stroke") ) {
m_paint.stroke = ParseColor(outputValue); m_paint.stroke = ParseColor(outputValue);
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke); SVG_VERBOSE(" input : \"" << outputValue << "\" ==> " << m_paint.stroke);
if (m_paint.stroke.alpha == 0) { if (m_paint.stroke.alpha == 0) {
strokeNone = true; strokeNone = true;
} }
} else if (0 == strcmp(outputType, "stroke-width") ) { } else if (0 == strcmp(outputType, "stroke-width") ) {
m_paint.strokeWidth = ParseLength(outputValue); m_paint.strokeWidth = ParseLength(outputValue);
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.strokeWidth); SVG_VERBOSE(" input : \"" << outputValue << "\" ==> " << m_paint.strokeWidth);
} else if (0 == strcmp(outputType, "opacity") ) { } else if (0 == strcmp(outputType, "opacity") ) {
etkFloat_t opacity = ParseLength(outputValue); etkFloat_t opacity = ParseLength(outputValue);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = etk_max(0.0, etk_min(1.0, opacity));
m_paint.fill.alpha = opacity*0xFF; m_paint.fill.alpha = opacity*0xFF;
m_paint.stroke.alpha = opacity*0xFF; m_paint.stroke.alpha = opacity*0xFF;
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); SVG_VERBOSE(" input : \"" << outputValue << "\" ==> " << m_paint.fill);
} else if (0 == strcmp(outputType, "fill-opacity") ) { } else if (0 == strcmp(outputType, "fill-opacity") ) {
etkFloat_t opacity = ParseLength(outputValue); etkFloat_t opacity = ParseLength(outputValue);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = etk_max(0.0, etk_min(1.0, opacity));
m_paint.fill.alpha = opacity*0xFF; m_paint.fill.alpha = opacity*0xFF;
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); SVG_VERBOSE(" input : \"" << outputValue << "\" ==> " << m_paint.fill);
} else if (0 == strcmp(outputType, "stroke-opacity") ) { } else if (0 == strcmp(outputType, "stroke-opacity") ) {
etkFloat_t opacity = ParseLength(outputValue); etkFloat_t opacity = ParseLength(outputValue);
opacity = etk_max(0.0, etk_min(1.0, opacity)); opacity = etk_max(0.0, etk_min(1.0, opacity));
m_paint.stroke.alpha = opacity*0xFF; m_paint.stroke.alpha = opacity*0xFF;
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke); SVG_VERBOSE(" input : \"" << outputValue << "\" ==> " << m_paint.stroke);
} else if (0 == strcmp(outputType, "fill-rule") ) { } else if (0 == strcmp(outputType, "fill-rule") ) {
if (0 == strcmp(outputValue, "nonzero") ) { if (0 == strcmp(outputValue, "nonzero") ) {
m_paint.flagEvenOdd = false; m_paint.flagEvenOdd = false;