Class GView¶
This is the class that you will use to draw shapes to the screen. Simply pass an
instance of this class to the draw
method in GObject.
You must do this every animation frame, as the game is constantly clearing the window.
You should never construct an object of this class. Creating a new instance
of this class will not properly display it on the screen. Instead, you should
only use the one provided in the input
attribute of GameApp. See that class
for more information.
Constructor¶
- class game2d.GView¶
A class representing a drawing window for a
GameApp
application.This is the class that you will use to draw shapes to the screen. Simply pass your
GObject
instances to thedraw()
method. You must do this every animation frame, as the game is constantly clearing the window.You should never construct an object of this class. Creating a new instance of this class will not properly display it on the screen. Instead, you should only use the one provided in the view attribute of
GameApp
. See the documentation of that class for more information.
Methods¶
- GView.draw(cmd)¶
Draws the given Kivy graphics command to this view.
You should never call this method, since you do not understand raw Kivy graphics commands. Instead, you should use the draw method in
GObject
instead.- Parameters
cmd (A Kivy graphics command) – the command to draw
- GView.clear()¶
Clears the contents of the view.
This method is called for you automatically at the start of the animation frame. That way, you are not drawing images on top of one another.