Skip to content

Commit

Permalink
Completed the app
Browse files Browse the repository at this point in the history
  • Loading branch information
Quattro-Bajeena committed Aug 22, 2021
1 parent e86f854 commit 56ee2c6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

STRIPCD1/
output/

.vscode/*
!.vscode/settings.json
Expand Down
2 changes: 1 addition & 1 deletion map_viewer_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def lanch_viewer(fileIndex):
model = load_level(fileIndex)
map_viewer = MapViewer(model)
map_viewer = MapViewer(model, debug=False)
map_viewer.main_loop()

sg.theme('DarkBrown4')
Expand Down
27 changes: 16 additions & 11 deletions xgl.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,8 @@ def saveModel(path : Path, model):

class MapViewer:

def __init__(self, model):
def __init__(self, model, debug = False):
self.debug = debug
self.model = model
self.initialize()

Expand All @@ -966,8 +967,10 @@ def initialize(self):
icon = pygame.image.load(Path(__file__).parent / "Resources" / "xenogears logo.png")

pygame.init()

resolution = {'x':1080, 'y' : 1080}
if self.debug:
resolution = {'x':1080, 'y' : 1080}
else:
resolution = {'x':1792, 'y' : 1008}

screen = pygame.display.set_mode((resolution['x'], resolution['y']), HWSURFACE|DOUBLEBUF|OPENGL)
pygame.display.set_caption("Map Viewer")
Expand Down Expand Up @@ -1005,9 +1008,11 @@ def initialize(self):
self.pos_z = -2000
self.object = OpenGLObject(self.model)


self.normal_speed_min = 5
self.sprint_speed_min = 15

self.normal_speed = 25
self.sprint_speed = 70
self.sprint_speed = 75
self.LOOK_SPEED = 0.2

self.speed = self.normal_speed
Expand Down Expand Up @@ -1112,11 +1117,11 @@ def events(self):
# elif event.key == pygame.K_c:
# saveModel(Path(f"level{fileIndex}.dae"), model)
elif event.type == MOUSEWHEEL:
self.normal_speed += 4 * event.y
self.sprint_speed += 4 * event.y
self.normal_speed += 3 * event.y
self.sprint_speed += 3 * event.y

self.normal_speed = max(0, self.normal_speed)
self.sprint_speed = max(0, self.sprint_speed)
self.normal_speed = max(self.normal_speed_min, self.normal_speed)
self.sprint_speed = max(self.sprint_speed_min, self.sprint_speed)



Expand All @@ -1143,7 +1148,7 @@ def render(self):


def load_level(fileIndex):
print("loading archive...")
print(f"loading archive {fileIndex}...")
diskIndex = 1 # there are disk 1 and disk 2
dirIndex = 11 # 0-based index

Expand Down Expand Up @@ -1184,5 +1189,5 @@ def load_level(fileIndex):

if __name__ == '__main__':
model = load_level(1)
map_viewer = MapViewer(model)
map_viewer = MapViewer(model, debug=True)
map_viewer.main_loop()

0 comments on commit 56ee2c6

Please sign in to comment.