kivy-gamecamp-pong-tutorial/DEV_NOTES.md

52 lines
2.3 KiB
Markdown

# Notes while working on Kivy
## Setup of Kivy
- Went with pip install setup on Ubuntu 15.10 x86-64:
1. Fork and clone the Kivy repo:
1. Create a virtualenv
1. Installed the following dependencies:
```sudo apt-get install libjpeg-dev libgl1-mesa-dev libgles2-mesa-dev libsdl2-dev libsdl2-image-dev \
libsdl2-mixer-dev libsdl2-ttf-dev zlib1g-dev```
1. `pip install -e .`
1. `make test` to verify working setup.
## Linux Device Issues:
- Running into device permission errors, mostly like caused by the touchscreen or touchpad:
```
[INFO ] [GL ] NPOT texture support is available
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/dorian.pula/pycon_sprints/kivy/kivy/input/providers/mtdev.py", line 219, in _thread_run
_device = Device(_fn)
File "/home/dorian.pula/pycon_sprints/kivy/kivy/lib/mtdev.py", line 143, in __init__
self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
OSError: [Errno 13] Permission denied: '/dev/input/event7'
[INFO ] [Base ] Leaving application in progress...
```
- Adding user to `input` device did not work.
- This *may* work: https://puredata.info/docs/faq/how-can-i-set-permissions-so-hid-can-read-devices-in-gnu-linux
## Tutorial Improvements:
- [Adding Ball Animation](https://kivy.org/docs/tutorials/pong.html#adding-ball-animation)
- Add in placeholder variable to describe the random direction of the ball.
## Kivy File
- Properties need to be declared at the top of a section in Kv.
- Nothing in the Kv language specification on the order of properties / sections.
## Kivy language
- [Documentation for Kv language](https://kivy.org/docs/guide/lang.html)
- Documentation on language does not have an explicit section on adding comments.
- Nice to have tips for syntax-highlighting inside Kv files for PyCharm
- Thanks @kjell for pointing out [PyCharm settings](https://github.com/kivy/kivy/wiki/Setting-Up-Kivy-with-various-popular-IDE's#kv-lang-auto-completion-and-highlighting)
- The resulting game is quite sluggish... maybe framerate issues?