Skip to content

Instantly share code, notes, and snippets.

/DigitNine.py

Created Nov 16, 2015
Embed
What would you like to do?
DigitNine.py
from scene import *
class DigitNineScene(Scene):
def setup(self):
# This will be called before the first frame is drawn.
pass
def draw(self):
# This will be called for every frame (typically 60 times per second).
background(0, 0, 0)
fill(1, 1, 1)
pos = self.bounds.center().as_tuple()
(img, siz) = render_text('9','Helvetica',40)
rect(pos[0],pos[1],*siz)
tint(0,0,0)
image(img, pos[0], pos[1])
tint(0.5,0,0)
image_quad(img, pos[0], pos[1],
pos[0]+siz.w, pos[1],
pos[0], pos[1]+siz.h,
pos[0]+siz.w, pos[1]+siz.h,
0,0,
siz.w,0,
0,siz.h,
siz.w, siz.h)
run(DigitNineScene())
@cclauss

This comment has been minimized.

Copy link

@cclauss cclauss commented Nov 17, 2015

In render_text(), change the 40 to 400 so you can see what is going on.

The quad_image() call is giving you 1/4th of the image which is what I would have expected.

@saper

This comment has been minimized.

Copy link

@saper saper commented Nov 17, 2015

Thanks @cclauss, with 400 they almost overlap.

@saper

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment