Python Game Development - Update Glut Window while Programming - Like Livereload -


i decided go learning opengl , found simple examples creating circles , triangles , other colorful weird shapes... killer development process closing - xkilling window , rerunning file... there faster way see glut window contents update?

after ended using pyglet.

created basic "hello world"

import pyglet  class window(pyglet.window.window):     def __init__(self):         super().__init__()         self.set_size(800, 600)      def on_draw(self):          self.clear()          label = pyglet.text.label('hello, world',             font_name='arial',             font_size=36,             x=window.width//2, y=window.height//2,             anchor_x='center', anchor_y='center')          label.draw()  if __name__ == '__main__':     window = window()     pyglet.app.run() 

i created sh

#!/bin/bash echo "run pyglet" pkill -f game.py #kill game running python3 /locationof/game.py 

i made executable:

chmod +x game.sh 

or if kinky

cp -r "file executable" "/usr/bin" && chmod 755 "/usr/bin/file executable" 

created build system sublime /tools/build system/new build system:

{ "cmd": ["game.sh", "$file_base_name"], "selector": "source.python", "file_regex": "file \"(...*?)\", line ([0-9]+)" } 

and every time press ctrl+b sublime builds, kills game , reruns it.


Comments