Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
GUIStaticImage Class Reference
Inheritance diagram for GUIStaticImage:
GUIElement GUIButton GUIVideoStream GUIVideoTexture GUICheckButton GUICompButton GUIRoomButton GUIRadioButton

Public Member Functions

def __init__
 
def spriteIsValid
 
def draw
 
def undraw
 
def redraw
 
def setSprite
 
- Public Member Functions inherited from GUIElement
def __init__
 
def __str__
 
def __repr__
 
def show
 
def hide
 
def notifyNeedRedraw
 
def draw
 
def undraw
 
def redraw
 
def onMessage
 
def onClick
 
def onShow
 
def onHide
 
def onDraw
 
def onUndraw
 
def onRedraw
 
def focus
 
def setModal
 
def isInteractive
 

Data Fields

 sprite
 
 index
 
 spritestate
 
 redrawPreservesZ
 
 visible
 
- Data Fields inherited from GUIElement
 room
 
 owner
 
 visible
 
 redrawPreservesZ
 
 id
 

Detailed Description

Definition at line 872 of file GUI.py.

Constructor & Destructor Documentation

def __init__ (   self,
  room,
  index,
  sprite,
  kwarg 
)
Sprite must be a tuple of the form:     
( path , location )                 
with 'location' being a GUIRect     
NOTE: It is legal to set sprite to None 
This allows subclassing to create   
non-static elements                 

Definition at line 873 of file GUI.py.

874  def __init__(self,room,index,sprite,**kwarg):
875  """ Sprite must be a tuple of the form: """
876  """ ( path , location ) """
877  """ with 'location' being a GUIRect """
878  """ NOTE: It is legal to set sprite to None """
879  """ This allows subclassing to create """
880  """ non-static elements """
881 
882  GUIElement.__init__(self,room,**kwarg)
883 
884  self.sprite=sprite
885  self.index=index
886  self.spritestate=0
887  self.redrawPreservesZ=1

Member Function Documentation

def draw (   self)
Creates the element 

Definition at line 895 of file GUI.py.

896  def draw(self):
897  """ Creates the element """
898 # if (self.visible == 0):
899 # print "::: GUIStaticImage draw called when self.visible == 0"
900  if (self.visible == 1) and (self.spritestate==0) and self.spriteIsValid():
901  (x,y,w,h) = self.sprite[1].getSpriteRect()
902  Base.Texture(self.room.getIndex(),self.index,self.sprite[0],x,y)
903  Base.SetTextureSize(self.room.getIndex(),self.index,w,h) # override spr file data... it's hideously unmantainable...
904  self.spritestate=1
def redraw (   self)
Sets a new image 

Definition at line 911 of file GUI.py.

References DialogBox.Item.draw(), DialogBox.List.draw(), DialogBox.Row.draw(), DialogBox.draw(), GUIElement.draw(), Tokenizer.index, ListReader.index, GUIRoom.index, GUIStaticImage.index, DialogBox.Button.sprite, AddSprite.sprite, GUIStaticImage.sprite, GUIStaticImage.spriteIsValid(), and GUIStaticImage.spritestate.

912  def redraw(self):
913  """ Sets a new image """
914  if self.spritestate!=1:
915  self.draw()
916  elif self.spriteIsValid():
917  (x,y,w,h) = self.sprite[1].getSpriteRect()
918  Base.SetTexture(self.room.getIndex(),self.index,self.sprite[0]);
919  Base.SetTexturePos(self.room.getIndex(),self.index,x,y);
920  Base.SetTextureSize(self.room.getIndex(),self.index,w,h);
921  else:
922  # Avoid calling subclass implementations
923  GUIStaticImage.undraw(self)
def setSprite (   self,
  newsprite 
)

Definition at line 924 of file GUI.py.

References GUIRoom.notifyNeedRedraw(), GUIElement.notifyNeedRedraw(), DialogBox.Button.sprite, AddSprite.sprite, and GUIStaticImage.sprite.

925  def setSprite(self,newsprite):
926  if self.sprite != newsprite:
927  self.sprite = newsprite
928  self.notifyNeedRedraw()
929 
930 
931 
932 """----------------------------------------------------------------"""
933 """ """
934 """ GUIStaticText - a non-interactive text box """
935 """ """
936 """----------------------------------------------------------------"""
def spriteIsValid (   self)

Definition at line 888 of file GUI.py.

References DialogBox.Button.sprite, AddSprite.sprite, and GUIStaticImage.sprite.

889  def spriteIsValid(self):
890  return ( self.sprite
891  and type(self.sprite) is tuple
892  and len(self.sprite)>=2
893  and self.sprite[0] is not None
894  and self.sprite[1] is not None )
def undraw (   self)
Hides the element 

Definition at line 905 of file GUI.py.

References Tokenizer.index, ListReader.index, GUIRoom.index, GUIStaticImage.index, and GUIStaticImage.spritestate.

906  def undraw(self):
907  """ Hides the element """
908  if self.spritestate==1:
909  Base.EraseObj(self.room.getIndex(),self.index)
910  self.spritestate=0

Field Documentation

index

Definition at line 884 of file GUI.py.

redrawPreservesZ

Definition at line 886 of file GUI.py.

sprite

Definition at line 883 of file GUI.py.

spritestate

Definition at line 885 of file GUI.py.

visible

Definition at line 899 of file GUI.py.


The documentation for this class was generated from the following file: