Mercurial > touhou
comparison stageviewer.py @ 15:07fba4e1da65
Refactor
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 05 Aug 2011 21:21:06 +0200 |
parents | 07a7f28c8aaa |
children | 66ce9bb440ac |
comparison
equal
deleted
inserted
replaced
14:07a7f28c8aaa | 15:07fba4e1da65 |
---|---|
9 from itertools import chain | 9 from itertools import chain |
10 | 10 |
11 import pygame | 11 import pygame |
12 | 12 |
13 from pytouhou.formats.pbg3 import PBG3 | 13 from pytouhou.formats.pbg3 import PBG3 |
14 from pytouhou.formats.std import Stage | |
15 from pytouhou.formats.anm0 import Animations | |
14 from pytouhou.game.background import Background | 16 from pytouhou.game.background import Background |
15 from pytouhou.opengl.texture import load_texture | 17 from pytouhou.opengl.texture import load_texture |
16 | 18 |
17 import OpenGL | 19 import OpenGL |
18 OpenGL.FORWARD_COMPATIBLE_ONLY = True | 20 OpenGL.FORWARD_COMPATIBLE_ONLY = True |
34 glEnable(GL_BLEND) | 36 glEnable(GL_BLEND) |
35 glEnable(GL_TEXTURE_2D) | 37 glEnable(GL_TEXTURE_2D) |
36 glEnable(GL_FOG) | 38 glEnable(GL_FOG) |
37 glHint(GL_FOG_HINT, GL_NICEST) | 39 glHint(GL_FOG_HINT, GL_NICEST) |
38 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) | 40 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) |
39 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) | |
40 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) | |
41 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) | 41 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) |
42 glEnableClientState(GL_VERTEX_ARRAY) | 42 glEnableClientState(GL_VERTEX_ARRAY) |
43 glEnableClientState(GL_TEXTURE_COORD_ARRAY) | 43 glEnableClientState(GL_TEXTURE_COORD_ARRAY) |
44 | 44 |
45 # Load data | 45 # Load data |
46 with open(path, 'rb') as file: | 46 with open(path, 'rb') as file: |
47 archive = PBG3.read(file) | 47 archive = PBG3.read(file) |
48 background = Background(archive, stage_num) | 48 stage = Stage.read(BytesIO(archive.extract('stage%d.std' % stage_num)), stage_num) |
49 background_anim = Animations.read(BytesIO(archive.extract('stg%dbg.anm' % stage_num))) | |
50 background = Background(stage, background_anim) | |
49 texture = load_texture(archive, background.anim) | 51 texture = load_texture(archive, background.anim) |
50 | 52 |
51 print(background.stage.name) | 53 print(background.stage.name) |
52 | 54 |
53 frame = 0 | 55 frame = 0 |