Mercurial > touhou
annotate pytouhou/ui/sdl/gamerenderer.py @ 512:b39ad30c6620
Add a pure SDL backend.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 05 Dec 2013 01:55:39 +0100 |
parents | |
children | 577c3a88fb67 |
rev | line source |
---|---|
512
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 ## |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 ## |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 ## |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 ## GNU General Public License for more details. |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 ## |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 from itertools import chain |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 from pytouhou.lib.sdl import Rect |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 from .sprite import get_sprite_rendering_data |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 from pytouhou.utils.helpers import get_logger |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 logger = get_logger(__name__) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
24 class GameRenderer(object): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
25 def __init__(self, resource_loader, window): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
26 self.window = window |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
27 self.texture_manager = TextureManager(resource_loader, self.window.win) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 def load_textures(self, anms): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
31 self.texture_manager.load(anms) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
33 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
34 def load_background(self, background): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 if background is not None: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 logger.error('Background rendering unavailable in the SDL backend.') |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
38 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
39 def start(self, common): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 pass |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
42 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
43 def render(self, game): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 self.render_game(game) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 self.render_text(game.texts + game.native_texts) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 self.render_interface(game.interface, game.boss) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
47 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
48 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 def render_game(self, game): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 x, y = game.interface.game_pos |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
51 self.window.win.render_set_viewport(Rect(x, y, game.width, game.height)) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 self.window.win.render_set_clip_rect(Rect(x, -y, game.width, game.height)) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 if game is not None: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 if game.spellcard_effect is not None: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 self.render_elements([game.spellcard_effect]) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 else: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
58 self.window.win.render_clear() |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 self.render_elements([enemy for enemy in game.enemies if enemy.visible]) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 self.render_elements(game.effects) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 self.render_elements(chain(game.players_bullets, |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
63 game.lasers_sprites(), |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
64 game.players, |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
65 game.msg_sprites())) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
66 self.render_elements(chain(game.bullets, game.lasers, |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
67 game.cancelled_bullets, game.items, |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 game.labels)) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
69 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
70 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
71 def render_interface(self, interface, boss): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
72 interface.labels['framerate'].set_text('%.2ffps' % self.window.clock.get_fps()) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
73 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
74 self.window.win.render_set_viewport(Rect(0, 0, interface.width, interface.height)) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 self.window.win.render_set_clip_rect(Rect(0, 0, interface.width, interface.height)) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 items = [item for item in interface.items if item.anmrunner and item.anmrunner.running] |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 labels = interface.labels.values() |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 if items: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 # Redraw all the interface |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
82 self.render_elements(items) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
83 else: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 # Redraw only changed labels |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
85 labels = [label for label in labels if label.changed] |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
86 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
87 self.render_elements(interface.level_start) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
88 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
89 if boss: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
90 self.render_elements(interface.boss_items) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
91 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
92 self.render_elements(labels) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
93 for label in labels: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
94 label.changed = False |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
95 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
96 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
97 def render_elements(self, elements): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
98 nb_vertices = 0 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
99 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
100 objects = chain(*[element.objects for element in elements]) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
101 for element in objects: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
102 if nb_vertices >= MAX_ELEMENTS - 4: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
103 break |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
104 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
105 sprite = element.sprite |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
106 if sprite and sprite.visible: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
107 ox, oy = element.x, element.y |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
108 blendfunc, (vertices, uvs, colors, rotation, flip) = get_sprite_rendering_data(sprite) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
109 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
110 # Pack data in buffer |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
111 x, y, width, height = vertices |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
112 left, right, bottom, top = uvs |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
113 r, g, b, a = colors #TODO: use it. |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
114 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
115 #XXX |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
116 texture_width = 256 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
117 texture_height = 256 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
118 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
119 source = Rect(left * texture_width, bottom * texture_height, (right - left) * texture_width, (top - bottom) * texture_height) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
120 dest = Rect(ox + x, oy + y, width, height) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
121 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
122 texture = sprite.anm.texture |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
123 texture.set_color_mod(r, g, b) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
124 texture.set_alpha_mod(a) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
125 texture.set_blend_mode(2 if blendfunc else 1) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
126 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
127 if rotation or flip: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
128 self.window.win.render_copy_ex(texture, source, dest, rotation, flip) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
129 else: |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
130 self.window.win.render_copy(texture, source, dest) |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
131 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
132 nb_vertices += 4 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
133 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
134 |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
135 def render_text(self, texts): |
b39ad30c6620
Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
136 pass |