Browse Source

Updated to do some basic Node class testing. Mostly works :)

master
Bryan Miller 6 years ago
parent
commit
2a3f3dc048
2 changed files with 25 additions and 0 deletions
  1. +9
    -0
      game/__init__.py
  2. +16
    -0
      game/nodes.py

+ 9
- 0
game/__init__.py View File

@@ -1,4 +1,5 @@
from . import gbe
from .nodes import *

_RUNNING = False

@@ -32,7 +33,15 @@ def start():
d = gbe.display.Display
d.init()
gbe.events.Events.listen("VIDEORESIZE", _OnVideoResize)

root = NodeInterface()

_RUNNING = True
while _RUNNING:
gbe.events.pollEmitter()
d.surface.fill(pygame.Color(0,0,255))
#pygame.draw.rect(d.surface, pygame.Color(255,0,0), (0,0,20,10), 1)
root._update(t.delta)
root._render(d.surface)
d.flip()
d.close()

+ 16
- 0
game/nodes.py View File

@@ -0,0 +1,16 @@

from .gbe.nodes import *
import pygame

class NodeInterface(NodeSurface):
def __init__(self, name="Interface", parent=None):
try:
NodeSurface.__init__(self, name, parent)
except NodeError as e:
raise e

def on_render(self):
size = self.resolution
self.draw_rect((0, 0, size[0], 10), pygame.Color(255,0,0,128), 1)
self.draw_circle((int(size[0]/2), int(size[1]/2)), 16, pygame.Color(255,0,0,255), 2, pygame.Color(0,255,0,255))


Loading…
Cancel
Save