def showWindow(self): try: jngl.showWindow("Somyeol2D {0}".format(self.version), jngl.getDesktopWidth(), jngl.getDesktopHeight(), True) self.windowWidth = jngl.getDesktopWidth() self.windowHeight = jngl.getDesktopHeight() self.cameray = -self.windowHeight # except RuntimeError: # Fullscreen mode not supported? except: jngl.showWindow("Somyeol2D {0}".format(self.version), self.windowWidth, self.windowHeight) # jngl.showWindow("Somyeol2D - LevelEditor {0}".format(self.version), self.windowWidth, self.windowHeight,False) jngl.setBackgroundColor(255, 255, 255) jngl.setAntiAliasing(True) jngl.cancelQuit()
def __init__(self): self.version = "1.1" self.running = True self.levelNr = 0 self.level = None self.windowWidth = 1024 self.windowHeight = 768 self.camerax = 0 self.cameray = -self.windowHeight self.scale = 0.5 self.finish = False self.finish_highscore = False self.highscore = None self.levelpack = "ggj/" self.enable_credits = True self.testmode = False self.highscore = HighScore.HighScore() self.minX = None self.minY = None self.maxX = None self.maxY = None self.bounds = GameObject.Collidable() self.levelpack_finished = False try: if (jngl.getDesktopWidth() < 1024) or (jngl.getDesktopHeight() < 600): import tkMessageBox tkMessageBox.showwarning("Resolution too small!","Your desktop-resolution is smaller than 1024x600. Please be aware that this can lead to graphical bugs") jngl.showWindow("Somyeol2D {0}".format(self.version), jngl.getDesktopWidth(), jngl.getDesktopHeight(), True) self.windowWidth = jngl.getDesktopWidth() self.windowHeight = jngl.getDesktopHeight() self.cameray = -self.windowHeight #except RuntimeError: # Fullscreen mode not supported? except: jngl.showWindow("Somyeol2D {0}".format(self.version), self.windowWidth, self.windowHeight) ## self.windowWidth = 1024 ## self.windowHeight = 600 ## jngl.showWindow("Somyeol2D {0}".format(self.version), self.windowWidth, self.windowHeight) #jngl.setBackgroundColor(255, 255, 255) jngl.setBackgroundColor(144, 187, 227) jngl.setAntiAliasing(True) jngl.setFont("data/Japestyle Plain.ttf") jngl.setFontSize(20) self.sound = Sound.Sound(self)
continue jngl.load("sound/" + f) jngl.print(text, 30, 30) text += "." jngl.swapBuffers() jngl.translate(-jngl.getScreenWidth()/2, -jngl.getScreenHeight()/2) #load only subdirectorys levels = [] for f in os.listdir("data/maps/"): pass if os.path.isdir("data/maps/" + f): levels.append(f) level = 0 start = True jngl.setBackgroundColor(0,0,0) running = True levelselect = False while running:#not jngl.keyPressed(jngl.key.Escape): jngl.swapBuffers() jngl.updateInput() jngl.translate(-jngl.getScreenWidth()/2, -jngl.getScreenHeight()/2) while (not jngl.keyPressed(jngl.key.Return) or jngl.keyPressed(jngl.key.Escape)) and not levelselect: jngl.draw("img/World/splash.png", (game.windowWidth/2)-jngl.getWidth("img/World/splash.png")/2, (game.windowHeight/2)-jngl.getHeight("img/World/splash.png")/2) if jngl.keyPressed(jngl.key.Right): level += 1 if level >= len(levels): level = 0 elif jngl.keyPressed(jngl.key.Left): level -= 1 if level < 0: level = len(levels)-1