def __init__(self): self.version = "1.1" self.camerax = 0 self.cameray = 0 self.level = Map.Map() self.gridEnabled = True self.add10 = False self.scale = 1 self.windowWidth = 1024 self.windowHeight = 600 self.zoom = False try: if jngl.getDesktopWidth() < 1024 or jngl.getDesktopHeight() < 768: import tkMessageBox tkMessageBox.showwarning( "Resolution too small!", "Your desktop-resolution is smaller than 1024x768. Please be aware that this can lead to graphical bugs", ) self.windowWidth = jngl.getDesktopWidth() self.windowHeight = jngl.getDesktopHeight() except: pass self.showWindow() self.placeable = [] self.placeable_count = 0 self.quickselect = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", jngl.key.F1, jngl.key.F2, jngl.key.F3, jngl.key.F4, jngl.key.F5, jngl.key.F6, jngl.key.F7, jngl.key.F8, jngl.key.F9, jngl.key.F10, jngl.key.F11, jngl.key.F12, ] # Generate the list if placeables for name, obj in inspect.getmembers(Somyeol, inspect.isclass): if name != "GameObject": self.placeable.append(obj) for name, obj in inspect.getmembers(GameObjects, inspect.isclass): if name != "GameObject": self.placeable.append(obj)
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)
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()