def get_texture(self, filename):
     if filename in self.textures:
         return self.textures[filename]
     else:
         path = 'textures/{}'.format(filename)
         if os.path.exists(path):
             tex = Image(source=path).texture
             tex.wrap = 'repeat'
             self.textures[filename] = tex
             return tex
         else:
             print '{} does not exist'.format(path)
Exemple #2
0
    def __init__(self, size, *args):
        super(Menu, self).__init__(size=size, *args)
        font_size = size[1] / 10
        background = Image(source='images/background.png').texture
        background.wrap = 'repeat'

        aspectRatio = size[1] / float(background.size[1])
        x = (Window.width / background.size[0] // aspectRatio) + 2
        print(x)
        background.uvsize = x, -1
        with self.canvas:
            rect = Rectangle(texture=background,
                             size=[(background.size[0] * aspectRatio * x),
                                   size[1]])

        boxlayout = BoxLayout(orientation='vertical', size=size)
        boxlayout.add_widget(Label(text='tap to start', font_size=font_size))
        boxlayout.add_widget(Label(text='debug mode', font_size=font_size))
        self.add_widget(boxlayout)
Exemple #3
0
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  8 12:35:57 2016

@author: gray
"""

from kivy.uix.image import Image
from element import Element
from utils import DotDict

from lights import LightPatch
from tiles import WallTile, ExitTile, EntranceTile
from sprites import ChestSprite, MonsterSprite, PlayerSprite

Lights = DotDict({'lightpatch': LightPatch})
Tiles = DotDict({'wall': WallTile, 'exit': ExitTile, 'entrance': EntranceTile})
Sprites = DotDict({
    'chest': ChestSprite,
    'monster': MonsterSprite,
    'player': PlayerSprite
})

#BACKGROUND_TEXTURE = CoreImage('graphics/floor.png').texture
BACKGROUND_TEXTURE = Image(source='graphics/floor.png').texture
BACKGROUND_TEXTURE.wrap = 'repeat'
Exemple #4
0
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  8 12:35:57 2016

@author: gray
"""

from kivy.uix.image import Image
from element import Element
from utils import DotDict
                             

from lights import LightPatch
from tiles import WallTile, ExitTile, EntranceTile
from sprites import ChestSprite, MonsterSprite, PlayerSprite

Lights = DotDict({'lightpatch': LightPatch})
Tiles = DotDict({'wall': WallTile,
                 'exit': ExitTile,
                 'entrance': EntranceTile})
Sprites = DotDict({'chest': ChestSprite,
                   'monster': MonsterSprite,
                   'player': PlayerSprite})

#BACKGROUND_TEXTURE = CoreImage('graphics/floor.png').texture
BACKGROUND_TEXTURE = Image(source = 'graphics/floor.png').texture
BACKGROUND_TEXTURE.wrap = 'repeat'