Hello Pyxel
Hello World in Pyxel
#This guide assumes steps in [/pyxel/setup/] have been completed.
-
Get some examples
mkdir -p ~/src cd ~/src pyxel copy_examples
-
Run a program!
cd ~/src/pyxel_examples pyxel run ./01_hello_pyxel.py
-
Make a sprite!
cd ~/src/pyxel_examples pyxel edit ./01_hello_pyxel.py
Be sure to put it in the upper left corner, (0,0)
-
Edit a program
cd ~/src/pyxel_examples codium .
Let's replace the logo with what we just drew.
# pyxel.images[0].load(0, 0, "assets/pyxel_logo_38x16.png") pyxel.load("./01_hello_pyxel.py.pyxres")
Tip: Notice how this was loading a bitmap into 0,0 which we drew our new drawing into in the previous step.
-
Run in again!
pyxel run ./01_hello_pyxel.py
-
Create a file for the website
$ mkdir hello $ mv ./01_hello_pyxel.py ./hello/ $ mv ./01_hello_pyxel.py.pyxres ./hello/ $ pyxel package hello ./hello/01_hello_pyxel.py added 'hello/.pyxapp_startup_script' added 'hello/01_hello_pyxel.py' pyxel app2html hello
Now open
hello.html
in a browser....Like thisTip: It will show the
Pyxel
logo for several moments while it loads.