[DEV] add Windows background color and image rotation
This commit is contained in:
parent
7cb1648d6e
commit
371a3cb599
2
build
2
build
@ -1 +1 @@
|
||||
Subproject commit 6db445d6ee504d00c63955b33ca5137296052cc1
|
||||
Subproject commit fbdf561438abd90fc713b6395d56784a33a76067
|
@ -19,7 +19,6 @@ ewol::Image::Image(const etk::UString& _imageName) :
|
||||
m_clippingPosStop(0.0, 0.0, 0.0),
|
||||
m_clippingEnable(false),
|
||||
m_color(etk::color::white),
|
||||
m_axes(0.0, 0.0, 0.0),
|
||||
m_angle(0.0),
|
||||
m_GLprogram(NULL),
|
||||
m_GLPosition(-1),
|
||||
@ -101,7 +100,6 @@ void ewol::Image::Clear(void)
|
||||
m_clippingPosStop = vec3(0.0, 0.0, 0.0);
|
||||
m_clippingEnable = false;
|
||||
m_color = etk::color::white;
|
||||
m_axes = vec3(0.0, 0.0, 0.0);
|
||||
m_angle = 0.0;
|
||||
}
|
||||
|
||||
@ -132,110 +130,107 @@ void ewol::Image::SetClipping(const vec3& _pos, vec3 _posEnd)
|
||||
m_clippingEnable = true;
|
||||
}
|
||||
|
||||
void ewol::Image::SetAngle(const vec3& _axes, float _angle)
|
||||
void ewol::Image::SetAngle(float _angle)
|
||||
{
|
||||
m_axes = _axes;
|
||||
m_angle = _angle;
|
||||
if( m_axes.x() == 0
|
||||
&& m_axes.y() == 0
|
||||
&& m_axes.z() == 0) {
|
||||
m_angle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::Image::Print(const vec2& _size)
|
||||
{
|
||||
#if 1
|
||||
PrintPart(_size, vec2(0,0), vec2(1,1));
|
||||
#else
|
||||
vec3 point(0,0,0);
|
||||
vec2 tex(0,1);
|
||||
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.setValue(1,1);
|
||||
point.setX(m_position.x() + _size.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.setValue(1,0);
|
||||
point.setX(m_position.x() + _size.x());
|
||||
point.setY(m_position.y() + _size.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
tex.setValue(0,0);
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y() + _size.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
tex.setValue(0,1);
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
#endif
|
||||
PrintPart(_size, vec2(0,0), vec2(1,1));
|
||||
}
|
||||
|
||||
void ewol::Image::PrintPart(const vec2& _size,
|
||||
const vec2& _sourcePosStart,
|
||||
const vec2& _sourcePosStop)
|
||||
{
|
||||
if (m_angle==0.0f) {
|
||||
vec3 point(0,0,0);
|
||||
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
|
||||
point.setX(m_position.x() + _size.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
|
||||
point.setX(m_position.x() + _size.x());
|
||||
point.setY(m_position.y() + _size.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y() + _size.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
return;
|
||||
}
|
||||
vec3 center = m_position + vec3(_size.x(),_size.y(),0)/2.0f;
|
||||
vec3 limitedSize(_size.x()*0.5f, _size.y()*0.5f, 0.0f);
|
||||
|
||||
vec3 point(0,0,0);
|
||||
vec2 tex(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
|
||||
point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
|
||||
point = point.rotate(vec3(0,0,1), m_angle) + center;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
|
||||
|
||||
tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
|
||||
point.setX(m_position.x() + _size.x());
|
||||
point.setY(m_position.y());
|
||||
point.setValue(limitedSize.x(), -limitedSize.y(), 0);
|
||||
point = point.rotate(vec3(0,0,1), m_angle) + center;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
|
||||
|
||||
tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
|
||||
point.setX(m_position.x() + _size.x());
|
||||
point.setY(m_position.y() + _size.y());
|
||||
point.setValue(limitedSize.x(), limitedSize.y(), 0);
|
||||
point = point.rotate(vec3(0,0,1), m_angle) + center;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y() + _size.y());
|
||||
point.setValue(-limitedSize.x(), limitedSize.y(), 0);
|
||||
point = point.rotate(vec3(0,0,1), m_angle) + center;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
||||
|
||||
tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
|
||||
point.setX(m_position.x());
|
||||
point.setY(m_position.y());
|
||||
point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
|
||||
point = point.rotate(vec3(0,0,1), m_angle) + center;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(m_color);
|
||||
|
@ -24,7 +24,6 @@ namespace ewol
|
||||
bool m_clippingEnable; //!< true if the clipping must be activated
|
||||
private:
|
||||
etk::Color<> m_color; //!< The text foreground color
|
||||
vec3 m_axes; //!< Rotation axes (instant)
|
||||
float m_angle; //!< Angle to set at the axes
|
||||
private:
|
||||
ewol::Program* m_GLprogram; //!< pointer on the opengl display program
|
||||
@ -105,10 +104,9 @@ namespace ewol
|
||||
void SetClippingMode(bool _newMode) { m_clippingEnable = _newMode; };
|
||||
/**
|
||||
* @brief Set a unique rotation of this element (not set in the Rotate Generic system)
|
||||
* @param[in] _axes Rotation axes selection
|
||||
* @param[in] _angle Angle to set on this axes
|
||||
* @param[in] _angle Angle to set in radiant.
|
||||
*/
|
||||
void SetAngle(const vec3& _axes, float _angle);
|
||||
void SetAngle(float _angleRad);
|
||||
/**
|
||||
* @brief Add a compleate of the image to display with the requested size
|
||||
* @param[in] _size Size of the output image
|
||||
|
@ -25,7 +25,8 @@
|
||||
extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKeyboard";
|
||||
|
||||
|
||||
ewol::Windows::Windows(void)
|
||||
ewol::Windows::Windows(void) :
|
||||
m_backgroundColor(0.750, 0.750, 0.750, 0.5)
|
||||
{
|
||||
SetCanHaveFocus(true);
|
||||
m_subWidget = NULL;
|
||||
@ -147,7 +148,10 @@ void ewol::Windows::SystemDraw(const ewol::DrawProperty& _displayProp)
|
||||
#endif
|
||||
|
||||
// Clear the screen with transparency ...
|
||||
glClearColor(0.750, 0.750, 0.750, 0.5);
|
||||
glClearColor(m_backgroundColor.r(),
|
||||
m_backgroundColor.g(),
|
||||
m_backgroundColor.b(),
|
||||
m_backgroundColor.a());
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
#ifdef TEST_PERFO_WINDOWS
|
||||
float ___localTime0 = (float)(ewol::GetTime() - ___startTime0) / 1000.0f;
|
||||
@ -225,3 +229,10 @@ void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Windows::SetBackgroundColor(const etk::Color<float>& _color)
|
||||
{
|
||||
if (m_backgroundColor != _color) {
|
||||
m_backgroundColor = _color;
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <etk/Color.h>
|
||||
|
||||
namespace ewol {
|
||||
|
||||
@ -50,6 +51,19 @@ namespace ewol {
|
||||
public:
|
||||
void SetSubWidget(ewol::Widget * widget);
|
||||
void PopUpWidgetPush(ewol::Widget * widget);
|
||||
private:
|
||||
etk::Color<float> m_backgroundColor; //!< reset color of the Main windows
|
||||
public:
|
||||
/**
|
||||
* @brief Get the background color.
|
||||
* @return A reference on the color
|
||||
*/
|
||||
const etk::Color<float>& GetBackgroundColor(void) { return m_backgroundColor; };
|
||||
/**
|
||||
* @brief Set the background color.
|
||||
* @param[IN] the new requested color.
|
||||
*/
|
||||
void SetBackgroundColor(const etk::Color<float>& _color);
|
||||
protected: // Derived function
|
||||
virtual void SystemDraw(const ewol::DrawProperty& _displayProp);
|
||||
public: // Derived function
|
||||
|
Loading…
x
Reference in New Issue
Block a user