Skip to content

Drawing in Gamwo!

ImNotRinka edited this page Jul 29, 2022 · 2 revisions

Drawing in Gamwo!

For now, you can draw a background color or an entity, in this page we'll learn how to draw background, in the next episode we'll learn about entities

At the moment, we have this code:

from gamwo import *

window = Gamwo("My first window! :D", 800, 600)

window.run()

In Gamwo, we have 2 decorators: draw and update, now we are going to learn draw decorator.

Everything that you write in a function with draw decorator will be drawn in gamwo screen, you can create a function with a title whatever you want, but I recommend draw.

Here a code:

@window.draw
def draw():
   pass

We have just one thing created at the moment: a window. So we're going to fill window with red color Gamwo.changeBackgroundColor we can has a background, we are going to use this function in draw function:

@window.draw
def draw():
   window.changeBackgroundColor('red') # We can use the color in string
   window.changeBackgroundColor((255, 0, 0)) # We can use the color in RGB

Well, that's all.

Resulting code

from Gamwo import *

window = Gamwo("My first window!", 800, 600)

@window.draw
def draw():
    window.changeBackgroundColor((255, 0, 0))

window.run()

Result

image

Clone this wiki locally