예제 #1
0
파일: hud.py 프로젝트: Hatchet2k4/Fukyuuten
 def draw(self):
     if self.opacity == 0:
         return
     o = min(255, self.opacity)
     # the width of the repeated span image thingo.
     # each end of the gauge occupies two pixels, so we subtract four.
     # (bad hack, I know)
     width = (self.width or self.oldMax) - 4
     if self.justify == 'left':
         x = self.x + 2
     else:
         x = (ika.Video.xres - width - self.left.width - self.right.width -
              self.x - 2)
     ika.Video.TintBlit(self.left, x, self.y, ika.RGB(255, 255, 255, o))
     ika.Video.TintBlit(self.right, x + width + self.left.width, self.y,
                        ika.RGB(255, 255, 255, o))
     x += self.left.width
     ika.Video.ClipScreen(x, 0, x + width + 1, ika.Video.yres)
     for X in range(0, width-1, self.span.width):
         ika.Video.TintBlit(self.span, x + X, self.y,
                            ika.RGB(255, 255, 255, o))
     ika.Video.ClipScreen()
     x -= 2
     if self.width:
         v = self.oldVal * self.width / self.oldMax
     else:
         v = self.oldVal
     if self.oldVal:
         if self.justify == 'left':
             self.drawRect(x, self.y + 5, x + v, self.y + 6, o)
         else:
             self.drawRect(x + (self.width or self.oldMax) - v, self.y + 5,
                           x + (self.width or self.oldMax), self.y + 6, o)
예제 #2
0
    def Draw(self):
        x1 = OFFSET_X
        x2 = x1 + TILESIZE
        y1 = OFFSET_Y
        y2 = y1 + TILESIZE
        for col in self.grid:
            for tile in col:
                y2 = y1 + TILESIZE
                grey_scale = 15 + (tile.structure * 16)
                ika.Video.DrawRect(x1, y1, x2, y2,
                                   ika.RGB(grey_scale, grey_scale, grey_scale),
                                   1)
                if tile.rarity == "N":
                    pass
                elif tile.rarity == "C":
                    ika.Video.DrawRect(x1, y1, x2, y2, ika.RGB(200, 80, 0),
                                       0)  #brown
                elif tile.rarity == "S":
                    ika.Video.DrawRect(x1, y1, x2, y2, ika.RGB(220, 215, 24),
                                       0)  #yellowish
                elif tile.rarity == "R":
                    ika.Video.DrawRect(x1, y1, x2, y2, ika.RGB(215, 9, 173),
                                       0)  #pinkish
                #''' REMOVED SO THAT "POWER-UPS" ARE HIDDEN
                elif tile.rarity == "X":
                    ika.Video.DrawRect(x1, y1, x2, y2, ika.RGB(0, 255, 0),
                                       0)  #green
                #'''
                y1 += TILESIZE + 1

            x1 = x2 + 1
            x2 = x1 + TILESIZE

            y1 = OFFSET_Y
예제 #3
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()
예제 #4
0
def AutoExec():
    engine.background = ika.Image('gfx/sky_bg.png')
    engine.bgThings.append(
        Clouds('gfx/sky_clouds.png',
               speed=(0.1, 0.025),
               tint=ika.RGB(255, 255, 255, 220)))
    engine.mapThings.append(
        ClippedClouds('stencils/green_00.ika-map.png',
                      'gfx/sky_shadows.png',
                      tint=ika.RGB(255, 5, 5, 255)))

    if 'firstconvo' in engine.saveData:
        engine.things.append(Caption("Anastasia's House", font=engine.font2))
예제 #5
0
    def draw(self):
        o = min(255, self.opacity)
        #ika.Video.TintBlit(self.img, self.x  - ika.Map.xwin, self.y - ika.Map.ywin, ika.RGB(self.r, self.g, self.b, o))
        #ika.Video.DrawRect(self.x, self.y, self.x+self.w, self.y+self.h, ika.RGB(self.r2, self.g2, self.b2, o), 0)
        #ika.Video.DrawRect(int x1, int y1, int x2, int y2, int color[, int filled, int blendMode])
        #ika.Video.DrawTriangle(
        #    (self.x, self.y, ika.RGB(self.r, self.g, self.b, o)),
        #    (self.x+self.w, self.y, ika.RGB(self.r, self.g, self.b, o)),
        #    (self.x, self.y+self.h/2, ika.RGB(self.r2, self.g2, self.b2, o)))

        #ika.Video.DrawTriangle(
        #    (self.x+self.w, self.y+self.h/2, ika.RGB(self.r, self.g, self.b, o)),
        #    (self.x, self.y+self.h/2, ika.RGB(self.r, self.g, self.b, o)),
        #    (self.x+self.w, self.y, ika.RGB(self.r2, self.g2, self.b2, o)))
        ika.Video.TintDistortBlit(
            self.IMG, (self.x, self.y, ika.RGB(self.r, self.g, self.b, o)),
            (self.x + self.w, self.y, ika.RGB(self.r, self.g, self.b, o)),
            (self.x + self.w, self.y + self.h / 2,
             ika.RGB(self.r2, self.g2, self.b2, o)),
            (self.x, self.y + self.h / 2, ika.RGB(self.r2, self.g2, self.b2,
                                                  o)))

        ika.Video.TintDistortBlit(
            self.IMG, (self.x, self.y + self.h / 2,
                       ika.RGB(self.r2, self.g2, self.b2, o)),
            (self.x + self.w, self.y + self.h / 2,
             ika.RGB(self.r2, self.g2, self.b2, o)),
            (self.x + self.w, self.y + self.h,
             ika.RGB(self.r, self.g, self.b, o)),
            (self.x, self.y + self.h, ika.RGB(self.r, self.g, self.b, o)))
예제 #6
0
 def Render(self):
     a = int(self.x)
     b = int(self.y)
     if self.alive == False:
         ika.Video.TintBlit(self.frogimg, a, b, ika.RGB(0, 0,
                                                        0))  #frog dead
     elif self.special == True:
         ika.Video.TintBlit(self.frogimg, a, b, ika.RGB(100, 100, 100,
                                                        255))  #grey
     elif self.pregnant == False:
         if self.waterlvl > 66:
             ika.Video.TintBlit(self.frogimg, a, b,
                                ika.RGB(0, 255, 0, 255))  #frog bright green
         elif self.waterlvl > 33:
             ika.Video.TintBlit(self.frogimg, a, b,
                                ika.RGB(120, 170, 0, 255))  #frog pale green
         elif self.waterlvl > 1:
             ika.Video.TintBlit(self.frogimg, a, b,
                                ika.RGB(50, 80, 0, 255))  #frog brown
     else:
         if self.waterlvl > 66:
             ika.Video.TintBlit(self.frogimg, a, b,
                                ika.RGB(255, 0, 0, 255))  #frog bright green
         elif self.waterlvl > 33:
             ika.Video.TintBlit(self.frogimg, a, b,
                                ika.RGB(170, 0, 0, 255))  #frog pale green
         elif self.waterlvl > 1:
             ika.Video.TintBlit(self.frogimg, a, b,
                                ika.RGB(100, 0, 0, 255))  #frog brown
예제 #7
0
    def show(self, usebackground=False):
        # assume the backbuffer is already filled
        if not usebackground:
            self.images = effects.createBlurImages()
        TIME = 40

        self.update()

        t = Transition()
        t.addChild(self.statWnd,
                   startRect=(-self.statWnd.Right, self.statWnd.Top),
                   time=TIME - 5)
        t.addChild(self.attribWnd,
                   startRect=(-self.attribWnd.Right, self.attribWnd.Top),
                   time=TIME - 5)
        t.addChild(self.magWnd,
                   startRect=(ika.Video.xres, self.magWnd.Top),
                   time=TIME - 5)
        t.addChild(self.menu,
                   startRect=(ika.Video.xres, self.menu.Top),
                   time=TIME - 5)
        #t.addChild(self.inv, startRect=(ika.Video.xres, self.inv.Top), time=TIME - 5)
        t.addChild(self.timer,
                   startRect=(-self.timer.Right, self.timer.Top),
                   time=TIME - 5)
        t.addChild(self.mapname,
                   startRect=(ika.Video.xres, self.mapname.Top),
                   time=TIME - 5)
        for i in range(TIME):
            t.update(1)
            o = i * 128 / TIME  # tint intensity for this frame
            f = i * len(self.images) / TIME  # blur image to draw

            if not usebackground:
                ika.Video.ScaleBlit(self.images[f], 0, 0, ika.Video.xres,
                                    ika.Video.yres, ika.Opaque)
                ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                                   ika.RGB(0, 0, 0, o), True)
            else:
                ika.Video.ScaleBlit(self.background, 0, 0, ika.Video.xres,
                                    ika.Video.yres, ika.Opaque)
                ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                                   ika.RGB(0, 0, 0, 128), True)

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

        self.background = self.images[-1]
예제 #8
0
    def draw(self, selected=-1):
        ika.Video.ScaleBlit(self.background, 0, 0, ika.Video.xres,
                            ika.Video.yres, ika.Opaque)
        ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                           ika.RGB(0, 0, 0, 128), True)
        self.control_menu.draw()

        h = gui.default_font.height
        x = self.control_menu.Left + self.control_menu.linewidth + 20
        offset = 75
        self.header.draw(x, x + offset)

        for i, name in enumerate([
                'up', 'down', 'left', 'right', 'attack', 'cancel', 'showmap',
                'heal', 'rend', 'gale', 'bolt'
        ]):
            y = self.control_menu.Top + h * i
            if i != selected:
                if displayControls[name] == 'None':
                    self.greyfont.Print(x, y, displayControls[name])
                else:
                    gui.default_font.Print(x, y, displayControls[name])
                if displayControls['joy_' + name] == 'None':
                    self.greyfont.Print(x + offset, y,
                                        displayControls['joy_' + name])
                else:  #hack hack
                    gui.default_font.Print(x + offset, y,
                                           displayControls['joy_' + name])
            else:
                self.yellowfont.Print(x, y, displayControls[name])
                self.yellowfont.Print(x + offset, y,
                                      displayControls['joy_' + name])

        w = gui.default_font.StringWidth(self.text) / 2
        gui.default_font.Print(160 - w, 220, self.text)
예제 #9
0
    def run(self):
        self.show()
        while True:
            ika.Video.ScaleBlit(self.images[-1], 0, 0, ika.Video.xres,
                                ika.Video.yres, ika.Opaque)
            ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                               ika.RGB(0, 0, 0, 128), True)
            self.draw()
            ika.Video.ShowPage()
            ika.Input.Update()

            result = self.menu.update()
            if result is Cancel or result == 0:
                break
            elif result is not None:
                [
                    'dummy',  # should never happen
                    #lambda: None, # Control setup
                    #lambda: None, # Load game
                    self.toggleDamage,  # Damange indicator Menu
                    self.setControls,
                    self.exitGame,  # Exit game
                ][result]()

        self.hide()
예제 #10
0
파일: engine.py 프로젝트: Hatchet2k4/Winter
    def gameOver(self):
        c = Caption('G A M E   O V E R',
                    duration=1000000,
                    y=(ika.Video.yres - self.font.height) / 2)
        t = 80
        i = 0
        self.fields = []
        while True:
            i = min(i + 1, t)
            c.update()
            self.tick()
            self.draw()

            # darken the screen, draw the game over message:
            o = i * 255 / t
            ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                               ika.RGB(0, 0, 0, o), True)
            c.draw()

            ika.Video.ShowPage()
            ika.Delay(4)

            if i == t and (controls.attack() or controls.joy_attack()
                           or controls.ui_accept() or controls.ui_cancel()
                           or controls.cancel() or controls.joy_cancel()):
                break
예제 #11
0
def effect2(curTime, startScale, scaleRange, scr):
    r = 9
    g = 9 - min(curTime / startScale, 6)
    b = 8 - min(curTime / startScale, 8)
    ika.Video.DrawRect(0, 0, xres, yres, ika.RGB(r, g, b, 20), True)
    rotateBlit(scr, xres / 2, yres / 2 + math.sqrt(curTime), math.pi / 15, .6 + curTime / scaleRange, ika.AddBlend)
    rotateBlit(scr, xres / 2, yres / 2 - math.sqrt(curTime), math.pi / 15, .6 + curTime / scaleRange, ika.AddBlend)
예제 #12
0
    def run(self):
        self.show()
        while True:
            engine.raw_draw()

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

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

            result = self.itemWnd.update()

            cursorPos = self.itemWnd.cursorPos
            self.descWnd.item = self.itemWnd.items[cursorPos]

            self.descWnd.refresh()

            if result is None:
                continue
            elif result is Cancel:
                self.hide()
                return
            elif self.itemWnd.items[
                    result].totalPrice <= engine.player.stats.money:
                self.hide()
                cs = ConstructScreen(self.itemWnd.items[result],
                                     self.descWnd.width)
                resultItem = cs.run()
                engine.player.items.append(resultItem)
                self.refresh()
                self.show()

        assert False, 'Execution should never reach this point.'
예제 #13
0
파일: cabin.py 프로젝트: Hatchet2k4/Winter
    def draw(self):
        self.curTint += self.curTint < self.tint
        self.curTint -= self.curTint > self.tint

        if self.curTint:
            ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                               ika.RGB(0, 0, 0, self.curTint), True)
예제 #14
0
    def show(self):
        TIME = 35
        self.refresh()

        t = Transition()

        t.addChild(self.itemWnd,
                   startRect=(-self.itemWnd.right, self.itemWnd.top),
                   time=TIME)

        t.addChild(self.descWnd,
                   startRect=(self.descWnd.left, -self.descWnd.bottom),
                   time=TIME)

        t.addChild(self.moneyWnd,
                   startRect=(self.moneyWnd.left,
                              self.moneyWnd.bottom + self.moneyWnd.height),
                   time=TIME)

        for i in range(TIME):
            t.update(1)
            o = i * 128 / TIME  # tint intensity for this frame
            engine.raw_draw()
            ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                               ika.RGB(0, 0, 0, o), True)
            self.draw()
            ika.Video.ShowPage()
            ika.Input.Update()
예제 #15
0
    def hide(self):
        TIME = 40
        t = Transition()

        t.addChild(self.itemWnd,
                   endRect=(self.itemWnd.left,
                            ika.Video.yres + self.itemWnd.height),
                   time=TIME)

        t.addChild(self.descWnd,
                   endRect=(ika.Video.xres + self.descWnd.width,
                            self.descWnd.top),
                   time=TIME)

        t.addChild(self.moneyWnd,
                   endRect=(ika.Video.xres + self.moneyWnd.width,
                            self.moneyWnd.top),
                   time=TIME)

        for i in range(TIME - 1, -1, -1):
            t.update(1)
            o = i * 255 / TIME  # menu opacity for this frame
            engine.raw_draw()
            ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                               ika.RGB(0, 0, 0, o / 2), True)
            self.draw(o)
            ika.Video.ShowPage()
            ika.Input.Update()
예제 #16
0
 def __init__(self,
              imageName,
              speed=(0.2, 0.05),
              tint=ika.RGB(255, 255, 255)):
     self.image = ika.Image(imageName)
     self.pos = [0.0, 0.0]
     self.speed = speed
     self.tint = tint
예제 #17
0
 def draw(self, x, y, w, h):
     x2 = x + w
     y2 = y + h
     ika.Video.DrawTriangle((x, y, self.c1), (x2, y, self.c2),
                            (x2, y2, self.c3))
     ika.Video.DrawTriangle((x2, y2, self.c3), (x, y2, self.c4),
                            (x, y, self.c1))
     ika.Video.DrawRect(x, y, x2, y2, ika.RGB(0, 0, 0), False)
예제 #18
0
    def draw():
        ika.Video.Blit(bg, 0, 0, ika.Opaque)
        ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                           ika.RGB(0, 0, 0, 128), True)

        firstLine = int(y) / font.height
        adjust = int(y) % font.height
        length = (ika.Video.yres / font.height) + 1

        Y = -adjust
        while Y < ika.Video.yres and firstLine < len(_text):
            if firstLine >= 0:
                font.CenterPrint(160, Y, _text[firstLine])
            Y += font.height
            firstLine += 1

        for en in entlist:
            en.draw(int(y))

        ika.Video.DrawTriangle((0, 0, ika.RGB(0, 0, 0)),
                               (ika.Video.xres, 0, ika.RGB(0, 0, 0, 0)),
                               (0, 60, ika.RGB(0, 0, 0, 0)))

        ika.Video.DrawTriangle(
            (ika.Video.xres, ika.Video.yres, ika.RGB(0, 0, 0)),
            (0, ika.Video.yres, ika.RGB(0, 0, 0, 0)),
            (ika.Video.xres, ika.Video.yres - 60, ika.RGB(0, 0, 0, 0)))

        snow.draw()
예제 #19
0
    def healingRainState(self):
        self.stop()
        self.anim = 'magic'

        if self.stats.mp < 15 or not self.stats.heal:
            sound.menuBuzz.Play()
            return

        self.stats.mp -= 15
        sound.healingRain.Play()

        duration=45

        x = self.ent.x + (self.ent.hotwidth / 2)
        y = self.ent.y
        system.engine.addThing(Nova(x, y, 1.0, duration, speed=0.5, color = ika.RGB(0, 120, 240, 255), filled=True ))
        system.engine.addThing(Nova(x, y, 2.0, duration, speed=0.4, color = ika.RGB(100, 200, 255, 255), filled=False ))
        system.engine.addThing(Nova(x, y, 2.0, duration, speed=0.25, color = ika.RGB(200, 200, 255, 255), filled=True ))
        system.engine.addThing(Nova(x, y, 4.0, duration-5, speed=0.6, color = ika.RGB(0, 0, 200, 255), filled=False ))

        self.invincible = True


        amount = self.stats.mag + self.stats.maxhp/8 + ika.Random(-3, 6) #minimum ~12.5% heal        
        self.stats.hp += amount
               
        if self.stats.damageind:
            x=self.ent.x + self.ent.hotwidth/2 - gui.default_font.StringWidth(str(amount))/2
            y=self.ent.y 
            system.engine.addThing(DamageCaption(str(amount), x, y, 40, 0, 240, 60))
            
            
        ents = self.detectCollision((-20, -20, 36, 36, self.layer))

        for e in ents:
            if isinstance(e, IceChunks):
                e.freeze()
                #system.engine.addCaptions(Caption('The water froze over!'))
                system.engine.destroyEntity(e)
                break

        for i in range(duration):
            yield None

        self.invincible = False
예제 #20
0
def effect1(curTime, startScale, scaleRange, scr):
    b = 9
    g = 9 - min(int(curTime) / startScale, 6)
    r = 8 - min(int(curTime) / startScale, 8)
    ika.Video.DrawRect(0, 0, xres, yres, ika.RGB(r, g, b, 250), True)
    RotateBlit(scr, xres / 2, int(yres / 2 + math.sqrt(curTime)), math.pi / 95,
               1.1 - curTime / scaleRange, ika.AddBlend)
    RotateBlit(scr, xres / 2, int(yres / 2 - math.sqrt(curTime)), math.pi / 95,
               .5 + curTime / scaleRange, ika.AddBlend)
예제 #21
0
파일: map18.py 프로젝트: Hatchet2k4/Winter
 def __init__(self):
     self.fade = 255
     self.layer = ika.Map.FindLayerByName('Hidden')
     self.startfade = False
     self.x = 5 * 16
     self.w = 7 * 16
     self.y = 44 * 16
     self.h = 8 * 16
     self.color = ika.RGB(0, 0, 0, 255)
예제 #22
0
    def _update(self): 
        while self.duration <= self.maxduration:
            self.duration += 1
            self.opacity -= 4
            self.opacity = max(0, self.opacity)    
            self.color = ika.RGB(self.r, self.g, self.b, self.opacity)

            yield None

        yield True # seppuku
예제 #23
0
    def draw():
        ika.Video.Blit(bg, 0, 0, ika.Opaque)
        clouds.update()
        clouds.draw()
        font.Print(2, 2, "v.1/05")

        ika.Video.TintBlit(logo, 0, 0, ika.RGB(255, 255, 255, opacity))

        wnd.draw(menuLeft - 5, menuTop - 5, ika.Video.xres - (menuLeft * 2),
                 (len(menuItems) * font.height) + 10,
                 ika.RGB(255, 255, 255, opacity3))
        y = 0
        for i in menuItems:
            font.Print(menuLeft, menuTop + y,
                       '#[%02XFFFFFF]%s' % (opacity2, i))
            y += font.height
        ika.Video.TintBlit(cursor, menuLeft - cursor.width - 2,
                           menuTop + cursorPos * font.height + 2,
                           ika.RGB(255, 255, 255, opacity2))
예제 #24
0
    def hide(self, usebackground=False):
        TIME = 40
        t = Transition()
        t.addChild(self.statWnd,
                   endRect=(-self.statWnd.Right, self.statWnd.Top),
                   time=TIME - 5)
        t.addChild(self.attribWnd,
                   endRect=(-self.attribWnd.Right, self.attribWnd.Top),
                   time=TIME - 5)
        t.addChild(self.magWnd,
                   endRect=(ika.Video.xres, self.magWnd.Top),
                   time=TIME - 5)
        t.addChild(self.menu,
                   endRect=(ika.Video.xres, self.menu.Top),
                   time=TIME - 5)
        #t.addChild(self.inv, endRect=(ika.Video.xres, self.inv.Top), time=TIME - 5)
        t.addChild(self.timer,
                   endRect=(-self.timer.Right, self.timer.Top),
                   time=TIME - 5)
        t.addChild(self.mapname,
                   endRect=(ika.Video.xres, self.mapname.Top),
                   time=TIME - 5)

        for i in range(TIME - 1, -1, -1):
            t.update(1)
            o = i * 255 / TIME  # menu opacity for this frame
            f = i * len(self.images) / TIME  # blur image to draw
            if not usebackground:
                ika.Video.ScaleBlit(self.images[f], 0, 0, ika.Video.xres,
                                    ika.Video.yres, ika.Opaque)
                ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                                   ika.RGB(0, 0, 0, o / 2), True)
                self.draw(o)
            else:
                ika.Video.ScaleBlit(self.background, 0, 0, ika.Video.xres,
                                    ika.Video.yres, ika.Opaque)
                ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                                   ika.RGB(0, 0, 0, 128), True)
                self.draw(255)

            ika.Video.ShowPage()
            ika.Input.Update()
예제 #25
0
 def __init__(self,
              stencilName,
              imageName,
              speed=(0.2, 0.05),
              tint=ika.RGB(255, 255, 255)):
     self.image = ika.Canvas(imageName)  #ika.Image(imageName)
     self.pos = [0.0, 0.0]
     self.speed = speed
     self.canvas = ika.Canvas(320, 240)
     self.stencil = ika.Canvas(stencilName)
     self.tint = tint
     self.first = True
예제 #26
0
 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 
예제 #27
0
    def drawRect(self, ent, x, y, frame):
        d = self.me.direction
        i = self.me._animator.index

        ent.Draw(x, y, frame)

        x += ent.hotx
        y += ent.hoty

        rx, ry, w, h = slashRange[d][i]

        ika.Video.DrawRect(x + rx, y + ry, x + rx + w, y + ry + h,
                           ika.RGB(255, 255, 255))
예제 #28
0
파일: gui.py 프로젝트: Hatchet2k4/Fukyuuten
    def drawCursor(self, active=False):
        pic = self.layout.children[self.cursorPos]

        WIDTH = 4
        x = pic.x + self.x + self.layout.x - WIDTH
        y = pic.y + self.y + self.layout.y - WIDTH

        BLINK_RATE = 50
        blink = (ika.GetTime() % BLINK_RATE) * 2 > BLINK_RATE

        if active and blink:
            ika.Video.Blit(self.cursor, x, y)
        else:
            ika.Video.TintBlit(self.cursor, x, y, ika.RGB(128, 128, 128))
예제 #29
0
파일: hud.py 프로젝트: Hatchet2k4/Fukyuuten
 def draw(self):
     if self.opacity == 0:
         return
     o = min(255, self.opacity)
     # the heightof the repeated span image thingo.
     # each end of the gauge occupies two pixels, so we subtract four.
     # (bad hack, I know)
     height = min(226, (self.height or self.oldMax) - self.top.height - self.bottom.height)
     if self.justify == 'top':
         y = self.y + self.top.height
     else:
         y = (ika.Video.yres - height - self.top.height - self.bottom.height -
              self.y)
     ika.Video.TintBlit(self.top, self.x, y, ika.RGB(255, 255, 255, o))
     ika.Video.TintBlit(self.bottom, self.x, y + height + self.top.height,
                        ika.RGB(255, 255, 255, o))
     y += self.top.height
     ika.Video.ClipScreen(0, y, ika.Video.xres, y + height)
     for Y in range(0, height, self.span.height):
         ika.Video.TintBlit(self.span, self.x, y + Y,
                            ika.RGB(255, 255, 255, o))
     ika.Video.ClipScreen()
         
     if self.oldVal:
         c = self.colour
         va = self.oldVal
         #print `self.curVal`
         for a in range(self.oldVal / 226 + 1):
             v = min(226, va) * height / min(226, self.oldMax)
             if self.justify == 'top':
                 self.drawRect(self.x + 5, y, self.x + 7, y + v, o, col=c)
             else:
                 self.drawRect(self.x + 5, y + height - v,
                               self.x + 7, y + height - 1, o, col=c)
             va -= 226
             c = (c[0], c[1]+128, c[2])
예제 #30
0
def drawGlow():
    factor = 0.10
    tint = ika.RGB(128, 128, 128)

    screen = ika.Video.GrabImage(0, 0, ika.Video.xres, ika.Video.yres)
    ika.Video.ScaleBlit(screen, 0, 0, screen.width * factor,
                        screen.height * factor)
    smallScreen = ika.Video.GrabImage(0, 0, screen.width * factor,
                                      screen.height * factor)

    ika.Video.Blit(screen, 0, 0, ika.Opaque)
    ika.Video.TintDistortBlit(smallScreen, (0, 0, tint),
                              (ika.Video.xres, 0, tint),
                              (ika.Video.xres, ika.Video.yres, tint),
                              (0, ika.Video.yres, tint), ika.AddBlend)