[DEV] better maagement of the Program shader and add converter of the screen size
This commit is contained in:
parent
c4d156d462
commit
ac36b0b6a5
2
build
2
build
@ -1 +1 @@
|
||||
Subproject commit 0a3b7ca530db3ff61b399b55f7e94bdf3928dcd6
|
||||
Subproject commit dfc960939ed6021525cd8a008932feab878e4221
|
@ -9,31 +9,21 @@ struct displayProperty {
|
||||
vec2 insideSize;
|
||||
};
|
||||
|
||||
struct widgetStateProperty {
|
||||
int stateOld;
|
||||
int stateNew;
|
||||
float transition;
|
||||
};
|
||||
|
||||
uniform displayProperty EW_widgetProperty;
|
||||
|
||||
uniform widgetStateProperty EW_status;
|
||||
|
||||
// transmit from the vertex shader
|
||||
varying vec2 v_position; // interpolated position ...
|
||||
varying vec4 v_colorTansition;
|
||||
|
||||
// internal static define
|
||||
vec4 S_colorBg = vec4(0.0);
|
||||
vec4 S_colorFg[4];
|
||||
vec4 S_colorBorder = vec4(0.0,0.0,0.0,1.0);
|
||||
float S_sizePadding = 3.0;
|
||||
float S_sizeBorder = 1.0;
|
||||
|
||||
void main(void) {
|
||||
S_colorFg[0] = vec4(0.5,0.5,0.5,0.3);
|
||||
S_colorFg[1] = vec4(0.7,0.0,0.0,0.4);
|
||||
S_colorFg[2] = vec4(0.0,0.0,0.7,0.4);
|
||||
S_colorFg[3] = vec4(0.0,0.7,0.0,0.4);
|
||||
// prevent origin moving ...
|
||||
vec2 position = v_position - EW_widgetProperty.origin;
|
||||
float specialBorder = S_sizeBorder+S_sizePadding;
|
||||
@ -52,8 +42,7 @@ void main(void) {
|
||||
gl_FragColor = S_colorBorder;
|
||||
} else {
|
||||
// note : int() is needed for the OpenGL ES platform
|
||||
gl_FragColor = S_colorFg[int(EW_status.stateOld)]*(1.0-EW_status.transition)
|
||||
+ S_colorFg[int(EW_status.stateNew)]*EW_status.transition;
|
||||
gl_FragColor = v_colorTansition;
|
||||
}
|
||||
} else {
|
||||
gl_FragColor = S_colorBg;
|
||||
|
@ -1,2 +0,0 @@
|
||||
widgetButton.vert
|
||||
widgetButton.frag
|
@ -3,15 +3,53 @@ precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
struct widgetStateProperty {
|
||||
int stateOld;
|
||||
int stateNew;
|
||||
float transition;
|
||||
};
|
||||
|
||||
uniform widgetStateProperty EW_status;
|
||||
|
||||
// Input :
|
||||
attribute vec2 EW_coord2d;
|
||||
uniform mat4 EW_MatrixTransformation;
|
||||
|
||||
// output :
|
||||
varying vec2 v_position; // This will be passed into the fragment shader.
|
||||
varying vec4 v_colorTansition;
|
||||
|
||||
// internal :
|
||||
vec4 S_colorFg[4];
|
||||
|
||||
void main(void) {
|
||||
S_colorFg[0] = vec4(0.5,0.5,0.5,0.3);
|
||||
S_colorFg[1] = vec4(0.7,0.0,0.0,0.4);
|
||||
S_colorFg[2] = vec4(0.0,0.0,0.7,0.4);
|
||||
S_colorFg[3] = vec4(0.0,0.7,0.0,0.4);
|
||||
|
||||
gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
|
||||
// transmit position of the curent element (intermolated ...)
|
||||
v_position = EW_coord2d;
|
||||
|
||||
vec4 colorOld = S_colorFg[0];
|
||||
if(EW_status.stateOld==1) {
|
||||
colorOld = S_colorFg[1];
|
||||
} else if(EW_status.stateOld==2) {
|
||||
colorOld = S_colorFg[2];
|
||||
} else if(EW_status.stateOld==3) {
|
||||
colorOld = S_colorFg[3];
|
||||
}
|
||||
vec4 colorNew = S_colorFg[0];
|
||||
if(EW_status.stateNew==1) {
|
||||
colorNew = S_colorFg[1];
|
||||
} else if(EW_status.stateNew==2) {
|
||||
colorNew = S_colorFg[2];
|
||||
} else if(EW_status.stateNew==3) {
|
||||
colorNew = S_colorFg[3];
|
||||
}
|
||||
|
||||
// note : int() is needed for the OpenGL ES platform
|
||||
v_colorTansition = colorOld*(1.0-EW_status.transition)
|
||||
+ colorNew*EW_status.transition;
|
||||
}
|
||||
|
@ -9,8 +9,9 @@
|
||||
#include <ewol/DisplayConv.h>
|
||||
#include <ewol/debug.h>
|
||||
|
||||
static vec2 ratioInch(65475,75654);
|
||||
static vec2 ratioMillimeter(76545,46547445);
|
||||
static vec2 ratioInch(9999999,888888);
|
||||
static vec2 ratioMillimeter(9999999,888888);
|
||||
static vec2 windowsSize(9999999,888888);
|
||||
|
||||
static const float numberOfMillimeterInOneInch = 25.4f;
|
||||
|
||||
@ -19,32 +20,38 @@ void ewol::DC_Init(void)
|
||||
{
|
||||
ratioInch.setValue(96,96);
|
||||
ratioMillimeter = ratioInch/numberOfMillimeterInOneInch;
|
||||
windowsSize.setValue(200,200);
|
||||
}
|
||||
|
||||
|
||||
vec2 ewol::InchToPixel(const vec2& inch)
|
||||
{
|
||||
return vec2(inch.x()*ratioInch.x(), inch.y()*ratioInch.y());
|
||||
}
|
||||
|
||||
|
||||
vec2 ewol::MillemeterToPixel(const vec2& millimeter)
|
||||
{
|
||||
return vec2(millimeter.x()*ratioMillimeter.x(), millimeter.y()*ratioMillimeter.y());
|
||||
}
|
||||
|
||||
vec2 ewol::PourcentToPixel(const vec2& pourcent)
|
||||
{
|
||||
return vec2(pourcent.x()*windowsSize.x()/100.0f, pourcent.y()*windowsSize.y()/100.0f);
|
||||
}
|
||||
|
||||
vec2 ewol::PixelToInch(const vec2& pixel)
|
||||
{
|
||||
return vec2(pixel.x()/ratioInch.x(), pixel.y()/ratioInch.y());
|
||||
}
|
||||
|
||||
|
||||
vec2 ewol::PixelToMillemeter(const vec2& pixel)
|
||||
{
|
||||
return vec2(pixel.x()/ratioMillimeter.x(), pixel.y()/ratioMillimeter.y());
|
||||
}
|
||||
|
||||
vec2 ewol::PixelToPourcent(const vec2& pixel)
|
||||
{
|
||||
return vec2(pixel.x()*100.0f/windowsSize.x(), pixel.y()*100.0f/windowsSize.y());
|
||||
}
|
||||
|
||||
void ewol::SetPixelPerInch(const vec2& ratio)
|
||||
{
|
||||
@ -53,7 +60,6 @@ void ewol::SetPixelPerInch(const vec2& ratio)
|
||||
EWOL_INFO("Set a new Inch/milimeter Ratio for the screen : ratioInch=" << ratioInch << " ratioMm=" << ratioMillimeter);
|
||||
}
|
||||
|
||||
|
||||
void ewol::SetPixelPerMillimeter(const vec2& ratio)
|
||||
{
|
||||
ratioMillimeter = ratio;
|
||||
@ -61,4 +67,33 @@ void ewol::SetPixelPerMillimeter(const vec2& ratio)
|
||||
EWOL_INFO("Set a new Inch/milimeter Ratio for the screen : ratioInch=" << ratioInch << " ratioMm=" << ratioMillimeter);
|
||||
}
|
||||
|
||||
void ewol::SetPixelWindowsSize(const vec2& size)
|
||||
{
|
||||
windowsSize = size;
|
||||
EWOL_CRITICAL("Set a new Windows property size " << windowsSize << "px");
|
||||
}
|
||||
|
||||
vec2 ewol::GetWindowsSizeMilimeter(void)
|
||||
{
|
||||
return vec2(windowsSize.x()/ratioMillimeter.x(), windowsSize.y()/ratioMillimeter.y());
|
||||
}
|
||||
|
||||
vec2 ewol::GetWindowsSizeInch(void)
|
||||
{
|
||||
return vec2(windowsSize.x()/ratioInch.x(), windowsSize.y()/ratioInch.y());
|
||||
}
|
||||
|
||||
float ewol::GetWindowsDiagSizeMilimeter(void)
|
||||
{
|
||||
vec2 tmpSize = ewol::GetWindowsSizeMilimeter();
|
||||
return sqrtf(tmpSize.x()*tmpSize.x()+tmpSize.y()*tmpSize.y());
|
||||
}
|
||||
|
||||
float ewol::GetWindowsDiagSizeInch(void)
|
||||
{
|
||||
vec2 tmpSize = ewol::GetWindowsSizeInch();
|
||||
return sqrtf(tmpSize.x()*tmpSize.x()+tmpSize.y()*tmpSize.y());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace ewol
|
||||
* @param[in] pourcent Dimention in pourcent
|
||||
* @return dimention in Pixel
|
||||
*/
|
||||
//vec2 PourcentToPixel(const vec2& pourcent);
|
||||
vec2 PourcentToPixel(const vec2& pourcent);
|
||||
/**
|
||||
* @brief convert a dimention in Pixel to a inch dimension
|
||||
* @param[in] pixel Dimention in pixel
|
||||
@ -54,7 +54,7 @@ namespace ewol
|
||||
* @param[in] pixel Dimention in pixel
|
||||
* @return dimention in pourcent
|
||||
*/
|
||||
//vec2 PixelToPourcent(const vec2& pixel);
|
||||
vec2 PixelToPourcent(const vec2& pixel);
|
||||
/**
|
||||
* @brief Set the Inch ratio for calculation
|
||||
* @param[in] Ratio Inch ration for the screen calculation interpolation
|
||||
@ -67,6 +67,31 @@ namespace ewol
|
||||
* @note: same as @ref SetPixelPerInch (internal manage convertion)
|
||||
*/
|
||||
void SetPixelPerMillimeter(const vec2& ratio);
|
||||
/**
|
||||
* @brief Set the current Windows Size
|
||||
* @param[in] size Size of the current windows in pixel.
|
||||
*/
|
||||
void SetPixelWindowsSize(const vec2& size);
|
||||
/**
|
||||
* @brief Get the Windows Size in the request unit
|
||||
* @return the requested size
|
||||
*/
|
||||
vec2 GetWindowsSizeMilimeter(void);
|
||||
/**
|
||||
* @brief Get the Windows Size in the request unit
|
||||
* @return the requested size
|
||||
*/
|
||||
vec2 GetWindowsSizeInch(void);
|
||||
/**
|
||||
* @brief Get the Windows diagonal size in the request unit
|
||||
* @return the requested size
|
||||
*/
|
||||
float GetWindowsDiagSizeMilimeter(void);
|
||||
/**
|
||||
* @brief Get the Windows diagonal size in the request unit
|
||||
* @return the requested size
|
||||
*/
|
||||
float GetWindowsDiagSizeInch(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -236,43 +236,56 @@ void ewol::openGL::UpdateAllFlags(void)
|
||||
|
||||
void ewol::openGL::ActiveTexture(uint32_t flagID)
|
||||
{
|
||||
glActiveTexture(flagID);
|
||||
if (l_programId>0) {
|
||||
glActiveTexture(flagID);
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::openGL::DesActiveTexture(uint32_t flagID)
|
||||
{
|
||||
|
||||
if (l_programId>0) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::openGL::DrawArrays(uint32_t mode, int32_t first, int32_t count)
|
||||
{
|
||||
UpdateAllFlags();
|
||||
glDrawArrays(mode, first, count);
|
||||
if (l_programId>0) {
|
||||
UpdateAllFlags();
|
||||
glDrawArrays(mode, first, count);
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::openGL::DrawElements(uint32_t mode, const etk::Vector<uint32_t>& indices)
|
||||
{
|
||||
UpdateAllFlags();
|
||||
//EWOL_DEBUG("Request draw of " << indices.Size() << "elements");
|
||||
glDrawElements(mode, indices.Size(), GL_UNSIGNED_INT, &indices[0]);
|
||||
if (l_programId>0) {
|
||||
UpdateAllFlags();
|
||||
//EWOL_DEBUG("Request draw of " << indices.Size() << "elements");
|
||||
glDrawElements(mode, indices.Size(), GL_UNSIGNED_INT, &indices[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::openGL::DrawElements16(uint32_t mode, const etk::Vector<uint16_t>& indices)
|
||||
{
|
||||
UpdateAllFlags();
|
||||
glDrawElements(mode, indices.Size(), GL_UNSIGNED_SHORT, &indices[0]);
|
||||
if (l_programId>0) {
|
||||
UpdateAllFlags();
|
||||
glDrawElements(mode, indices.Size(), GL_UNSIGNED_SHORT, &indices[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::openGL::DrawElements8(uint32_t mode, const etk::Vector<uint8_t>& indices)
|
||||
{
|
||||
UpdateAllFlags();
|
||||
glDrawElements(mode, indices.Size(), GL_UNSIGNED_BYTE, &indices[0]);
|
||||
if (l_programId>0) {
|
||||
UpdateAllFlags();
|
||||
glDrawElements(mode, indices.Size(), GL_UNSIGNED_BYTE, &indices[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ewol::openGL::UseProgram(int32_t id)
|
||||
{
|
||||
if (0==id) {
|
||||
// note : program at -1 mean that no use of a program on open GL (here we did not use it ) when 0 ==> program error ...
|
||||
if (-1==id) {
|
||||
// not used ==> because it is unneded
|
||||
return;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <etk/MessageFifo.h>
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/DisplayConv.h>
|
||||
#include <ewol/debug.h>
|
||||
|
||||
#include <ewol/config.h>
|
||||
@ -134,6 +135,7 @@ void ewolProcessEvents(void)
|
||||
case THREAD_RESIZE:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
windowsSize = data.dimention;
|
||||
ewol::SetPixelWindowsSize(vec2(windowsSize.x(),windowsSize.y()));
|
||||
eSystem::ForceRedrawAll();
|
||||
break;
|
||||
case THREAD_INPUT_MOTION:
|
||||
@ -326,6 +328,8 @@ void eSystem::RequestUpdateSize(void)
|
||||
|
||||
void eSystem::Resize(int w, int h )
|
||||
{
|
||||
// TODO : Better in the thread ... ==> but generate some init error ...
|
||||
ewol::SetPixelWindowsSize(vec2(w,h));
|
||||
if (true == isGlobalSystemInit) {
|
||||
eSystemMessage data;
|
||||
data.TypeMessage = THREAD_RESIZE;
|
||||
@ -462,7 +466,6 @@ void eSystem::ClipBoardArrive(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool eSystem::Draw(bool displayEveryTime)
|
||||
{
|
||||
int64_t currentTime = ewol::GetTime();
|
||||
|
@ -24,54 +24,71 @@ ewol::Program::Program(const etk::UString& filename) :
|
||||
m_hasTexture1(false)
|
||||
{
|
||||
m_resourceLevel = 1;
|
||||
EWOL_DEBUG("OGL : load PROGRAM \"" << filename << "\"");
|
||||
EWOL_DEBUG("OGL : load PROGRAM \"" << m_name << "\"");
|
||||
// load data from file "all the time ..."
|
||||
|
||||
etk::FSNode file(m_name);
|
||||
if (false == file.Exist()) {
|
||||
EWOL_ERROR("File does not Exist : \"" << file << "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
etk::UString fileExtention = file.FileGetExtention();
|
||||
if (fileExtention != "prog") {
|
||||
EWOL_ERROR("File does not have extention \".prog\" for program but : \"" << fileExtention << "\"");
|
||||
return;
|
||||
}
|
||||
if (false == file.FileOpenRead()) {
|
||||
EWOL_ERROR("Can not open the file : " << file);
|
||||
return;
|
||||
}
|
||||
#define MAX_LINE_SIZE (2048)
|
||||
char tmpData[MAX_LINE_SIZE];
|
||||
while (file.FileGets(tmpData, MAX_LINE_SIZE) != NULL) {
|
||||
int32_t len = strlen(tmpData);
|
||||
if( tmpData[len-1] == '\n'
|
||||
|| tmpData[len-1] == '\r') {
|
||||
tmpData[len-1] = '\0';
|
||||
len--;
|
||||
}
|
||||
EWOL_DEBUG(" Read data : \"" << tmpData << "\"");
|
||||
if (len == 0) {
|
||||
continue;
|
||||
}
|
||||
if (tmpData[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
// get it with relative position :
|
||||
etk::UString tmpFilename = file.GetRelativeFolder() + tmpData;
|
||||
EWOL_INFO("File does not Exist : \"" << file << "\" ==> automatic load of framment and shader with same names... ");
|
||||
etk::UString tmpFilename = m_name;
|
||||
// remove extention ...
|
||||
tmpFilename.Remove(tmpFilename.Size()-4, 4);
|
||||
ewol::Shader* tmpShader = NULL;
|
||||
if (false == ewol::resource::Keep(tmpFilename, tmpShader)) {
|
||||
if (false == ewol::resource::Keep(tmpFilename+"vert", tmpShader)) {
|
||||
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
||||
return;
|
||||
} else {
|
||||
EWOL_DEBUG("Add shader on program : "<< tmpFilename);
|
||||
m_shaderList.PushBack(tmpShader);
|
||||
}
|
||||
if (false == ewol::resource::Keep(tmpFilename+"frag", tmpShader)) {
|
||||
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
||||
return;
|
||||
} else {
|
||||
EWOL_DEBUG("Add shader on program : "<< tmpFilename);
|
||||
m_shaderList.PushBack(tmpShader);
|
||||
}
|
||||
} else {
|
||||
|
||||
etk::UString fileExtention = file.FileGetExtention();
|
||||
if (fileExtention != "prog") {
|
||||
EWOL_ERROR("File does not have extention \".prog\" for program but : \"" << fileExtention << "\"");
|
||||
return;
|
||||
}
|
||||
if (false == file.FileOpenRead()) {
|
||||
EWOL_ERROR("Can not open the file : \"" << file << "\"");
|
||||
return;
|
||||
}
|
||||
#define MAX_LINE_SIZE (2048)
|
||||
char tmpData[MAX_LINE_SIZE];
|
||||
while (file.FileGets(tmpData, MAX_LINE_SIZE) != NULL) {
|
||||
int32_t len = strlen(tmpData);
|
||||
if( tmpData[len-1] == '\n'
|
||||
|| tmpData[len-1] == '\r') {
|
||||
tmpData[len-1] = '\0';
|
||||
len--;
|
||||
}
|
||||
EWOL_DEBUG(" Read data : \"" << tmpData << "\"");
|
||||
if (len == 0) {
|
||||
continue;
|
||||
}
|
||||
if (tmpData[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
// get it with relative position :
|
||||
etk::UString tmpFilename = file.GetRelativeFolder() + tmpData;
|
||||
ewol::Shader* tmpShader = NULL;
|
||||
if (false == ewol::resource::Keep(tmpFilename, tmpShader)) {
|
||||
EWOL_CRITICAL("Error while getting a specific shader filename : " << tmpFilename);
|
||||
} else {
|
||||
EWOL_DEBUG("Add shader on program : "<< tmpFilename);
|
||||
m_shaderList.PushBack(tmpShader);
|
||||
}
|
||||
|
||||
}
|
||||
// close the file:
|
||||
file.FileClose();
|
||||
}
|
||||
// close the file:
|
||||
file.FileClose();
|
||||
|
||||
UpdateContext();
|
||||
}
|
||||
|
||||
@ -153,17 +170,28 @@ void ewol::Program::UpdateContext(void)
|
||||
// Do nothing ==> too dangerous ...
|
||||
} else {
|
||||
// create the Shader
|
||||
EWOL_INFO("Create the Program ...");
|
||||
EWOL_INFO("Create the Program ... \"" << m_name << "\"");
|
||||
m_program = glCreateProgram();
|
||||
if (0 == m_program) {
|
||||
EWOL_ERROR("program creation return error ...");
|
||||
checkGlError("glCreateProgram", __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
// first attach vertex shader, and after fragment shader
|
||||
for (int32_t iii=0; iii<m_shaderList.Size(); iii++) {
|
||||
if (NULL != m_shaderList[iii]) {
|
||||
glAttachShader(m_program, m_shaderList[iii]->GetGL_ID());
|
||||
checkGlError("glAttachShader", __LINE__);
|
||||
if (m_shaderList[iii]->GetShaderType() == GL_VERTEX_SHADER) {
|
||||
glAttachShader(m_program, m_shaderList[iii]->GetGL_ID());
|
||||
checkGlError("glAttachShader", __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int32_t iii=0; iii<m_shaderList.Size(); iii++) {
|
||||
if (NULL != m_shaderList[iii]) {
|
||||
if (m_shaderList[iii]->GetShaderType() == GL_FRAGMENT_SHADER) {
|
||||
glAttachShader(m_program, m_shaderList[iii]->GetGL_ID());
|
||||
checkGlError("glAttachShader", __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
glLinkProgram(m_program);
|
||||
@ -177,12 +205,12 @@ void ewol::Program::UpdateContext(void)
|
||||
glGetProgramInfoLog(m_program, LOG_OGL_INTERNAL_BUFFER_LEN, &bufLength, l_bufferDisplayError);
|
||||
char tmpLog[256];
|
||||
int32_t idOut=0;
|
||||
EWOL_ERROR("Could not compile \"PROGRAM\": ");
|
||||
EWOL_ERROR("Could not compile \"PROGRAM\": \"" << m_name << "\"");
|
||||
for (int32_t iii=0; iii<LOG_OGL_INTERNAL_BUFFER_LEN ; iii++) {
|
||||
tmpLog[idOut] = l_bufferDisplayError[iii];
|
||||
if (tmpLog[idOut] == '\n' || tmpLog[idOut] == '\0') {
|
||||
if (tmpLog[idOut] == '\n' || tmpLog[idOut] == '\0' || idOut>=256) {
|
||||
tmpLog[idOut] = '\0';
|
||||
EWOL_ERROR(" | " << tmpLog);
|
||||
EWOL_ERROR(" ==> " << tmpLog);
|
||||
idOut=0;
|
||||
} else {
|
||||
idOut++;
|
||||
@ -191,6 +219,10 @@ void ewol::Program::UpdateContext(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idOut != 0) {
|
||||
tmpLog[idOut] = '\0';
|
||||
EWOL_ERROR(" ==> " << tmpLog);
|
||||
}
|
||||
glDeleteProgram(m_program);
|
||||
checkGlError("glDeleteProgram", __LINE__);
|
||||
m_program = 0;
|
||||
@ -676,12 +708,10 @@ void ewol::Program::Uniform4iv(int32_t idElem, int32_t nbElement, const int32_t
|
||||
|
||||
void ewol::Program::Use(void)
|
||||
{
|
||||
if (0==m_program) {
|
||||
return;
|
||||
}
|
||||
#ifdef PROGRAM_DISPLAY_SPEED
|
||||
g_startTime = ewol::GetTime();
|
||||
#endif
|
||||
// event if it was 0 ==> set it to prevent other use of the previous shader display ...
|
||||
ewol::openGL::UseProgram(m_program);
|
||||
//checkGlError("glUseProgram", __LINE__);
|
||||
}
|
||||
@ -753,7 +783,7 @@ void ewol::Program::UnUse(void)
|
||||
}
|
||||
#endif
|
||||
// no need to disable program ==> this only generate perturbation on speed ...
|
||||
ewol::openGL::UseProgram(0);
|
||||
ewol::openGL::UseProgram(-1);
|
||||
#ifdef PROGRAM_DISPLAY_SPEED
|
||||
float localTime = (float)(ewol::GetTime() - g_startTime) / 1000.0f;
|
||||
if (localTime>1) {
|
||||
|
@ -18,7 +18,8 @@
|
||||
widget::Gird::Gird(int32_t colNumber) :
|
||||
m_tmpWidget(NULL),
|
||||
m_sizeRow(0),
|
||||
m_borderSize(0,0)
|
||||
m_borderSize(0,0),
|
||||
m_gavityButtom(true)
|
||||
{
|
||||
SetColNumber(colNumber);
|
||||
ewol::RequestUpdateSize();
|
||||
@ -59,15 +60,21 @@ bool widget::Gird::CalculateSize(float availlableX, float availlableY)
|
||||
if (NULL != m_subWidget[iii].widget) {
|
||||
//calculate the origin :
|
||||
vec2 tmpOrigin = m_origin + m_borderSize;
|
||||
// adding X origin :
|
||||
if (false == m_gavityButtom) {
|
||||
tmpOrigin += vec2(0, m_size.y()-m_borderSize.y());
|
||||
}
|
||||
|
||||
int32_t tmpSizeWidth = 0;
|
||||
for (int32_t jjj=0; jjj<m_subWidget[iii].col; jjj++ ){
|
||||
tmpSizeWidth += abs(m_sizeCol[jjj]);
|
||||
}
|
||||
// adding Y orogin :
|
||||
int32_t addingPos = (m_subWidget[iii].row+1)*m_uniformSizeRow;
|
||||
|
||||
// adding Y origin :
|
||||
int32_t addingPos = 0;
|
||||
if (true == m_gavityButtom) {
|
||||
addingPos = (m_subWidget[iii].row)*m_uniformSizeRow;
|
||||
} else {
|
||||
addingPos = -(m_subWidget[iii].row+1)*m_uniformSizeRow;
|
||||
}
|
||||
tmpOrigin += vec2(tmpSizeWidth, addingPos);
|
||||
|
||||
EWOL_DEBUG(" [" << iii << "] set subwidget origin=" <<tmpOrigin << " size=" << ivec2(abs(m_sizeCol[m_subWidget[iii].col]), m_uniformSizeRow) );
|
||||
|
@ -29,6 +29,7 @@ namespace widget {
|
||||
etk::Vector<int32_t> m_sizeCol; //!< size of all colomn (if set (otherwise 0))
|
||||
etk::Vector<GirdProperties> m_subWidget; //!< all sub widget are contained in this element
|
||||
ewol::Widget* m_tmpWidget; //!< use when replace a widget ...
|
||||
bool m_gavityButtom;
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
@ -65,6 +66,22 @@ namespace widget {
|
||||
* @return The size of the lines.
|
||||
*/
|
||||
int32_t GetRowSize(void);
|
||||
/**
|
||||
* @brief Set the gravity of the widget on the Button (index 0 is on buttom)
|
||||
*/
|
||||
void SetGravityButtom(void)
|
||||
{
|
||||
m_gavityButtom = true;
|
||||
MarkToRedraw();
|
||||
}
|
||||
/**
|
||||
* @brief Set the gravity of the widget on the Top (index 0 is on top)
|
||||
*/
|
||||
void SetGravityTop(void)
|
||||
{
|
||||
m_gavityButtom = false;
|
||||
MarkToRedraw();
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief Remove all sub element from the widget.
|
||||
|
51
sources/ewol/widget/newSystem.txt
Normal file
51
sources/ewol/widget/newSystem.txt
Normal file
@ -0,0 +1,51 @@
|
||||
I need to organize widget by style (Like GTK):
|
||||
|
||||
|
||||
ewol::EObject
|
||||
ewol::Widget
|
||||
## Windows :
|
||||
widget::Windows main application windows
|
||||
widget::PopUp Widget to display basic pop-up
|
||||
## Meta-widget :
|
||||
// (multiple and complex widget commonly used)
|
||||
widget::MessageBox [*TODO*] Dispaly a simple message with multiple choice, or critical error ...
|
||||
widget::FileChooser Widget to display list of files to open/save ....
|
||||
widget::ColorChooser Select a specific color
|
||||
widget::Calendar [*TODO*] display the current calendar
|
||||
## Basics :
|
||||
widget::Image
|
||||
widget::Label
|
||||
widget::Entry
|
||||
widget::EntryNumericSpin [*TODO*]
|
||||
widget::Checkbox
|
||||
widget::Joystick
|
||||
widget::ProgressBar
|
||||
widget::Slider
|
||||
widget::Spacer
|
||||
widget::Mesh
|
||||
widget::Spinner [*TODO*] waiting widget
|
||||
widget::ComboBox [*TODO*] List of selection of element
|
||||
*widget::Button ==> move in container widget
|
||||
widget::ButtonColor
|
||||
widget::ButtonText
|
||||
widget::ButtonImage
|
||||
widget::ButtonImageText
|
||||
## contener :
|
||||
widget::Sizer
|
||||
widget::Gird
|
||||
widget::Layer
|
||||
widget::WSlider
|
||||
widget::FreePosition [*TODO*] set the widget at the desird position
|
||||
|
||||
|
||||
widget::ColorBar.cpp
|
||||
widget::ContextMenu.cpp
|
||||
widget::List.cpp
|
||||
widget::ListFileSystem.h
|
||||
widget::Menu.cpp
|
||||
widget::Scene.cpp
|
||||
widget::WidgetScrolled.cpp
|
||||
|
||||
widget::meta::Parameter.cpp
|
||||
widget::meta::ParameterList.cpp
|
||||
|
Loading…
x
Reference in New Issue
Block a user