Created
April 14, 2022 14:09
-
-
Save eqs/3a5d43fbdf091e416a4d3add249bb9e9 to your computer and use it in GitHub Desktop.
Example code for q5 v0.0.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import q5 | |
class App(q5.BaseApp): | |
def __init__(self): | |
self.x = 0.0 | |
self.y = 0.0 | |
def update(self): | |
pass | |
def draw(self): | |
q5.background(220) | |
q5.circle(self.x, self.y, 200.0) | |
def mouse_pressed(self): | |
if q5.mouse_button == q5.MOUSE_LEFT: | |
self.x = q5.mouse_x | |
self.y = q5.mouse_y | |
def mouse_released(self): | |
pass | |
def mouse_moved(self): | |
pass | |
def key_pressed(self): | |
if q5.key == q5.KEY_S: | |
q5.save_frame('screenshot.png') | |
print('saved.') | |
def key_released(self): | |
pass | |
if __name__ == '__main__': | |
app = App() | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment