Ejemplo n.º 1
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with pyspades.  If not, see <http://www.gnu.org/licenses/>.

import sys
sys.path.append('..')

from pyspades.common import *
from pyspades.load import VXLData
from pyspades import world
from twisted.internet import reactor
from twisted.internet.task import LoopingCall

new_world = world.World(VXLData(open('../data/sinc0.vxl')))
nade = new_world.create_object(world.Character, Vertex3(20.0, 20.0, 5.0),
                               Vertex3())


def update():
    dt = 1 / 60.0
    new_world.update(dt)
    for instance in new_world.objects:
        position = instance.position
        print position.x, position.y, position.z


caller = LoopingCall(update)
caller.start(1 / 60.0, now=False)
reactor.run()
Ejemplo n.º 2
0
class TestProtocol(ServerProtocol):
    map = VXLData(open('../data/sinc0.vxl', 'rb'))
    version = crc32(open('../data/client.exe', 'rb').read())
Ejemplo n.º 3
0
# pyspades is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with pyspades.  If not, see <http://www.gnu.org/licenses/>.

import pyglet
from pyglet.window import key
import math

from pyspades.load import VXLData

data = VXLData(open('..\lastsav.vxl', 'rb'))

from pyglet.gl import *

config = Config(sample_buffers=1, samples=4, 
                depth_size=16, double_buffer=True)
window = pyglet.window.Window(resizable=True, config=config)
window.set_exclusive_mouse(True)

rquad = 0.0

glEnable(GL_DEPTH_TEST)
glEnable(GL_CULL_FACE)
glClearColor(0.0, 1.0, 1.0, 1.0)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
Ejemplo n.º 4
0
# pyspades is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with pyspades.  If not, see <http://www.gnu.org/licenses/>.

import pyglet
from pyglet.window import key
import math

from pyspades.load import VXLData

data = VXLData(open('..\lastsav.vxl', 'rb'))

from pyglet.gl import *

config = Config(sample_buffers=1, samples=4, depth_size=16, double_buffer=True)
window = pyglet.window.Window(resizable=True, config=config)
window.set_exclusive_mouse(True)

rquad = 0.0

glEnable(GL_DEPTH_TEST)
glEnable(GL_CULL_FACE)
glClearColor(0.0, 1.0, 1.0, 1.0)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
glEnable(GL_BLEND)
Ejemplo n.º 5
0
# This file is part of pyspades.

# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# pyspades is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with pyspades.  If not, see <http://www.gnu.org/licenses/>.

from pyspades.load import VXLData

map = VXLData(open('../data/sinc0.vxl', 'rb'))
data = map.generate()
new_data = ''
generator = map.get_generator()

while 1:
    value = generator.get_data(660)
    print len(value)
    if not value:
        break
    new_data += value

print data == new_data
Ejemplo n.º 6
0
# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# pyspades is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with pyspades.  If not, see <http://www.gnu.org/licenses/>.

from pyspades.load import VXLData

map = VXLData()

for x in xrange(50, 512 - 50):
    for y in xrange(50, 512 - 50):
        for z in xrange(20, 58):
            map.set_point(x, y, z, (20, 20, 30, 40))

for x in range(512):
    for y in xrange(512):
        map.set_point(x, y, 62, (20, 20, 30, 40))
        map.set_point(x, y, 63, (20, 20, 30, 40))

for z in range(5, 64):
    map.set_point(256, 256, z, (20, 20, 30, 40))

print 'generating'
Ejemplo n.º 7
0
# Copyright (c) Mathias Kaerlev 2011-2012.

# This file is part of pyspades.

# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# pyspades is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with pyspades.  If not, see <http://www.gnu.org/licenses/>.

from pyspades.load import VXLData

map = VXLData(open('../data/sinc0.vxl', 'rb'))
print 'writing...'
open('sinc1.vxl', 'wb').write(map.generate())