Skip to content

Commit

Permalink
fix text position
Browse files Browse the repository at this point in the history
  • Loading branch information
lgassman committed Dec 27, 2020
1 parent 4bd8aab commit f96b27a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class VisualComponent {

List<BalloonMessage> balloonMessages = newArrayList
boolean showAttributes = false

boolean hasText = false

WollokObject wObject
Expand All @@ -43,15 +44,6 @@ class VisualComponent {
wObject.call(TEXT_CONVENTION)
hasText = true
}catch(WollokProgramExceptionWrapper e) {
println("ERROR TRATANDO DE ENCONTRAR EL METODO TEXT")
e.printStackTrace()
throw e;
//TODO check only for method dont understand
}
catch(RuntimeException e) {
println("ERROR TRATANDO DE ENCONTRAR EL METODO TEXT 2")
e.printStackTrace()
throw e;
}
}

Expand Down Expand Up @@ -92,7 +84,7 @@ class VisualComponent {
}

def drawText(Window window) {
if(hasText) window.write(wObject.call(TEXT_CONVENTION).wollokToJava(String) as String, Color.BLACK, getPosition().x, getPosition().y)
if(hasText) window.writeText(wObject.call(TEXT_CONVENTION).wollokToJava(String) as String, getPosition(), Color.BLACK)
}

def drawAttributesIfNecesary(Window window) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class Window {
def doDraw(Texture texture, Position it, ImageSize size) {
batch.draw(texture, xinPixels, yinPixels, size.width(texture.width), size.height(texture.height))
}

def writeText(String text, Position position, Color color) {
write(text, color, position.xinPixels - 80, position.yinPixels + TEXT_SIZE)
}

def writeAttributes(String text, Position position, Color color) {
val lines = text.split("[\n|\r]").length
Expand Down

0 comments on commit f96b27a

Please sign in to comment.