Exemple #1
0
    def __init__(self, w, h, fullscreen, title="Unseen"):
        Renderer3DBase.__init__(self, w, h, fullscreen)
        PyUnseen.initialize(w, h, gotEvent, messageMap, title)
        self.font1 = PyUnseen.createFont("Arial", 9, 0)
        self.fixedFont = PyUnseen.createFont("Courier", 7, 0)
        self.populateConstants()

        # store the actual height and width surface created (might be less than requested)
        #(getDesktop().width, getDesktop().height) = PyUnseen.getDesktopSize()

        (w, pyui.locals.TEXT_HEIGHT) = self.getTextSize(" ")
        self.images = {}

        self.cache = {}  # tracks all objects by Handle. useful for debugging
    def __init__(self, w, h, fullscreen, title="Unseen"):
        Renderer3DBase.__init__(self, w, h, fullscreen)
        PyUnseen.initialize(w, h, gotEvent, messageMap, title )
        self.font1 = PyUnseen.createFont( "Arial", 9, 0 )
        self.fixedFont = PyUnseen.createFont( "Courier", 7, 0 )        
        self.populateConstants()

        # store the actual height and width surface created (might be less than requested)
        #(getDesktop().width, getDesktop().height) = PyUnseen.getDesktopSize()
        
        (w, pyui.locals.TEXT_HEIGHT) = self.getTextSize(" ")
        self.images = {}

        self.cache = {} # tracks all objects by Handle. useful for debugging
Exemple #3
0
def init(w, h, renderer="p3d", fullscreen=0, title=""):
    """Initialize pyui. Will set to fullscreen if specified. default is to run in a window.
    This will return a Desktop Object.
    (public)
    """
    global gDesktop, gRenderer
    if renderer == "null":
        from rendererBase import RendererBase
        gRenderer = RendererBase(w, h, fullscreen, title)

    elif renderer == "null3d":
        from pyui.renderer3d import Renderer3DBase
        gRenderer = Renderer3DBase(w, h, fullscreen, title)

    elif renderer == "2d":
        from renderers.pygame2D import Pygame2D
        gRenderer = Pygame2D(w, h, fullscreen, title)

    elif renderer == "gl":
        from renderers.openglGlut import OpenGLGlut
        gRenderer = OpenGLGlut(w, h, fullscreen, title)

    elif renderer == "p3d":
        from renderers.openglPygame import OpenGLPygame
        gRenderer = OpenGLPygame(w, h, fullscreen, title)

    elif renderer == "dx":
        from renderers import unseen
        gRenderer = unseen.Unseen(w, h, fullscreen, title)

    elif renderer == "nebula":
        from renderers import nebula
        gRenderer = nebula.RendererNeb(w, h, fullscreen)

    elif renderer == "gdi":
        from renderers import rendererGDI
        rendererGDI.initialize(w, h)
        gRenderer = rendererGDI
    else:
        raise "Unsupported renderer type", renderer

    (w, h) = gRenderer.getScreenSize()
    # create the theme and desktop
    ##from themes import comic
    ##theTheme = comic.ComicTheme(gRenderer)
    ##from themes import green
    ##theTheme = green.GreenTheme(gRenderer)
    ##from themes import win2k
    ##theTheme = win2k.Win2kTheme(gRenderer)
    ##from themes import future
    ##theTheme = future.FutureTheme(gRenderer)
    from themes import anw
    ##theTheme = anw.ANWTheme(gRenderer)
    theTheme = anw.ANWTheme3(gRenderer)

    gDesktop = Desktop(gRenderer, w, h, fullscreen, theTheme)
    colors.init(gRenderer)
    return gDesktop
Exemple #4
0
    def __init__(self, w, h, fullscreen, title):
        Renderer3DBase.__init__(self, w, h, fullscreen, title)
        self.frame = 0
        self.last = time.time()
        self.width = w
        self.height = h
        self.fontId = 50000
        self.fonts = {}
        self.textures = {}
        
        pyui.locals.K_SHIFT     = 304
        pyui.locals.K_CONTROL   = 306
        pyui.locals.K_ALT       = 308

        pyui.locals.K_PAGEUP    = 280
        pyui.locals.K_PAGEDOWN  = 281
        pyui.locals.K_END       = 279
        pyui.locals.K_HOME      = 278

        pyui.locals.K_LEFT      = 276
        pyui.locals.K_UP        = 273
        pyui.locals.K_RIGHT     = 275
        pyui.locals.K_DOWN      = 274        

        pyui.locals.K_INSERT    = 277
        pyui.locals.K_DELETE    = 127

        pyui.locals.K_PAD0      = 256
        pyui.locals.K_PAD1      = 257
        pyui.locals.K_PAD2      = 258
        pyui.locals.K_PAD3      = 259
        pyui.locals.K_PAD4      = 260
        pyui.locals.K_PAD5      = 261
        pyui.locals.K_PAD6      = 262
        pyui.locals.K_PAD7      = 263
        pyui.locals.K_PAD8      = 264
        pyui.locals.K_PAD9      = 265

        pyui.locals.K_PADDIVIDE = 267
        pyui.locals.K_PADTIMES  = 268
        pyui.locals.K_PADMINUS  = 269
        pyui.locals.K_PADPLUS   = 270
        pyui.locals.K_PADENTER  = 271
        pyui.locals.K_PADDECIMAL= 266

        pyui.locals.K_F1        = 282
        pyui.locals.K_F2        = 283
        pyui.locals.K_F3        = 284
        pyui.locals.K_F4        = 285
        pyui.locals.K_F5        = 286
        pyui.locals.K_F6        = 287
        pyui.locals.K_F7        = 288
        pyui.locals.K_F8        = 289
        pyui.locals.K_F9        = 290
        pyui.locals.K_F10       = 291
        pyui.locals.K_F11       = 292
        pyui.locals.K_F12       = 293

        self.keyMap = {
            100: pyui.locals.K_LEFT,
            101: pyui.locals.K_UP,
            102: pyui.locals.K_RIGHT,
            103: pyui.locals.K_DOWN
            }

        if not USE_TRUETYPE_FONTS or sys.platform != "win32":
            print "Using GLUT fonts"
            self.createFont = self.createFont_OLD
            self.getTextSize = self.getTextSize_OLD
        else:
            print "Using True-Type fonts"

        self.drawBackMethod = self.clear
Exemple #5
0
    def __init__(self, w, h, fullscreen, title):
        sylphis.CPyInputListener.__init__(self)
        self.self = self
        Renderer3DBase.__init__(self, w, h, fullscreen, title)
        self.frame = 0
        self.last = 0 #time.time()
        self.width = w
        self.height = h
        self.fontId = 50000
        self.fonts = {}
        self.textures = {}
        self.mouseX = 0
        self.mouseY = 0
        self.active = 0

        global input
        input = CEngine.getInput()
        
        global rend
        rend = CEngine.renderer
        
        global efonts
        efonts = CEngine.fonts

        global materials
        materials = CEngine.mMaterials

        self.pointer = materials.registerMaterial("gui/pointer")
        
        input.addListener(self)
        
        pyui.locals.K_RETURN    = sylphis.kENTER
        pyui.locals.K_SHIFT     = sylphis.kLEFTSHIFT
        #pyui.locals.K_CONTROL   = 306
        #pyui.locals.K_ALT       = 308

        #pyui.locals.K_PAGEUP    = 280
        #pyui.locals.K_PAGEDOWN  = 281
        #pyui.locals.K_END       = 279
        #pyui.locals.K_HOME      = 278

        pyui.locals.K_LEFT      = sylphis.kLARROW
        pyui.locals.K_UP        = sylphis.kUARROW
        pyui.locals.K_RIGHT     = sylphis.kRARROW
        pyui.locals.K_DOWN      = sylphis.kDARROW

        #pyui.locals.K_INSERT    = 277
        #pyui.locals.K_DELETE    = 127

        pyui.locals.K_PAD0      = 256
        pyui.locals.K_PAD1      = 257
        pyui.locals.K_PAD2      = 258
        pyui.locals.K_PAD3      = 259
        pyui.locals.K_PAD4      = 260
        pyui.locals.K_PAD5      = 261
        pyui.locals.K_PAD6      = 262
        pyui.locals.K_PAD7      = 263
        pyui.locals.K_PAD8      = 264
        pyui.locals.K_PAD9      = 265

        pyui.locals.K_PADDIVIDE = 267
        pyui.locals.K_PADTIMES  = 268
        pyui.locals.K_PADMINUS  = 269
        pyui.locals.K_PADPLUS   = 270
        pyui.locals.K_PADENTER  = 271
        pyui.locals.K_PADDECIMAL= 266

        pyui.locals.K_F1        = 282
        pyui.locals.K_F2        = 283
        pyui.locals.K_F3        = 284
        pyui.locals.K_F4        = 285
        pyui.locals.K_F5        = 286
        pyui.locals.K_F6        = 287
        pyui.locals.K_F7        = 288
        pyui.locals.K_F8        = 289
        pyui.locals.K_F9        = 290
        pyui.locals.K_F10       = 291
        pyui.locals.K_F11       = 292
        pyui.locals.K_F12       = 293

        #self.keyMap = {
        #    100: pyui.locals.K_LEFT,
        #    101: pyui.locals.K_UP,
        #    102: pyui.locals.K_RIGHT,
        #    103: pyui.locals.K_DOWN
        #    }

        self.drawBackMethod = self.clear
Exemple #6
0
    def __init__(self, w, h, fullscreen, title):
        sylphis.CPyInputListener.__init__(self)
        self.self = self
        Renderer3DBase.__init__(self, w, h, fullscreen, title)
        self.frame = 0
        self.last = 0  #time.time()
        self.width = w
        self.height = h
        self.fontId = 50000
        self.fonts = {}
        self.textures = {}
        self.mouseX = 0
        self.mouseY = 0
        self.active = 0

        global input
        input = CEngine.getInput()

        global rend
        rend = CEngine.renderer

        global efonts
        efonts = CEngine.fonts

        global materials
        materials = CEngine.mMaterials

        self.pointer = materials.registerMaterial("gui/pointer")

        input.addListener(self)

        pyui.locals.K_RETURN = sylphis.kENTER
        pyui.locals.K_SHIFT = sylphis.kLEFTSHIFT
        #pyui.locals.K_CONTROL   = 306
        #pyui.locals.K_ALT       = 308

        #pyui.locals.K_PAGEUP    = 280
        #pyui.locals.K_PAGEDOWN  = 281
        #pyui.locals.K_END       = 279
        #pyui.locals.K_HOME      = 278

        pyui.locals.K_LEFT = sylphis.kLARROW
        pyui.locals.K_UP = sylphis.kUARROW
        pyui.locals.K_RIGHT = sylphis.kRARROW
        pyui.locals.K_DOWN = sylphis.kDARROW

        #pyui.locals.K_INSERT    = 277
        #pyui.locals.K_DELETE    = 127

        pyui.locals.K_PAD0 = 256
        pyui.locals.K_PAD1 = 257
        pyui.locals.K_PAD2 = 258
        pyui.locals.K_PAD3 = 259
        pyui.locals.K_PAD4 = 260
        pyui.locals.K_PAD5 = 261
        pyui.locals.K_PAD6 = 262
        pyui.locals.K_PAD7 = 263
        pyui.locals.K_PAD8 = 264
        pyui.locals.K_PAD9 = 265

        pyui.locals.K_PADDIVIDE = 267
        pyui.locals.K_PADTIMES = 268
        pyui.locals.K_PADMINUS = 269
        pyui.locals.K_PADPLUS = 270
        pyui.locals.K_PADENTER = 271
        pyui.locals.K_PADDECIMAL = 266

        pyui.locals.K_F1 = 282
        pyui.locals.K_F2 = 283
        pyui.locals.K_F3 = 284
        pyui.locals.K_F4 = 285
        pyui.locals.K_F5 = 286
        pyui.locals.K_F6 = 287
        pyui.locals.K_F7 = 288
        pyui.locals.K_F8 = 289
        pyui.locals.K_F9 = 290
        pyui.locals.K_F10 = 291
        pyui.locals.K_F11 = 292
        pyui.locals.K_F12 = 293

        #self.keyMap = {
        #    100: pyui.locals.K_LEFT,
        #    101: pyui.locals.K_UP,
        #    102: pyui.locals.K_RIGHT,
        #    103: pyui.locals.K_DOWN
        #    }

        self.drawBackMethod = self.clear
Exemple #7
0
    def __init__(self, w, h, fullscreen, title):
        Renderer3DBase.__init__(self, w, h, fullscreen, title)
        self.frame = 0
        self.last = time.time()
        self.width = w
        self.height = h
        self.fontId = 50000
        self.fonts = {}
        self.textures = {}

        pyui.locals.K_SHIFT = 304
        pyui.locals.K_CONTROL = 306
        pyui.locals.K_ALT = 308

        pyui.locals.K_PAGEUP = 280
        pyui.locals.K_PAGEDOWN = 281
        pyui.locals.K_END = 279
        pyui.locals.K_HOME = 278

        pyui.locals.K_LEFT = 276
        pyui.locals.K_UP = 273
        pyui.locals.K_RIGHT = 275
        pyui.locals.K_DOWN = 274

        pyui.locals.K_INSERT = 277
        pyui.locals.K_DELETE = 127

        pyui.locals.K_PAD0 = 256
        pyui.locals.K_PAD1 = 257
        pyui.locals.K_PAD2 = 258
        pyui.locals.K_PAD3 = 259
        pyui.locals.K_PAD4 = 260
        pyui.locals.K_PAD5 = 261
        pyui.locals.K_PAD6 = 262
        pyui.locals.K_PAD7 = 263
        pyui.locals.K_PAD8 = 264
        pyui.locals.K_PAD9 = 265

        pyui.locals.K_PADDIVIDE = 267
        pyui.locals.K_PADTIMES = 268
        pyui.locals.K_PADMINUS = 269
        pyui.locals.K_PADPLUS = 270
        pyui.locals.K_PADENTER = 271
        pyui.locals.K_PADDECIMAL = 266

        pyui.locals.K_F1 = 282
        pyui.locals.K_F2 = 283
        pyui.locals.K_F3 = 284
        pyui.locals.K_F4 = 285
        pyui.locals.K_F5 = 286
        pyui.locals.K_F6 = 287
        pyui.locals.K_F7 = 288
        pyui.locals.K_F8 = 289
        pyui.locals.K_F9 = 290
        pyui.locals.K_F10 = 291
        pyui.locals.K_F11 = 292
        pyui.locals.K_F12 = 293

        self.keyMap = {
            100: pyui.locals.K_LEFT,
            101: pyui.locals.K_UP,
            102: pyui.locals.K_RIGHT,
            103: pyui.locals.K_DOWN
        }

        self.drawBackMethod = self.clear