Revision: ed0a4f9db3
Author: Hugo Ruscitti <hugoru...@gmail.com>
Date: Sun Jun 13 12:56:46 2010
Log: Creando modulo partial image para que no haga conflicto con la
version...
http://code.google.com/p/sbfury/source/detail?r=ed0a4f9db3
Revision: 4383438ac8
Author: Hugo Ruscitti <hugoru...@gmail.com>
Date: Sun Jun 13 12:57:15 2010
Log: creando script para generar archivos .exe
http://code.google.com/p/sbfury/source/detail?r=4383438ac8
==============================================================================
Revision: ed0a4f9db3
Author: Hugo Ruscitti <hugoru...@gmail.com>
Date: Sun Jun 13 12:56:46 2010
Log: Creando modulo partial image para que no haga conflicto con la version
generado con py2exe.
http://code.google.com/p/sbfury/source/detail?r=ed0a4f9db3
Added:
/sbfury/partial_image.py
Modified:
/sbfury/stage.py
=======================================
--- /dev/null
+++ /sbfury/partial_image.py Sun Jun 13 12:56:46 2010
@@ -0,0 +1,76 @@
+# -*- encoding: utf-8 -*-
+# Shaolin's Blind Fury
+#
+# Copyright 2008 - Hugo Ruscitti
+# License: GPLv3 (see http://www.gnu.org/licenses/gpl.html)
+
+import os
+import pyglet
+
+import common
+
+class PartialImage:
+
+ def __init__(self, directory):
+ dirname = os.path.abspath(os.path.dirname(__file__))
+ directory = os.path.join(dirname, '..', 'data', directory)
+ names_list = [f for f in os.listdir(directory) if 'png' in f]
+ names_list.sort()
+ self.images = [common.load_image(directory + '/' + name)
+ for name in names_list]
+ self.width = self.images[0].width
+ self.height = self.images[0].height
+
+ def blit(self, (x, y), (dst_x, dst_y), width):
+ """Blit this image into video surface.
+
+ :Parameters:
+ `(x, y)`: tuple of int
+ top left corner of this image (reference point to read).
+ `(dst_x, dst_y)`: tuple of int
+ destination point
+ `width`: int
+ amuont of horizontal pixels to read.
+ """
+
+ while width > 0:
+ index = x / self.width
+ # Transform to infinite (ciclical) image.
+ index = int(index) % len(self.images)
+ delta_x = x % self.width
+
+ try:
+ self.images[index].blit(dst_x - delta_x, dst_y)
+ except IndexError:
+ pass
+
+ width -= self.width
+ dst_x += self.width
+ x += self.width
+
+
+if __name__ == '__main__':
+ from pyglet.gl import *
+ import cocos
+
+ common.director.init(resizable=True)
+ ima = PartialImage('stages/1/layer_3')
+
+
+ class Layer(cocos.layer.Layer):
+
+ def __init__(self, ima):
+ cocos.layer.Layer.__init__(self)
+ self.position = 0, 0
+ self.image = ima
+
+ def draw(self):
+ #x, y = self.position
+ glPushMatrix()
+ self.transform()
+ self.image.blit((12, 0), (0, 0), 500)
+ glPopMatrix()
+
+
+ scene = cocos.scene.Scene(Layer(ima))
+ common.director.run(scene)
=======================================
--- /sbfury/stage.py Sun Jun 6 16:14:06 2010
+++ /sbfury/stage.py Sun Jun 13 12:56:46 2010
@@ -5,7 +5,7 @@
# License: GPLv3 (see http://www.gnu.org/licenses/gpl.html)
import cocos
-import image
+import partial_image
from cocos.actions import *
import layer
@@ -73,21 +73,21 @@
def _create_layers(self, number):
prefix = 'stages/%d/layer_' %(number)
- ima = image.PartialImage(prefix + '3')
+ ima = partial_image.PartialImage(prefix + '3')
self.layer_3 = layer.PartialImageLayer(ima, top=True)
- ima = image.PartialImage(prefix + '2')
+ ima = partial_image.PartialImage(prefix + '2')
self.layer_2 = layer.PartialImageLayer(ima, top=True)
- ima = image.PartialImage(prefix + '1')
+ ima = partial_image.PartialImage(prefix + '1')
self.layer_1 = layer.PartialImageLayer(ima, top=True)
if config.PERSPECTIVE_FLOOR:
- ima = image.PartialImage(prefix + '0')
+ ima = partial_image.PartialImage(prefix + '0')
self.layer_0 = layer.PartialImageLayer3D(ima, -0, -13)
try:
- ima = image.PartialImage(prefix + '5')
+ ima = partial_image.PartialImage(prefix + '5')
self.extra_layer_1 = layer.PartialImageLayer3D(ima, -0,
-40)
#ima = image.PartialImage(prefix + '5')
@@ -108,7 +108,7 @@
pass
else:
- ima = image.PartialImage(prefix + '0')
+ ima = partial_image.PartialImage(prefix + '0')
self.layer_0 = layer.PartialImageLayer(ima, -0, -42)
self.main_layer = layer.OrderlyLayer()
@@ -123,7 +123,7 @@
self.add(self.main_layer)
if config.SHOW_FRONT_LAYER:
- ima = image.PartialImage(prefix + '4')
+ ima = partial_image.PartialImage(prefix + '4')
self.layer_4 = layer.PartialImageLayer(ima, top=False)
self.add(self.layer_4, z=1)
==============================================================================
Revision: 4383438ac8
Author: Hugo Ruscitti <hugoru...@gmail.com>
Date: Sun Jun 13 12:57:15 2010
Log: creando script para generar archivos .exe
http://code.google.com/p/sbfury/source/detail?r=4383438ac8
Added:
/sbfury/setup.py
=======================================
--- /dev/null
+++ /sbfury/setup.py Sun Jun 13 12:57:15 2010
@@ -0,0 +1,7 @@
+from distutils.core import setup
+import py2exe
+import sys
+
+sys.argv.append("py2exe")
+
+setup(console=['main.py'])