[DEV] correct drawing

This commit is contained in:
Edouard DUPIN 2021-04-13 23:03:43 +02:00
parent aa4ea31b4d
commit b6c49a3f6f
21 changed files with 187 additions and 4532 deletions

View File

@ -1,3 +1,5 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;

View File

@ -1,12 +1,14 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
// Input :
attribute vec3 in_coord3d;
attribute vec2 in_texture2d;
attribute vec4 in_color;
// VBA Input :
layout (location = 0) in vec3 in_position;
layout (location = 1) in vec2 in_textureCoords;
layout (location = 3) in vec4 in_colors;
uniform mat4 in_MatrixTransformation;
// output :
@ -16,25 +18,25 @@ varying vec2 io_texcoord;
void main(void) {
gl_Position = in_MatrixTransformation * vec4(in_coord2d, 0.0, 1.0);
//gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_coord2d, 0.0, 1.0);
// set texture output coord
io_texcoord = in_texture2d;
// set texture output coordinates
io_texcoord = in_textureCoords;
// set output color :
io_color = in_color;
io_color = in_colors;
}
*/
varying vec4 io_patern;
void main(void) {
gl_Position = in_MatrixTransformation * vec4(in_coord3d, 1.0);
gl_Position = in_MatrixTransformation * vec4(in_position, 1.0);
//gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_coord2d, 0.0, 1.0);
// set output color :
io_color = in_color;
if (in_texture2d.x<1.0) {
io_color = in_colors;
if (in_textureCoords.x<1.0) {
// normal font :
io_patern = vec4 (0.0, 0.0, 0.0, 1.0);
} else if (in_texture2d.x<2.0) {
} else if (in_textureCoords.x<2.0) {
// Italic font :
io_patern = vec4 (1.0, 0.0, 0.0, 0.0);
} else if (in_texture2d.x<3.0) {
} else if (in_textureCoords.x<3.0) {
// Bold font :
io_patern = vec4 (0.0, 1.0, 0.0, 0.0);
} else {
@ -42,6 +44,6 @@ void main(void) {
io_patern = vec4 (0.0, 0.0, 1.0, 0.0);
}
// set texture output coord
io_texcoord = mod(in_texture2d, 1.0);
io_texcoord = mod(in_textureCoords, 1.0);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_set_windows_size]
//! [ewol_sample_HW_main_set_font_property]
// select font preference of der with a basic application size
context.getFontDefault().set("FreeSherif", 30);
context.getFontDefault().set("FreeSherif", 12);
//! [ewol_sample_HW_main_set_font_property]
//! [ewol_sample_HW_main_set_windows]
// Create the windows

View File

@ -1,6 +1,7 @@
package sample.atriasoft.ewol.simpleWindowsWithImage;
import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.ewol.widget.Label;
import org.atriasoft.ewol.widget.Spacer;
import org.atriasoft.ewol.widget.Windows;
@ -9,19 +10,22 @@ public class MainWindows extends Windows {
public MainWindows() {
//! [ewol_sample_HW_windows_title]
setPropertyTitle("Simple sample test");
//EwolObject.getContext().getFontDefault().setName("FreeSans");
//! [ewol_sample_HW_windows_label]
if (true) {
//! [ewol_sample_HW_windows_title]
/*
Label simpleLabel = new Label();
simpleLabel.setPropertyValue("He<b>llo</b> <font color='blue'>World</font><br/><br/> coucou comment ca vas ???<br/>sdsdfgsdfgdsfgsZESRTZAERÉ");
simpleLabel.setPropertyValue(
"He<b>llo.</b> <font color='blue'>World</font><br/><br/> - Coucou comment ca vas ???<br/> - Pas trop bien, je me suis cassé la jambe.<br/><br/><center>The end</center>");
simpleLabel.setPropertyExpand(new Vector2b(true, true));
simpleLabel.setPropertyFill(new Vector2b(true, true));
setSubWidget(simpleLabel);
*/
//! [ewol_sample_HW_windows_label]
} else {
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
setSubWidget(simpleSpacer);
}
}
}

View File

@ -1,5 +1,5 @@
package org.atriasoft.ewol.compositing;
public enum AlignMode {
alignDisable, alignRight, alignLeft, alignCenter, alignJustify
DISABLE, RIGHT, LEFT, CENTER, JUSTIFY
}

View File

@ -28,13 +28,10 @@ public class CompositingDrawing extends Compositing {
private Vector3f clippingPosStop = new Vector3f(0, 0, 0); // !< Clipping stop position
private Color color = Color.BLACK; // !< The text foreground color
private Color colorBg = Color.NONE; // !< The text background color
private final int oGLColor = -1; // !< openGL id on the element (color buffer)
private int oGLMatrix = -1; // !< openGL id on the element (transformation matrix)
private int oGLMatrixPosition = -1; // !< position matrix
private final int oGLPosition = -1; // !< openGL id on the element (vertex buffer)
private ResourceProgram oGLprogram; // !< pointer on the opengl display program
private final List<Color> outColors = new ArrayList<>();
private final List<Integer> outIndice = new ArrayList<>();
private final List<Vector3f> outTriangles = new ArrayList<>();
private Vector3f position = new Vector3f(0, 0, 0); // !< The current position to draw
@ -161,7 +158,6 @@ public class CompositingDrawing extends Compositing {
this.vbo.clear();
this.outTriangles.clear();
this.outColors.clear();
this.outIndice.clear();
// reset temporal variables :
this.position = Vector3f.ZERO;
@ -194,15 +190,9 @@ public class CompositingDrawing extends Compositing {
this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrixPosition, Matrix4f.IDENTITY);
// Request the draw of the elements:
this.vbo.renderArrays(OpenGL.RenderMode.triangle);
//this.vbo.render(OpenGL.RenderMode.triangle);
this.vbo.flush();
this.vbo.unBindForRendering();
// Request the draw of the elements :
// OpenGL.drawArrays(OpenGL.RenderMode.triangle, 0, this.vbo.bufferSize(CompositingDrawing.vboIdCoord));
// no: OpenGL.drawElements(OpenGL.RenderMode.triangle, this.vbo.bufferSize(CompositingDrawing.vboIdCoord));
this.oGLprogram.unUse();
}
@ -211,25 +201,7 @@ public class CompositingDrawing extends Compositing {
// push data on the VBO
this.vbo.setPosition(this.outTriangles.toArray(Vector3f[]::new));
this.vbo.setColors(this.outColors.toArray(Color[]::new));
//this.vbo.setIndices(this.outIndice);
this.vbo.setVertexCount(this.outTriangles.size());
// for test only
//float[] vertice = { -500f, -500f, 0.0f, 0.0f, 500f, 0.0f, 500f, -500f, 0.0f };
// float[] color = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, };
//
// this.vbo.setPosition(vertice);
// this.vbo.setColors(color);
// this.vbo.setVertexCount(3);
// Vector3f[] vertice = { new Vector3f(-500f, -500f, 0.0f), new Vector3f(0.0f, 500f, 0.0f), new Vector3f(500f, -500f, 0.0f) };
// Color[] color = { Color.RED, Color.GREEN, Color.BLUE };
//
// this.vbo.setPosition(vertice);
// this.vbo.setColors(color);
// this.vbo.setVertexCount(3);
// this.vbo.flush();
}
/**

View File

@ -22,12 +22,12 @@ import org.atriasoft.ewol.resource.font.GlyphProperty;
import org.atriasoft.gale.backend3d.OpenGL;
public class CompositingText extends TextBase {
List<Color> colors = new ArrayList<>();
protected List<Color> colors = new ArrayList<>();
protected ResourceTexturedFont font; // !< Font resources
List<Vector3f> pointPositions = new ArrayList<>();
protected List<Vector3f> pointPositions = new ArrayList<>();
protected float size;
List<Vector2f> texturePositions = new ArrayList<>();
protected List<Vector2f> texturePositions = new ArrayList<>();
public CompositingText() {
this("");
@ -87,16 +87,7 @@ public class CompositingText extends TextBase {
// draw BG in any case:
this.vectorialDraw.draw(disableDepthTest);
// TODO : do it only one time (when needed ...)
// set texture coordonates :
this.vbo.setVboData(TextBase.vboIdCoordText, this.texturePositions.toArray(Vector2f[]::new));
// set display positions :
this.vbo.setVboData(TextBase.vboIdCoord, this.pointPositions.toArray(Vector3f[]::new));
// set the color
this.vbo.setVboData(TextBase.vboIdColor, this.colors.toArray(Color[]::new));
// TODO : do it only one time (when needed ...) --------- end -------
if (this.vbo.bufferSize(TextBase.vboIdCoord) <= 0 || this.font == null) {
if (this.vbo.getVertexCount() <= 0 || this.font == null) {
// Log.warning("Nothink to draw...");
return;
}
@ -111,19 +102,16 @@ public class CompositingText extends TextBase {
// set Matrix : translation/positionMatrix
final Matrix4f tmpMatrix = OpenGL.getMatrix().multiply(this.matrixApply);
this.oGLprogram.use();
this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
// Texture :
this.oGLprogram.setTexture0(this.oGLtexID, this.font.getRendererId());
this.oGLprogram.uniformInt(this.oGLtextWidth, this.font.getOpenGlSize().x());
this.oGLprogram.uniformInt(this.oGLtextHeight, this.font.getOpenGlSize().x());
// position:
this.oGLprogram.sendAttributePointer(this.oGLPosition, this.vbo, TextBase.vboIdCoord);
// Texture:
this.oGLprogram.sendAttributePointer(this.oGLtexture, this.vbo, TextBase.vboIdCoordText);
// color:
this.oGLprogram.sendAttributePointer(this.oGLColor, this.vbo, TextBase.vboIdColor);
// Request the draw od the elements :
OpenGL.drawArrays(OpenGL.RenderMode.triangle, 0, this.vbo.bufferSize(TextBase.vboIdCoord));
// Request the draw of the elements:
this.vbo.renderArrays(OpenGL.RenderMode.triangle);
this.vbo.unBindForRendering();
this.oGLprogram.unUse();
}
@ -133,7 +121,7 @@ public class CompositingText extends TextBase {
// draw BG in any case:
this.vectorialDraw.draw();
if (this.vbo.bufferSize(TextBase.vboIdCoord) <= 0 || this.font == null) {
if (this.vbo.getVertexCount() <= 0 || this.font == null) {
// TODO : set it back ...
// Log.warning("Nothink to draw...");
return;
@ -150,19 +138,16 @@ public class CompositingText extends TextBase {
final Matrix4f camMatrix = OpenGL.getCameraMatrix();
final Matrix4f tmpMatrix = projMatrix.multiply(camMatrix).multiply(transformationMatrix);
this.oGLprogram.use();
this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
// Texture:
this.oGLprogram.setTexture0(this.oGLtexID, this.font.getRendererId());
this.oGLprogram.uniformInt(this.oGLtextWidth, this.font.getOpenGlSize().x());
this.oGLprogram.uniformInt(this.oGLtextHeight, this.font.getOpenGlSize().x());
// position:
this.oGLprogram.sendAttributePointer(this.oGLPosition, this.vbo, TextBase.vboIdCoord);
// Texture:
this.oGLprogram.sendAttributePointer(this.oGLtexture, this.vbo, TextBase.vboIdCoordText);
// color:
this.oGLprogram.sendAttributePointer(this.oGLColor, this.vbo, TextBase.vboIdColor);
// Request the draw od the elements:
OpenGL.drawArrays(OpenGL.RenderMode.triangle, 0, this.vbo.bufferSize(TextBase.vboIdCoord));
// Request the draw of the elements:
this.vbo.renderArrays(OpenGL.RenderMode.triangle);
this.vbo.unBindForRendering();
this.oGLprogram.unUse();
if (enableDepthTest) {
OpenGL.disable(OpenGL.Flag.flag_depthTest);
@ -172,12 +157,14 @@ public class CompositingText extends TextBase {
@Override
public void flush() {
super.flush();
// set texture coordinates :
this.vbo.setVboData(TextBase.vboIdCoordText, this.texturePositions.toArray(Vector2f[]::new));
// set texture coordonates :
this.vbo.setTextureCoordinate(this.texturePositions.toArray(Vector2f[]::new));
// set display positions :
this.vbo.setVboData(TextBase.vboIdCoord, this.pointPositions.toArray(Vector3f[]::new));
this.vbo.setPosition(this.pointPositions.toArray(Vector3f[]::new));
// set the color
this.vbo.setVboData(TextBase.vboIdColor, this.colors.toArray(Color[]::new));
this.vbo.setColors(this.colors.toArray(Color[]::new));
this.vbo.setVertexCount(this.pointPositions.size());
this.vbo.flush();
}
@Override

View File

@ -26,17 +26,11 @@ import org.atriasoft.exml.exception.ExmlParserErrorMulti;
import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.exml.model.XmlNode;
import org.atriasoft.gale.resource.ResourceProgram;
import org.atriasoft.gale.resource.ResourceVirtualBufferObject;
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
public abstract class TextBase extends Compositing {
private static final int NBVBO = 4;
protected static int vboIdColor = 2;
// Text
protected static int vboIdCoord = 0;
protected static int vboIdCoordText = 1;
protected static int vboIdGlyphLevel = 3;
// previously this line and the center is perform with this one)
protected AlignMode alignment = AlignMode.alignDisable; // !< Current Alignment mode (justify/left/right ...)
protected AlignMode alignment = AlignMode.DISABLE; // !< Current Alignment mode (justify/left/right ...)
protected boolean clippingEnable = false; // !< true if the clipping must be activated
protected Vector3f clippingPosStart = Vector3f.ZERO; // !< Clipping start position
protected Vector3f clippingPosStop = Vector3f.ZERO; // !< Clipping stop position
@ -54,16 +48,13 @@ public abstract class TextBase extends Compositing {
public List<TextDecoration> htmlDecoration = new ArrayList<>(); // !< current decoration for the HTML display
public TextDecoration htmlDecoTmp = new TextDecoration(); // !< current decoration
protected boolean kerning = true; // !< Kerning enable or disable on the next elements displayed
protected FontMode mode = FontMode.Regular; // !< font display property : Regular/Bold/Italic/BoldItalic
protected FontMode mode = FontMode.REGULAR; // !< font display property : Regular/Bold/Italic/BoldItalic
protected int nbCharDisplayed; // !< prevent some error in calculation size.
protected boolean needDisplay; // !< This just need the display and not the size rendering.
protected int oGLColor = -1; // !< openGL id on the element (color buffer)
protected int oGLMatrix = -1; // !< openGL id on the element (transformation matrix)
protected int oGLPosition = -1; // !< openGL id on the element (vertex buffer)
protected ResourceProgram oGLprogram; // !< pointer on the opengl display program
protected int oGLtexID = -1; // !< openGL id on the element (texture ID)
protected int oGLtextHeight = -1; // !< openGL Id on the texture height
protected int oGLtexture = -1; // !< openGL id on the element (Texture position)
protected int oGLtextWidth = -1; // !< openGL Id on the texture width
protected Vector3f position = Vector3f.ZERO; // !< The current position to draw
protected Character previousCharcode; // !< we remember the previous charcode to perform the kerning. @ref Kerning
@ -73,7 +64,7 @@ public abstract class TextBase extends Compositing {
protected float startTextPos = 0; // !< start position of the Alignment (when \n the text return at this
// position)
protected float stopTextPos = 0; // !< end of the alignment (when a string is too height it cut at the word
protected ResourceVirtualBufferObject vbo;
protected ResourceVirtualArrayObject vbo;
protected CompositingDrawing vectorialDraw = new CompositingDrawing();
/**
@ -92,7 +83,7 @@ public abstract class TextBase extends Compositing {
loadProgram(vertexShader, fragmentShader);
}
// Create the VBO:
this.vbo = ResourceVirtualBufferObject.create(TextBase.NBVBO);
this.vbo = ResourceVirtualArrayObject.createDynamic();
// TO facilitate some debugs we add a name of the VBO:
this.vbo.setName("[VBO] of super.TextBase");
}
@ -191,7 +182,7 @@ public abstract class TextBase extends Compositing {
* disable the alignement system
*/
public void disableAlignement() {
this.alignment = AlignMode.alignDisable;
this.alignment = AlignMode.DISABLE;
}
/**
@ -261,11 +252,11 @@ public abstract class TextBase extends Compositing {
break;
}
// save number of space :
if (text.charAt(iii) == Character.SPACE_SEPARATOR) {
if (text.charAt(iii) == (char) Character.SPACE_SEPARATOR) {
space.value++;
lastSpacePosition = iii;
lastSpacefreeSize = (int) (stopPosition - endPos);
} else if (text.charAt(iii) == Character.LINE_SEPARATOR) {
} else if (text.charAt(iii) == (char) Character.LINE_SEPARATOR) {
stop.value = iii;
endOfLine = true;
break;
@ -346,8 +337,8 @@ public abstract class TextBase extends Compositing {
* @param data The cuurent data to add.
*/
public void htmlAddData(final String data) {
if (this.htmlCurrentLine.length() > 0 && this.htmlCurrentLine.charAt(this.htmlCurrentLine.length() - 1) != Character.SPACE_SEPARATOR) {
this.htmlCurrentLine += Character.SPACE_SEPARATOR;
if (this.htmlCurrentLine.length() > 0 && this.htmlCurrentLine.charAt(this.htmlCurrentLine.length() - 1) != (char) Character.SPACE_SEPARATOR) {
this.htmlCurrentLine += (char) Character.SPACE_SEPARATOR;
if (this.htmlDecoration.size() > 0) {
final TextDecoration tmp = this.htmlDecoration.get(this.htmlDecoration.size() - 1);
this.htmlDecoration.add(tmp);
@ -379,13 +370,10 @@ public abstract class TextBase extends Compositing {
ResourceProgram old = this.oGLprogram;
this.oGLprogram = ResourceProgram.create(vertexShader, fragmentShader);
if (this.oGLprogram != null) {
this.oGLPosition = this.oGLprogram.getAttribute("EWcoord3d");
this.oGLColor = this.oGLprogram.getAttribute("EWcolor");
this.oGLtexture = this.oGLprogram.getAttribute("EWtexture2d");
this.oGLMatrix = this.oGLprogram.getUniform("EWMatrixTransformation");
this.oGLtexID = this.oGLprogram.getUniform("EWtexID");
this.oGLtextWidth = this.oGLprogram.getUniform("EWtexWidth");
this.oGLtextHeight = this.oGLprogram.getUniform("EWtexHeight");
this.oGLMatrix = this.oGLprogram.getUniform("in_MatrixTransformation");
this.oGLtexID = this.oGLprogram.getUniform("in_texID");
this.oGLtextWidth = this.oGLprogram.getUniform("in_texWidth");
this.oGLtextHeight = this.oGLprogram.getUniform("in_texHeight");
} else {
Log.error("Can not load the program => create previous one...");
this.oGLprogram = old;
@ -455,20 +443,20 @@ public abstract class TextBase extends Compositing {
} else if (lowercaseValue.contentEquals("b") || lowercaseValue.contentEquals("bold")) {
Log.verbose("XML bold ...");
final TextDecoration tmpDeco = this.htmlDecoTmp;
if (this.htmlDecoTmp.mode() == FontMode.Regular) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.Bold);
} else if (this.htmlDecoTmp.mode() == FontMode.Italic) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.BoldItalic);
if (this.htmlDecoTmp.mode() == FontMode.REGULAR) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.BOLD);
} else if (this.htmlDecoTmp.mode() == FontMode.ITALIC) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.BOLD_ITALIC);
}
parseHtmlNode(elem);
this.htmlDecoTmp = tmpDeco;
} else if (lowercaseValue.contentEquals("i") || lowercaseValue.contentEquals("italic")) {
Log.verbose("XML italic ...");
final TextDecoration tmpDeco = this.htmlDecoTmp;
if (this.htmlDecoTmp.mode() == FontMode.Regular) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.Italic);
} else if (this.htmlDecoTmp.mode() == FontMode.Bold) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.BoldItalic);
if (this.htmlDecoTmp.mode() == FontMode.REGULAR) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.ITALIC);
} else if (this.htmlDecoTmp.mode() == FontMode.BOLD) {
this.htmlDecoTmp = this.htmlDecoTmp.withMode(FontMode.BOLD_ITALIC);
}
parseHtmlNode(elem);
this.htmlDecoTmp = tmpDeco;
@ -478,29 +466,29 @@ public abstract class TextBase extends Compositing {
} else if (lowercaseValue.contentEquals("p") || lowercaseValue.contentEquals("paragraph")) {
Log.verbose("XML paragraph ...");
htmlFlush();
this.alignment = AlignMode.alignLeft;
this.alignment = AlignMode.LEFT;
forceLineReturn();
parseHtmlNode(elem);
forceLineReturn();
} else if (lowercaseValue.contentEquals("center")) {
Log.verbose("XML center ...");
htmlFlush();
this.alignment = AlignMode.alignCenter;
this.alignment = AlignMode.CENTER;
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("left")) {
Log.verbose("XML left ...");
htmlFlush();
this.alignment = AlignMode.alignLeft;
this.alignment = AlignMode.LEFT;
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("right")) {
Log.verbose("XML right ...");
htmlFlush();
this.alignment = AlignMode.alignRight;
this.alignment = AlignMode.RIGHT;
parseHtmlNode(elem);
} else if (lowercaseValue.contentEquals("justify")) {
Log.verbose("XML justify ...");
htmlFlush();
this.alignment = AlignMode.alignJustify;
this.alignment = AlignMode.JUSTIFY;
parseHtmlNode(elem);
} else {
Log.error("node not suported type: " + elem.getType() + " val='" + elem.getValue() + "'");
@ -527,7 +515,7 @@ public abstract class TextBase extends Compositing {
public void print(final String text, final List<TextDecoration> decoration) {
Color tmpFg = this.color;
Color tmpBg = this.colorBg;
if (this.alignment == AlignMode.alignDisable) {
if (this.alignment == AlignMode.DISABLE) {
// Log.debug(" 1 print in not alligned mode : start=" + this.sizeDisplayStart +
// " stop=" + this.sizeDisplayStop + " pos=" + this.position);
// display the cursor if needed (if it is at the start position...)
@ -594,22 +582,22 @@ public abstract class TextBase extends Compositing {
final boolean needNoJustify = extrapolateLastId(text, currentId, stop, space, freeSpace);
float interpolation = basicSpaceWidth;
switch (this.alignment) {
case alignJustify:
case JUSTIFY:
if (!needNoJustify) {
interpolation += (float) freeSpace.value / (float) (space.value - 1);
}
break;
case alignDisable: // must not came from here ...
case alignLeft:
case DISABLE: // must not came from here ...
case LEFT:
// nothing to do ...
break;
case alignRight:
case RIGHT:
if (this.needDisplay) {
// Move the first char at the right :
setPos(new Vector3f(this.position.x() + freeSpace.value, this.position.y(), this.position.z()));
}
break;
case alignCenter:
case CENTER:
if (this.needDisplay) {
// Move the first char at the right :
setPos(new Vector3f(this.position.x() + freeSpace.value / 2, this.position.y(), this.position.z()));
@ -642,7 +630,7 @@ public abstract class TextBase extends Compositing {
}
}
// special for the justify mode
if (text.charAt(iii) == Character.SPACE_SEPARATOR) {
if (text.charAt(iii) == (char) Character.SPACE_SEPARATOR) {
// Log.debug(" generateString : \" \"");
if (this.needDisplay && this.colorBg.a() != 0) {
this.vectorialDraw.setPos(this.position);
@ -677,12 +665,12 @@ public abstract class TextBase extends Compositing {
}
if (currentId == stop.value) {
currentId++;
} else if (text.charAt(stop.value) == Character.SPACE_SEPARATOR) {
} else if (text.charAt(stop.value) == (char) Character.SPACE_SEPARATOR) {
currentId = stop.value + 1;
// reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), this.position.z()));
this.nbCharDisplayed++;
} else if (text.charAt(stop.value) == Character.LINE_SEPARATOR) {
} else if (text.charAt(stop.value) == (char) Character.LINE_SEPARATOR) {
currentId = stop.value + 1;
// reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), this.position.z()));
@ -787,7 +775,7 @@ public abstract class TextBase extends Compositing {
*/
public void printHTML(final String text) {
// reset parameter :
this.htmlDecoTmp = new TextDecoration(this.defaultColorFg, this.defaultColorBg, FontMode.Regular);
this.htmlDecoTmp = new TextDecoration(this.defaultColorFg, this.defaultColorBg, FontMode.REGULAR);
try {
final XmlElement doc = Exml.parse(text);
if (!doc.existNode("html")) {
@ -829,11 +817,11 @@ public abstract class TextBase extends Compositing {
this.clippingEnable = false;
this.color = this.defaultColorFg;
this.colorBg = this.defaultColorBg;
this.mode = FontMode.Regular;
this.mode = FontMode.REGULAR;
this.previousCharcode = 0;
this.startTextPos = 0;
this.stopTextPos = 0;
this.alignment = AlignMode.alignDisable;
this.alignment = AlignMode.DISABLE;
this.htmlCurrentLine = "";
this.selectionStartPos = -100;
this.cursorPos = -100;
@ -976,16 +964,16 @@ public abstract class TextBase extends Compositing {
public void setFontBold(final boolean status) {
if (status) {
// enable
if (this.mode == FontMode.Regular) {
setFontMode(FontMode.Bold);
} else if (this.mode == FontMode.Italic) {
setFontMode(FontMode.BoldItalic);
if (this.mode == FontMode.REGULAR) {
setFontMode(FontMode.BOLD);
} else if (this.mode == FontMode.ITALIC) {
setFontMode(FontMode.BOLD_ITALIC);
}
} else // disable
if (this.mode == FontMode.Bold) {
setFontMode(FontMode.Regular);
} else if (this.mode == FontMode.BoldItalic) {
setFontMode(FontMode.Italic);
if (this.mode == FontMode.BOLD) {
setFontMode(FontMode.REGULAR);
} else if (this.mode == FontMode.BOLD_ITALIC) {
setFontMode(FontMode.ITALIC);
}
}
@ -996,16 +984,16 @@ public abstract class TextBase extends Compositing {
public void setFontItalic(final boolean status) {
if (status) {
// enable
if (this.mode == FontMode.Regular) {
setFontMode(FontMode.Italic);
} else if (this.mode == FontMode.Bold) {
setFontMode(FontMode.BoldItalic);
if (this.mode == FontMode.REGULAR) {
setFontMode(FontMode.ITALIC);
} else if (this.mode == FontMode.BOLD) {
setFontMode(FontMode.BOLD_ITALIC);
}
} else // disable
if (this.mode == FontMode.Italic) {
setFontMode(FontMode.Regular);
} else if (this.mode == FontMode.BoldItalic) {
setFontMode(FontMode.Bold);
if (this.mode == FontMode.ITALIC) {
setFontMode(FontMode.REGULAR);
} else if (this.mode == FontMode.BOLD_ITALIC) {
setFontMode(FontMode.BOLD);
}
}
@ -1101,7 +1089,7 @@ public abstract class TextBase extends Compositing {
* was just a char)
*/
public void setTextAlignment(final float startTextPos, final float stopTextPos) {
setTextAlignment(startTextPos, stopTextPos, AlignMode.alignDisable);
setTextAlignment(startTextPos, stopTextPos, AlignMode.DISABLE);
}
public void setTextAlignment(final float startTextPos, final float stopTextPos, final AlignMode alignement) {

View File

@ -12,7 +12,7 @@ public record TextDecoration(Color colorFG, Color colorBG, FontMode mode) {
}
public TextDecoration() {
this(Color.BLACK, Color.NONE, FontMode.Regular);
this(Color.BLACK, Color.NONE, FontMode.REGULAR);
}
public TextDecoration withFG(final Color color) {

View File

@ -15,7 +15,7 @@ import org.atriasoft.ewol.internal.Log;
public class ConfigFont {
private final Map<String, Uri> fonts = new HashMap<>();
private String name = "FreeSherif";
private int size = 20;
private int size = 12;
/**
* Constructor

View File

@ -16,7 +16,7 @@ import org.atriasoft.ewol.object.ObjectManager;
import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.ewol.widget.WidgetManager;
import org.atriasoft.ewol.widget.Windows;
import org.atriasoft.gale.Application;
import org.atriasoft.gale.GaleApplication;
import org.atriasoft.gale.Gale;
import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.context.CommandLine;
@ -28,7 +28,7 @@ import org.atriasoft.gale.key.KeyType;
import org.atriasoft.gale.resource.ResourceManager;
// Here we hereted from the gale application to be agnostic of the OW where we work ...
public class EwolContext extends Application {
public class EwolContext extends GaleApplication {
/**
* From everyware in the program, we can get the context inteface.
@ -36,7 +36,7 @@ public class EwolContext extends Application {
*/
@SuppressWarnings("preview")
public static EwolContext getContext() {
Application appl = Gale.getContext().getApplication();
GaleApplication appl = Gale.getContext().getApplication();
if (appl instanceof EwolContext elem) {
return elem;
}
@ -250,20 +250,20 @@ public class EwolContext extends Application {
// check Widget shortcut
if (!tmpWidget.onEventShortCut(special, value, type, isDown)) {
// generate the direct event ...
if (type == KeyKeyboard.character) {
if (type == KeyKeyboard.CHARACTER) {
final EntrySystem tmpEntryEvent;
if (isDown) {
tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.down, special, value);
tmpEntryEvent = new EntrySystem(KeyKeyboard.CHARACTER, KeyStatus.down, special, value);
} else {
tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.up, special, value);
tmpEntryEvent = new EntrySystem(KeyKeyboard.CHARACTER, KeyStatus.up, special, value);
}
tmpWidget.systemEventEntry(tmpEntryEvent);
} else { // THREADKEYBORADMOVE
final EntrySystem tmpEntryEvent;
if (isDown) {
tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.down, special, null);
tmpEntryEvent = new EntrySystem(KeyKeyboard.CHARACTER, KeyStatus.down, special, null);
} else {
tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.up, special, null);
tmpEntryEvent = new EntrySystem(KeyKeyboard.CHARACTER, KeyStatus.up, special, null);
}
tmpWidget.systemEventEntry(tmpEntryEvent);
}

View File

@ -59,7 +59,7 @@ public class ObjectManager {
*/
public synchronized void cleanInternalRemoved() {
final int nbObject = this.eObjectList.size();
Log.verbose("Clean Object List (if needed) : " + this.eObjectList.size() + " elements");
//Log.verbose("Clean Object List (if needed) : " + this.eObjectList.size() + " elements");
final Iterator<WeakReference<EwolObject>> iterator = this.eObjectList.iterator();
while (iterator.hasNext()) {
final WeakReference<EwolObject> elem = iterator.next();

View File

@ -70,7 +70,7 @@ public class ResourceFontSvg extends Resource {
}
for (int yyy = 0; yyy < weight.getHeight(); yyy++) {
for (int xxx = 0; xxx < weight.getWidth(); xxx++) {
final float valueColor = weight.get(xxx, yyy);
final float valueColor = weight.get(xxx, weight.getHeight() - 1 - yyy);
// set only alpha :
switch (posInImage) {
default:
@ -96,7 +96,7 @@ public class ResourceFontSvg extends Resource {
Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
for (int jjj = 0; jjj < weight.getHeight(); jjj++) {
for (int iii = 0; iii < weight.getWidth(); iii++) {
final float valueColor = weight.get(iii, jjj);
final float valueColor = weight.get(iii, weight.getHeight() - 1 - jjj);
// real set of color
imageOut.set(borderSize + iii, borderSize + jjj, valueColor);
}

View File

@ -66,10 +66,10 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.font[2] = null;
this.font[3] = null;
this.modeWraping[0] = FontMode.Regular;
this.modeWraping[1] = FontMode.Regular;
this.modeWraping[2] = FontMode.Regular;
this.modeWraping[3] = FontMode.Regular;
this.modeWraping[0] = FontMode.REGULAR;
this.modeWraping[1] = FontMode.REGULAR;
this.modeWraping[2] = FontMode.REGULAR;
this.modeWraping[3] = FontMode.REGULAR;
this.lastGlyphPos[0] = Vector2i.ONE;
this.lastGlyphPos[1] = Vector2i.ONE;
@ -93,24 +93,24 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.size = Integer.parseInt(sizeString);
}
// find all the fonts...
Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace("\\.svg", "Bold.svg"), fontBaseUri.getproperties());
Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace("\\.svg", "Oblique.svg"), fontBaseUri.getproperties());
Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace("\\.svg", "BoldOblique.svg"), fontBaseUri.getproperties());
Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Bold.svg"), fontBaseUri.getproperties());
Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "Oblique.svg"), fontBaseUri.getproperties());
Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace(".svg", "BoldOblique.svg"), fontBaseUri.getproperties());
if (fontBaseUri.exist()) {
this.fileName[FontMode.Regular.getValue()] = fontBaseUri;
this.fileName[FontMode.REGULAR.getValue()] = fontBaseUri;
}
if (fontBaseUriBold.exist()) {
this.fileName[FontMode.Bold.getValue()] = fontBaseUriBold;
this.fileName[FontMode.BOLD.getValue()] = fontBaseUriBold;
}
if (fontBaseUriOblique.exist()) {
this.fileName[FontMode.Italic.getValue()] = fontBaseUriOblique;
this.fileName[FontMode.ITALIC.getValue()] = fontBaseUriOblique;
}
if (fontBaseUriBoldOblique.exist()) {
this.fileName[FontMode.BoldItalic.getValue()] = fontBaseUriBoldOblique;
this.fileName[FontMode.BOLD_ITALIC.getValue()] = fontBaseUriBoldOblique;
}
// try to find the reference mode :
FontMode refMode = FontMode.Regular;
FontMode refMode = FontMode.REGULAR;
for (int iii = 3; iii >= 0; iii--) {
if (this.fileName[iii] != null) {
refMode = FontMode.get(iii);
@ -160,10 +160,10 @@ public class ResourceTexturedFont extends ResourceTexture2 {
}
flush();
Log.debug("Wrapping properties : ");
Log.debug(" " + FontMode.Regular + " == >" + getWrappingMode(FontMode.Regular));
Log.debug(" " + FontMode.Italic + " == >" + getWrappingMode(FontMode.Italic));
Log.debug(" " + FontMode.Bold + " == >" + getWrappingMode(FontMode.Bold));
Log.debug(" " + FontMode.BoldItalic + " == >" + getWrappingMode(FontMode.BoldItalic));
Log.debug(" " + FontMode.REGULAR + " == >" + getWrappingMode(FontMode.REGULAR));
Log.debug(" " + FontMode.ITALIC + " == >" + getWrappingMode(FontMode.ITALIC));
Log.debug(" " + FontMode.BOLD + " == >" + getWrappingMode(FontMode.BOLD));
Log.debug(" " + FontMode.BOLD_ITALIC + " == >" + getWrappingMode(FontMode.BOLD_ITALIC));
}
/**
@ -268,7 +268,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
* @return Dimention of the font need between 2 lines
*/
public int getHeight() {
return this.height[FontMode.Regular.getValue()];
return this.height[FontMode.REGULAR.getValue()];
}
public int getHeight(final FontMode displayMode) {

View File

@ -1,17 +1,17 @@
package org.atriasoft.ewol.resource.font;
public enum FontMode {
Regular(0),
Italic(1),
Bold(2),
BoldItalic(3);
REGULAR(0),
ITALIC(1),
BOLD(2),
BOLD_ITALIC(3);
public static FontMode get(final int newValue) {
return switch (newValue) {
case 1 -> Italic;
case 2 -> Bold;
case 3 -> BoldItalic;
default -> Regular;
case 1 -> ITALIC;
case 2 -> BOLD;
case 3 -> BOLD_ITALIC;
default -> REGULAR;
};
}

View File

@ -6,7 +6,6 @@
package org.atriasoft.ewol.widget;
import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
@ -16,7 +15,6 @@ import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.annotation.EwolSignal;
import org.atriasoft.ewol.compositing.AlignMode;
import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.compositing.CompositingText;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
@ -52,7 +50,6 @@ public class Label extends Widget {
public SignalEmpty signalPressed = new SignalEmpty();
protected CompositingText text = new CompositingText(); //!< Compositing text element.
protected String value = "";
protected CompositingDrawing vectorialDraw = new CompositingDrawing();
public Label() {
this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol"));
@ -85,7 +82,7 @@ public class Label extends Widget {
Vector2f tmpMin = this.propertyMinSize.getPixel();
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.alignLeft);
this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT);
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement ");
}
Vector3f minSize = this.text.calculateSizeDecorated(this.value);
@ -122,7 +119,6 @@ public class Label extends Widget {
@Override
protected void onDraw() {
this.text.draw();
this.vectorialDraw.draw();
}
@Override
@ -153,7 +149,7 @@ public class Label extends Widget {
//minSize.setX(etk::max(minSize.x(), this.minSize.x()));
//minSize.setY(etk::max(minSize.y(), this.minSize.y()));
if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.alignLeft);
this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.LEFT);
}
Vector3f currentTextSize = this.text.calculateSizeDecorated(this.value);
@ -191,17 +187,11 @@ public class Label extends Widget {
}
this.text.setPos(tmpTextOrigin);
Log.verbose("[" + getId() + "] {" + this.value + "} display at pos : " + tmpTextOrigin);
this.text.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + localSize.x(), AlignMode.alignLeft);
this.text.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + localSize.x(), AlignMode.LEFT);
this.text.setClipping(drawClippingPos, drawClippingSize);
this.text.printDecorated(this.value);
this.vectorialDraw.clear();
this.vectorialDraw.setColor(Color.ORANGE);
this.vectorialDraw.setPos(new Vector3f(-1024, -1024, 0));
this.vectorialDraw.rectangle(new Vector3f(1024, 1024, 0));
this.text.flush();
this.vectorialDraw.flush();
}
public void setPropertyAutoTranslate(final boolean propertyAutoTranslate) {

View File

@ -491,7 +491,7 @@ public class Widget extends EwolObject {
if (!this.localShortcut.get(iii).isActive) {
continue;
}
if ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.unknow && this.localShortcut.get(iii).unicodeValue() == unicodeValue)
if ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.UNKNOWN && this.localShortcut.get(iii).unicodeValue() == unicodeValue)
|| (this.localShortcut.get(iii).keyboardMoveValue() == kbMove && this.localShortcut.get(iii).unicodeValue() == 0)) {
// In this case we grap the event in case of an error can occured ...
this.localShortcut.get(iii).isActive = false;
@ -504,7 +504,7 @@ public class Widget extends EwolObject {
for (int iii = this.localShortcut.size() - 1; iii >= 0; iii--) {
if (this.localShortcut.get(iii).specialKey().getShift() == special.getShift() && this.localShortcut.get(iii).specialKey().getCtrl() == special.getCtrl()
&& this.localShortcut.get(iii).specialKey().getAlt() == special.getAlt() && this.localShortcut.get(iii).specialKey().getMeta() == special.getMeta()
&& ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.unknow && this.localShortcut.get(iii).unicodeValue() == unicodeValue)
&& ((this.localShortcut.get(iii).keyboardMoveValue() == KeyKeyboard.UNKNOWN && this.localShortcut.get(iii).unicodeValue() == unicodeValue)
|| (this.localShortcut.get(iii).keyboardMoveValue() == kbMove && this.localShortcut.get(iii).unicodeValue() == 0))) {
if (isDown) {
this.localShortcut.get(iii).isActive = true;
@ -761,7 +761,7 @@ public class Widget extends EwolObject {
String message; //!< data link with the event
final KeySpecial specialKey = new KeySpecial(); //!< special board key
Character unicodeValue = null; //!< 0 if not used
KeyKeyboard keyboardMoveValue = KeyKeyboard.unknow; //!< ewol::EVENTKBMOVETYPENONE if not used
KeyKeyboard keyboardMoveValue = KeyKeyboard.UNKNOWN; //!< ewol::EVENTKBMOVETYPENONE if not used
if (sendMessage.length() == 0) {
message = descriptiveString;
} else {
@ -782,59 +782,59 @@ public class Widget extends EwolObject {
specialKey.setMetaLeft(true);
}
if (descriptiveString.contains("F12")) {
keyboardMoveValue = KeyKeyboard.f12;
keyboardMoveValue = KeyKeyboard.F12;
} else if (descriptiveString.contains("F11")) {
keyboardMoveValue = KeyKeyboard.f11;
keyboardMoveValue = KeyKeyboard.F11;
} else if (descriptiveString.contains("F10")) {
keyboardMoveValue = KeyKeyboard.f10;
keyboardMoveValue = KeyKeyboard.F10;
} else if (descriptiveString.contains("F9")) {
keyboardMoveValue = KeyKeyboard.f9;
keyboardMoveValue = KeyKeyboard.F9;
} else if (descriptiveString.contains("F8")) {
keyboardMoveValue = KeyKeyboard.f8;
keyboardMoveValue = KeyKeyboard.F8;
} else if (descriptiveString.contains("F7")) {
keyboardMoveValue = KeyKeyboard.f7;
keyboardMoveValue = KeyKeyboard.F7;
} else if (descriptiveString.contains("F6")) {
keyboardMoveValue = KeyKeyboard.f6;
keyboardMoveValue = KeyKeyboard.F6;
} else if (descriptiveString.contains("F5")) {
keyboardMoveValue = KeyKeyboard.f5;
keyboardMoveValue = KeyKeyboard.F5;
} else if (descriptiveString.contains("F4")) {
keyboardMoveValue = KeyKeyboard.f4;
keyboardMoveValue = KeyKeyboard.F4;
} else if (descriptiveString.contains("F3")) {
keyboardMoveValue = KeyKeyboard.f3;
keyboardMoveValue = KeyKeyboard.F3;
} else if (descriptiveString.contains("F2")) {
keyboardMoveValue = KeyKeyboard.f2;
keyboardMoveValue = KeyKeyboard.F2;
} else if (descriptiveString.contains("F1")) {
keyboardMoveValue = KeyKeyboard.f1;
keyboardMoveValue = KeyKeyboard.F1;
} else if (descriptiveString.contains("LEFT")) {
keyboardMoveValue = KeyKeyboard.left;
keyboardMoveValue = KeyKeyboard.LEFT;
} else if (descriptiveString.contains("RIGHT")) {
keyboardMoveValue = KeyKeyboard.right;
keyboardMoveValue = KeyKeyboard.RIGHT;
} else if (descriptiveString.contains("UP")) {
keyboardMoveValue = KeyKeyboard.up;
keyboardMoveValue = KeyKeyboard.UP;
} else if (descriptiveString.contains("DOWN")) {
keyboardMoveValue = KeyKeyboard.down;
keyboardMoveValue = KeyKeyboard.DOWN;
} else if (descriptiveString.contains("PAGEUP")) {
keyboardMoveValue = KeyKeyboard.pageUp;
keyboardMoveValue = KeyKeyboard.PAGE_UP;
} else if (descriptiveString.contains("PAGEDOWN")) {
keyboardMoveValue = KeyKeyboard.pageDown;
keyboardMoveValue = KeyKeyboard.PAGE_DOWN;
} else if (descriptiveString.contains("START")) {
keyboardMoveValue = KeyKeyboard.start;
keyboardMoveValue = KeyKeyboard.START;
} else if (descriptiveString.contains("END")) {
keyboardMoveValue = KeyKeyboard.end;
keyboardMoveValue = KeyKeyboard.END;
} else if (descriptiveString.contains("PRINT")) {
keyboardMoveValue = KeyKeyboard.print;
keyboardMoveValue = KeyKeyboard.PRINT;
} else if (descriptiveString.contains("ARRETDEFIL")) {
keyboardMoveValue = KeyKeyboard.stopDefil;
keyboardMoveValue = KeyKeyboard.STOP_DEFIL;
} else if (descriptiveString.contains("WAIT")) {
keyboardMoveValue = KeyKeyboard.wait;
keyboardMoveValue = KeyKeyboard.WAIT;
} else if (descriptiveString.contains("INSERT")) {
keyboardMoveValue = KeyKeyboard.insert;
keyboardMoveValue = KeyKeyboard.INSERT;
} else if (descriptiveString.contains("CAPLOCK")) {
keyboardMoveValue = KeyKeyboard.capLock;
keyboardMoveValue = KeyKeyboard.CAP_LOCK;
} else if (descriptiveString.contains("CONTEXTMENU")) {
keyboardMoveValue = KeyKeyboard.contextMenu;
keyboardMoveValue = KeyKeyboard.CONTEXT_MENU;
} else if (descriptiveString.contains("NUMLOCK")) {
keyboardMoveValue = KeyKeyboard.numLock;
keyboardMoveValue = KeyKeyboard.NUM_LOCK;
} else {
unicodeValue = descriptiveString.charAt(descriptiveString.length() - 1);
}
@ -914,12 +914,12 @@ public class Widget extends EwolObject {
if (tmpSize.size().x() <= 0 || tmpSize.size().y() <= 0) {
return;
}
Log.info("setViewport(" + tmpSize.origin() + ", " + tmpSize.size() + ")");
//Log.info("setViewport(" + tmpSize.origin() + ", " + tmpSize.size() + ")");
OpenGL.setViewPort(tmpSize.origin(), tmpSize.size());
// special case, when origin < display origin, we need to cut the display :
Vector2i downOffset = new Vector2i((int) (this.origin.x() - tmpSize.origin().x()), (int) (this.origin.y() - tmpSize.origin().y()));
downOffset = Vector2i.min(downOffset, Vector2i.ZERO);
Log.info("translate : (" + (new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
//Log.info("translate : (" + (new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
// translate the display to have a Gui 0,0 position on the Left button angle
final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate((new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());

View File

@ -272,7 +272,7 @@ public class Windows extends Widget {
}
public void sysDraw() {
Log.verbose("Draw on " + this.size);
//Log.verbose("Draw on " + this.size);
// set the size of the open GL system
OpenGL.setViewPort(Vector2f.ZERO, this.size);
OpenGL.disable(OpenGL.Flag.flag_dither);