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

Public Member Functions

def __init__
 
def draw
 
def undraw
 
def redraw
 
def stopPlaying
 
def startPlaying
 
def setNextRoom
 
def setAspectRatio
 
def onMessage
 
def onEOS
 
- Public Member Functions inherited from GUIStaticImage
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

 eosHandler
 
 startHandler
 
 stopHandler
 
 redrawPreservesZ
 
 nextRoom
 
 aspect
 
 visible
 
 spritestate
 
- Data Fields inherited from GUIStaticImage
 sprite
 
 index
 
 spritestate
 
 redrawPreservesZ
 
 visible
 
- Data Fields inherited from GUIElement
 room
 
 owner
 
 visible
 
 redrawPreservesZ
 
 id
 

Detailed Description

Definition at line 1707 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 1708 of file GUI.py.

1709  def __init__(self,room,index,sprite,**kwarg):
1710  """ Sprite must be a tuple of the form: """
1711  """ ( path , location ) """
1712  """ with 'location' being a GUIRect """
1713  """ NOTE: It is legal to set sprite to None """
1714  """ This allows subclassing to create """
1715  """ non-static elements """
1716  self.eosHandler = kwarg.pop('eosHandler',None)
1717  self.startHandler = kwarg.pop('startHandler',None)
1718  self.stopHandler = kwarg.pop('stopHandler',None)
1719 
1720  GUIStaticImage.__init__(self,room,index,sprite,**kwarg)
1721 
1722  # it does not for this subclass
1723  self.redrawPreservesZ=0
1725  self.nextRoom = None
1726  self.aspect = None

Member Function Documentation

def draw (   self)
Creates the element 

Definition at line 1727 of file GUI.py.

1728  def draw(self):
1729  """ Creates the element """
1730  if (self.visible == 1) and (self.spritestate==0) and self.spriteIsValid():
1731  pythoncallback = lambda id,event : (
1732  "# <-- this disables precompiled python objects\n"
1733  +"from GUI import GUIRootSingleton\n"
1734  +"GUIRootSingleton.dispatchMessage(%r,%r,None)\n"
1735  +"GUIRootSingleton.redrawIfNeeded()\n" ) % (id,event)
1736 
1737  (x,y,w,h) = self.sprite[1].getSpriteRect()
1738  self.spritestate = Base.VideoStream(self.room.getIndex(),self.index,self.sprite[0],x,y,w,h)
1739  if self.spritestate is None:
1740  self.spritestate = 1
1741  if self.spritestate:
1742  Base.SetVideoCallback(self.room.getIndex(),self.index,pythoncallback(self.id, "eos"))
1743  self.setAspectRatio(self.aspect)
1744  Base.RunScript(self.room.getIndex(),self.index+"PLAY",pythoncallback(self.id, "play"),0.0)
1745  else:
1746  # Movies are optional, so don't break - skip (immediate EOS) instead
1747  # Enqueue it to happen as soon as the movie screen is shown
1748  Base.RunScript(self.room.getIndex(),self.index+"EOS",pythoncallback(self.id, "eos"),0.0)
def onEOS (   self,
  params 
)
Callback for End-Of-Stream.

Definition at line 1806 of file GUI.py.

References GUIVideoStream.eosHandler.

1807  def onEOS(self, params):
1808  """
1809  Callback for End-Of-Stream.
1810  """
1811  if self.eosHandler:
1812  self.eosHandler(self, params)
1813 
1814 
1815 """----------------------------------------------------------------"""
1816 """ """
1817 """ GUIMovieRoom - implements a cutscene movie as a room with just """
1818 """ the movie playing, it will transition to another room """
1819 """ when the movie ends, or a "skip" key is pressed, or """
1820 """ the mouse clicked anywhere on the screen """
1821 """ """
1822 """----------------------------------------------------------------"""
def onMessage (   self,
  message,
  params 
)

Definition at line 1792 of file GUI.py.

References GUIVideoStream.onEOS(), GUIVideoStream.startPlaying(), and GUIVideoStream.stopPlaying().

1793  def onMessage(self, message, params):
1794  if not GUIStaticImage.onMessage(self, message, params):
1795  if message == 'eos':
1796  self.onEOS(params)
1797  elif message == 'play':
1798  self.startPlaying()
1799  elif message == 'stop':
1800  self.stopPlaying()
1801  else:
1802  return False
1803  return True
1804  else:
1805  return True
def redraw (   self)
Sets a new image 

Definition at line 1754 of file GUI.py.

References DialogBox.Item.draw(), DialogBox.List.draw(), DialogBox.Row.draw(), DialogBox.draw(), GUIElement.draw(), GUIStaticImage.spritestate, DialogBox.Item.undraw(), DialogBox.Row.undraw(), DialogBox.undraw(), and GUIElement.undraw().

1755  def redraw(self):
1756  """ Sets a new image """
1757  if self.spritestate==1:
1758  self.undraw()
1759  self.draw()
def setAspectRatio (   self,
  aspect 
)

Definition at line 1775 of file GUI.py.

References GUIRoot.aspect, GUIVideoStream.aspect, Tokenizer.index, ListReader.index, GUIRoom.index, GUIStaticImage.index, DialogBox.Button.sprite, AddSprite.sprite, GUIStaticImage.sprite, and GUIStaticImage.spritestate.

1776  def setAspectRatio(self, aspect):
1777  self.aspect = aspect
1778  if self.spritestate:
1779  (x,y,w,h) = self.sprite[1].getSpriteRect()
1780  screenAspect = GUIRootSingleton.getScreenAspectRatio()
1781 
1782  xf = yf = 1.0
1783  if aspect is not None:
1784  if screenAspect < aspect:
1785  # horizontal bars needed
1786  yf = screenAspect / aspect
1787  elif aspect < screenAspect:
1788  # vertical bars needed
1789  xf = aspect / screenAspect
1790 
1791  Base.SetTextureSize(self.room.getIndex(), self.index, w * xf, h * yf)
def setNextRoom (   self,
  nextRoom 
)

Definition at line 1772 of file GUI.py.

References GUIVideoStream.nextRoom.

1773  def setNextRoom(self, nextRoom):
1774  self.nextRoom = nextRoom
def startPlaying (   self)

Definition at line 1766 of file GUI.py.

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

1767  def startPlaying(self):
1768  if self.spritestate==1:
1769  Base.PlayVideo(self.room.getIndex(), self.index)
1770  if self.startHandler:
1771  self.startHandler(self)
def stopPlaying (   self)

Definition at line 1760 of file GUI.py.

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

1761  def stopPlaying(self):
1762  if self.spritestate==1:
1763  Base.StopVideo(self.room.getIndex(), self.index)
1764  if self.stopHandler:
1765  self.stopHandler(self)
def undraw (   self)
Hides the element 

Definition at line 1749 of file GUI.py.

References GUIVideoStream.stopPlaying().

1750  def undraw(self):
1751  """ Hides the element """
1752  self.stopPlaying()
1753  GUIStaticImage.undraw(self)

Field Documentation

aspect

Definition at line 1725 of file GUI.py.

eosHandler

Definition at line 1715 of file GUI.py.

nextRoom

Definition at line 1724 of file GUI.py.

redrawPreservesZ

Definition at line 1722 of file GUI.py.

spritestate

Definition at line 1729 of file GUI.py.

startHandler

Definition at line 1716 of file GUI.py.

stopHandler

Definition at line 1717 of file GUI.py.

visible

Definition at line 1729 of file GUI.py.


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