from glumpy import app, gl, gloo, glm, data, text

window = app.Window(width=512, height=512)

@window.event
def on_draw(dt):
    window.clear()
    label.draw(x=256, y=256, color=(1,1,1,1))

font = text.TextureFont(data.get("OpenSans-Regular.ttf"), 64)
label = text.Label("Hello World !", font,
                   anchor_x = 'center', anchor_y = 'center')
app.run()

from glumpy import app, gl, gloo, glm, data
from glumpy.graphics.text import FontManager
from glumpy.graphics.collections import GlyphCollection
from glumpy.transforms import Position, OrthographicProjection

window = app.Window(width=512, height=512)

@window.event
def on_draw(dt):
    window.clear()
    label.draw()

x,y,z = 256,256,0
font = FontManager.get("OpenSans-Regular.ttf", 64, mode='agg')
label = GlyphCollection('agg', transform=OrthographicProjection(Position()))
label.append("Hello World !", font,
                   anchor_x = 'center', anchor_y = 'center',
                   origin=(x,y,z), color=(1,1,1,1))

window.attach(label["transform"])

app.run()

Fix hello world example broken imports
Fix hello world example broken imports

- from glumpy import app, gl, gloo, glm, data, text
+ from glumpy import app, gl, gloo, glm, data
+ from glumpy.graphics.text import FontManager
+ from glumpy.graphics.collections import GlyphCollection
+ from glumpy.transforms import Position, OrthographicProjection
  
  window = app.Window(width=512, height=512)
  
  @window.event
  def on_draw(dt):
      window.clear()
-     label.draw(x=256, y=256, color=(1,1,1,1))
+     label.draw()
  
- font = text.TextureFont(data.get("OpenSans-Regular.ttf"), 64)
+ x,y,z = 256,256,0
+ font = FontManager.get("OpenSans-Regular.ttf", 64, mode='agg')
+ label = GlyphCollection('agg', transform=OrthographicProjection(Position()))
- label = text.Label("Hello World !", font,
+ label.append("Hello World !", font,
-                    anchor_x = 'center', anchor_y = 'center')
+                    anchor_x = 'center', anchor_y = 'center',
+                    origin=(x,y,z), color=(1,1,1,1))
+ 
+ window.attach(label["transform"])
+ 
  app.run()
  
Fix hello world example broken imports
## Code Before:
from glumpy import app, gl, gloo, glm, data, text

window = app.Window(width=512, height=512)

@window.event
def on_draw(dt):
    window.clear()
    label.draw(x=256, y=256, color=(1,1,1,1))

font = text.TextureFont(data.get("OpenSans-Regular.ttf"), 64)
label = text.Label("Hello World !", font,
                   anchor_x = 'center', anchor_y = 'center')
app.run()

## Instruction:
Fix hello world example broken imports
## Code After:
from glumpy import app, gl, gloo, glm, data
from glumpy.graphics.text import FontManager
from glumpy.graphics.collections import GlyphCollection
from glumpy.transforms import Position, OrthographicProjection

window = app.Window(width=512, height=512)

@window.event
def on_draw(dt):
    window.clear()
    label.draw()

x,y,z = 256,256,0
font = FontManager.get("OpenSans-Regular.ttf", 64, mode='agg')
label = GlyphCollection('agg', transform=OrthographicProjection(Position()))
label.append("Hello World !", font,
                   anchor_x = 'center', anchor_y = 'center',
                   origin=(x,y,z), color=(1,1,1,1))

window.attach(label["transform"])

app.run()
