Browse Source

Fixed gbe.nodes visible behaviour... to actually work.

master
Bryan Miller 6 years ago
parent
commit
630012c47c
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      game/gbe/nodes.py

+ 11
- 2
game/gbe/nodes.py View File

del self._ACTIVE_SURF del self._ACTIVE_SURF


def _render(self, surface): def _render(self, surface):
if self._NODE2D_DATA["visible"]:
if self._NODE2D_DATA["visible"] == True:
self._callOnRender(surface) self._callOnRender(surface)
Node._render(self, surface) Node._render(self, surface)


return (cc.r, cc.g, cc.b, cc.a) return (cc.r, cc.g, cc.b, cc.a)


def _render(self, surface): def _render(self, surface):
if self.visible == False:
return

if self._surface is None: if self._surface is None:
self.set_surface() self.set_surface()
if self._surface is not None: if self._surface is not None:
if a < 0 or a > 255: if a < 0 or a > 255:
raise ValueError("Alpha value out of bounds.") raise ValueError("Alpha value out of bounds.")
color = self._NODETEXT_DATA[cname] color = self._NODETEXT_DATA[cname]
if color.r != r or color.g != g or color.b != b or color.a != a:
if color is None or color.r != r or color.g != g or color.b != b or color.a != a:
self._NODETEXT_DATA[cname] = pygame.Color(r,g,b,a) self._NODETEXT_DATA[cname] = pygame.Color(r,g,b,a)
self._NODETEXT_DATA["surface"] = None self._NODETEXT_DATA["surface"] = None






def _render(self, surface): def _render(self, surface):
if self.visible == False:
return

if self._NODETEXT_DATA["surface"] is None and self._NODETEXT_DATA["text"] != "": if self._NODETEXT_DATA["surface"] is None and self._NODETEXT_DATA["text"] != "":
res = self.resource res = self.resource
fnt = res.get("font", self._NODETEXT_DATA["font_src"], {"size":self._NODETEXT_DATA["size"]}) fnt = res.get("font", self._NODETEXT_DATA["font_src"], {"size":self._NODETEXT_DATA["size"]})
self._NODESPRITE_DATA["rect"]=[0,0,0,0] self._NODESPRITE_DATA["rect"]=[0,0,0,0]


def _render(self, surface): def _render(self, surface):
if self.visible == False:
return

# Call the on_render() method, if any # Call the on_render() method, if any
Node2D._callOnRender(self, surface) Node2D._callOnRender(self, surface)

Loading…
Cancel
Save