コード例 #1
0
def fade(time, startColour = ika.RGB(0, 0, 0, 0), endColour = ika.RGB(0, 0, 0, 255), draw = ika.Map.Render):
    startColour = ika.GetRGB(startColour)
    endColour   = ika.GetRGB(endColour)
    deltaColour = [ s - e for e, s in zip(startColour, endColour) ]

    t = ika.GetTime()
    endtime = t + time
    saturation = 0.0

    while t < endtime:
        i = ika.GetTime() - t
        t = ika.GetTime()
        saturation = min(saturation + float(i) / time, 1.0)
        draw()
        colour = [int(a + b * saturation) for a, b in zip(startColour, deltaColour)]

        ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
            ika.RGB(*colour),
            True)

        ika.Video.ShowPage()
        ika.Input.Update()

        while t == ika.GetTime():
            ika.Input.Update()
コード例 #2
0
ファイル: effects.py プロジェクト: Hatchet2k4/Winter
 def __init__(self, x, y, endx, endy, color):
     self.x=x
     self.y=y
     self.endx=endx
     self.endy=endy
     self.duration=0
     self.maxduration=50
     self.opacity=200               
     self.r, self.g, self.b, self.a = ika.GetRGB(color)        
     self.color=color        
     self.points=self.generatePoints(ika.Random(6, 12))                        
     self.update = self._update().next 
コード例 #3
0
ファイル: effects.py プロジェクト: Hatchet2k4/Winter
 def __init__(self, x, y, radius=1.0, duration=200, speed=2, color=ika.RGB(128,128,128), filled=False):
     self.x=x
     self.y=y
     self.rad=radius
     self.duration=0
     self.maxduration=duration
     self.opacity=255
     self.speed=speed
     self.filled=filled
     
     self.r, self.g, self.b, self.a = ika.GetRGB(color)
     self.font = system.engine.font                
     self.update = self._update().next 
コード例 #4
0
ファイル: hud.py プロジェクト: Hatchet2k4/Fukyuuten
 def __init__(self, imageName, x, y, justify='bottom',
              colour=ika.RGB(255, 255, 255)):
     """imageName - name of the image series to use.
        (ie 'gfx/ui/hud_%sbar.png')
        x, y are position
        justify is either 'top' or 'bottom'
     """
     
     super(VerticalGauge, self).__init__()
     
     (self.span, self.top, self.bottom) = [
         ika.Image("gfx/ui/hud_%s%s.png" % (imageName, ['bar','top','bot'][i])) for i in range(3)
     ]
     self.x, self.y = x,y
     self.justify = justify.lower()
     self.colour = ika.GetRGB(colour)[:-1]
     self.height = None
コード例 #5
0
ファイル: hud.py プロジェクト: Hatchet2k4/Fukyuuten
 def __init__(self, imageName, x, y, justify='left',
              colour=ika.RGB(255, 255, 255)):
     """imageName - name of the image series to use.
        (ie 'gfx/ui/hud_%sbar.png')
        x, y are position
        justify is either 'left' or 'right'
     """
     
     super(HorizontalGauge, self).__init__()
     
     (self.span, self.left, self.right) = [
         ika.Image("gfx/ui/hud_%s%s.png" % (imageName, ['bar','left','right'][i])) for i in range(3)
     ]
     self.x, self.y = x,y
     self.justify = justify.lower()
     self.colour = ika.GetRGB(colour)[:-1]
     self.width = None
コード例 #6
0
ファイル: hud.py プロジェクト: Hatchet2k4/Winter
    def __init__(self,
                 imageName,
                 x,
                 y,
                 justify='left',
                 colour=ika.RGB(255, 255, 255)):
        '''
        imageName - name of the image series to use.
         ie 'gfx/ui/barhp%i.png'
        x,y are position
        justify is either 'left' or 'right'
        '''

        (self.span, self.left, self.middle, self.right) =\
            [ika.Image(imageName % i) for i in range(4)]
        self.oldVal = self.oldMax = 0
        self.x, self.y = x, y
        self.justify = justify.lower()
        self.opacity = 0
        self.colour = ika.GetRGB(colour)[:-1]
        self.width = None
        self.fadeIn = False
        self.type = ''