General modernizations and porting to Python3

Included some missing files
This commit is contained in:
cecilkorik 2017-05-08 13:10:48 -07:00
parent 5f3e46d7bb
commit a9ac67e6d6
42 changed files with 1637 additions and 897 deletions

View file

@ -1,3 +1,8 @@
syntax: glob
*.pyc
settings.cfg
lib
bin
include
pip-selfcheck.json
__pycache__

View file

@ -1,4 +1,4 @@
import roc
from roc_core import *
import universe
import pipeline
import inputs
@ -10,3 +10,17 @@ import files
import gametimer
import shader
import video
#from .universe import *
#from .pipeline import *
#from .inputs import *
#from .physics import *
#from .models import *
#from .gamedata import *
#from .enums import *
#from .files import *
#from .gametimer import *
#from .shader import *
#from .video import *
#

View file

@ -1,5 +1,5 @@
from gameobj import gameobj
from .gameobj import gameobj
class asset_manager(object):
def __init__(self):

View file

@ -1,4 +1,4 @@
from gameobj import game_object
from .gameobj import game_object
import math
from quat import *
from py3dutil import vect

View file

@ -24,7 +24,7 @@ class configmanager(object):
def save(self):
fd = open(self.filepath, 'w')
for k, v in self.data.items():
for k, v in list(self.data.items()):
fd.write("%s = %s\n" % (k, v))
fd.close()

BIN
data/font/coure10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

102
data/font/coure10.tfd Normal file
View file

@ -0,0 +1,102 @@
fontheader
32,128
9,14
13,8
128,128
charsizes
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13
8,13

BIN
data/font/micross20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

102
data/font/micross20.tfd Normal file
View file

@ -0,0 +1,102 @@
fontheader
32,128
21,25
11,9
256,256
charsizes
5,24
6,24
7,24
13,24
11,24
17,24
13,24
4,24
7,24
7,24
8,24
11,24
6,24
7,24
6,24
6,24
11,24
12,24
12,24
11,24
12,24
11,24
11,24
11,24
11,24
11,24
6,24
6,24
12,24
11,24
12,24
12,24
20,24
15,24
14,24
14,24
15,24
14,24
12,24
15,24
15,24
6,24
10,24
14,24
12,24
17,24
15,24
16,24
14,24
16,24
14,24
13,24
13,24
15,24
14,24
19,24
14,24
14,24
13,24
6,24
6,24
6,24
9,24
11,24
7,24
11,24
11,24
10,24
11,24
11,24
7,24
11,24
11,24
4,24
5,24
10,24
4,24
16,24
11,24
12,24
11,24
11,24
7,24
11,24
7,24
11,24
10,24
15,24
10,24
10,24
11,24
7,24
6,24
8,24
12,24
6,24

BIN
data/font/micross42.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

102
data/font/micross42.tfd Normal file
View file

@ -0,0 +1,102 @@
fontheader
32,128
43,49
11,10
512,512
charsizes
11,48
12,48
15,48
25,48
23,48
38,48
28,48
8,48
15,48
15,48
16,48
24,48
12,48
13,48
12,48
12,48
24,48
24,48
23,48
24,48
24,48
24,48
24,48
23,48
24,48
24,48
12,48
12,48
24,48
24,48
24,48
24,48
42,48
30,48
27,48
30,48
30,48
28,48
26,48
33,48
30,48
12,48
21,48
28,48
23,48
34,48
30,48
33,48
28,48
33,48
30,48
28,48
26,48
30,48
28,48
40,48
28,48
28,48
26,48
12,48
12,48
12,48
20,48
24,48
14,48
24,48
23,48
21,48
23,48
23,48
13,48
23,48
24,48
10,48
12,48
22,48
10,48
36,48
24,48
22,48
23,48
23,48
15,48
21,48
12,48
24,48
21,48
31,48
21,48
21,48
21,48
14,48
11,48
13,48
25,48
12,48

BIN
data/font/monopro6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

102
data/font/monopro6.tfd Normal file
View file

@ -0,0 +1,102 @@
fontheader
32,128
7,11
13,8
128,128
charsizes
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,102 @@
fontheader
32,128
8,12
12,8
128,128
charsizes
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11
7,11

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,102 @@
fontheader
32,128
7,11
13,8
128,128
charsizes
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10
6,10

BIN
data/font/vgafix12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

102
data/font/vgafix12.tfd Normal file
View file

@ -0,0 +1,102 @@
fontheader
32,128
9,16
14,8
128,128
charsizes
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15
8,15

BIN
data/tex/black.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 281 B

BIN
data/tex/dralthi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
data/tex/nm_flat.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 298 B

BIN
data/tex/plasma1.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
data/tex/plasma2.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

BIN
data/tex/test1.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

BIN
data/tex/white.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -114,7 +114,7 @@ class TexFont(object):
symbol for unknown characters (either totally blank or a box.)
"""
if isinstance(char, basestring):
if isinstance(char, str):
char = ord(char)
if char >= self.start and char < self.end:
@ -180,7 +180,7 @@ class TexFont(object):
monospace = True
monoheight = True
for i in xrange(0, (self.end - self.start)):
for i in range(0, (self.end - self.start)):
x, y = nextline(dd)
if x != self.charwidth:
monospace = False

View file

@ -32,13 +32,13 @@ class GameDataNode(object):
return self.dict[name]._value
def __getattr__(self, name):
if name == 'dict':
raise AttributeError, name
raise AttributeError(name)
try:
return self.dict[name]
except KeyError:
if name == '_value':
return None
raise AttributeError, name
raise AttributeError(name)
def __setattr__(self, name, val):
if name == 'dict':
return object.__setattr__(self, name, val)
@ -47,7 +47,7 @@ class GameDataNode(object):
except KeyError:
object.__setattr__(self, name, val)
def add_multi(self, key, value):
if not self.dict.has_key(key):
if key not in self.dict:
self.dict[key] = []
self.dict[key].append(value)
def add_single(self, key, value):
@ -55,7 +55,7 @@ class GameDataNode(object):
def __repr__(self):
return """<GameDataNode "%s">""" % (self.dict['_name'],)
def has_key(self, key):
return self.dict.has_key(key)
return key in self.dict
class XMLGameDataReader(object):
def __init__(self, bin, xml):
@ -81,7 +81,7 @@ class XMLGameDataReader(object):
# csvarrays are always ints...
return [int(x.strip()) for x in value.split(',')]
else:
raise TypeError, type
raise TypeError(type)
def create_datatag_def(self, tag):
d = GameDataTagDef()
@ -114,7 +114,7 @@ class XMLGameDataReader(object):
elif (node.missing or value == None) and df.opt:
value = df.default
elif (node.missing or value == None) and not allow_missing:
raise ValueError, "Missing value for mandatory tag %s" % (bin.get('name'),)
raise ValueError("Missing value for mandatory tag %s" % (bin.get('name'),))
elif (node.missing or value == None):
value = None
else:
@ -128,7 +128,7 @@ class XMLGameDataReader(object):
if value == None and df.opt:
value = df.default
elif not value and not allow_missing:
raise ValueError, "Missing value for mandatory tag %s" % (bin.get('name'),)
raise ValueError("Missing value for mandatory tag %s" % (bin.get('name'),))
elif not value:
value = None
else:
@ -163,9 +163,9 @@ class XMLGameDataReader(object):
xmltagdict = {}
if not isinstance(xml, MissingNode):
for k, v in xml.items():
for k, v in list(xml.items()):
if not k in attrdict:
raise ValueError, "Key %s not a valid attribute: %s" % (k, attrdict.keys())
raise ValueError("Key %s not a valid attribute: %s" % (k, list(attrdict.keys())))
continue
binchild = attrdict[k]
xmlchild = xml
@ -191,7 +191,7 @@ class XMLGameDataReader(object):
missing = MissingNode()
for k in tagdict.keys():
for k in list(tagdict.keys()):
if not k in xmltagdict:
# Missing datatag
subnode = self.construct_recurse(tagdict[k], missing, isinstance(xml, MissingNode))
@ -200,7 +200,7 @@ class XMLGameDataReader(object):
else:
node.add_single(k, [])
for k in attrdict.keys():
for k in list(attrdict.keys()):
if not k in xmlattrdict:
# Missing attribute
subnode = self.construct_node(attrdict[k], missing, isinstance(xml, MissingNode))
@ -221,7 +221,7 @@ class XMLGameDataReader(object):
def __getattr__(self, name):
if name == 'tree':
raise AttributeError, name
raise AttributeError(name)
return self._tree.__getattr__(name)
def __getitem__(self, name):
return self._tree.__getitem__(name)

View file

@ -65,7 +65,7 @@ def num_frames(delay, offset=0):
return int((g_timer - offset) / delay) - int((g_timer - g_elapsed - offset) / delay)
def loop_frames(delay, offset=0):
return xrange(num_frames(delay, offset))
return range(num_frames(delay, offset))
def get_timer():
return g_timer
@ -81,7 +81,7 @@ def average(d):
# pass
v2 = float(d[0])
for i in xrange(1, len(d)):
for i in range(1, len(d)):
v1 = float(d[i])
v2 = (smooth * v2) + ((1.0 - smooth) * v1)

View file

@ -221,6 +221,6 @@ def main():
glutMainLoop()
# Print message to console, and kick off the main to get it rolling.
print "Hit ESC key to quit."
print("Hit ESC key to quit.")
main()

View file

@ -51,7 +51,7 @@ class Model_Manager(object):
self.textypes[enums.tt.specular] = TextureType(GL_TEXTURE2, GL_TEXTURE_2D)
self.textypes[enums.tt.normal] = TextureType(GL_TEXTURE3, GL_TEXTURE_2D)
for tt in self.textypes.values():
for tt in list(self.textypes.values()):
tt.initialize()
@ -119,7 +119,7 @@ class Model_Manager(object):
fontname = os.path.splitext(os.path.split(fontfile)[1])[0]
fontobj = fonts.TexFont.new(fontdir, fontname)
self.fontlib[fontname] = fontobj
print "Loaded font %s" % (fontname,)
print("Loaded font %s" % (fontname,))
def get_font(self, name):
return self.fontlib[name]
@ -214,7 +214,7 @@ class TextureFile(object):
self.filename = filename
img = files.mgr.png(filename)
texid = glGenTextures(1)
print "Generated texture id %s from %s" % (texid, self.filename)
print("Generated texture id %s from %s" % (texid, self.filename))
self.id = texid

View file

@ -67,7 +67,7 @@ class physics_manager(object):
if not other.massless:
moved2 = obj.collide(other)
print "Collision!"
print("Collision!")
assert False
return moved1 or moved2
@ -78,7 +78,7 @@ class physics_manager(object):
positions_adjusted = False
iter += 1
pairmap = {}
for key, cell in self.cells.items():
for key, cell in list(self.cells.items()):
for obj in cell:
self._postcollide_single(obj, key, pairmap)

View file

@ -3,7 +3,7 @@ if sys.platform == 'win32':
from platform_win32 import *
elif sys.platform == 'darwin':
from platform_darwin import *
elif sys.platform == 'posix':
elif sys.platform in ('posix', 'linux'):
from platform_posix import *
else:
raise NotImplementedError("Not ported to this platform")

View file

@ -7,7 +7,7 @@ def enable_vsync():
v = ctypes.c_int(1)
ogl.CGLSetParameter(ogl.CGLGetCurrentContext(), ctypes.c_int(222), ctypes.pointer(v))
except:
print "Unable to set vsync mode, using driver defaults"
print("Unable to set vsync mode, using driver defaults")
def get_window_handle():
return None

View file

@ -19,7 +19,7 @@ try:
from PIL import PngImagePlugin
except:
import PngImagePlugin
from gameobj import *
from .gameobj import *
from player import *
from particles import *
from ai import *

View file

View file

@ -1,12 +1,16 @@
#import roc
import os
import sys
sys.path.append(os.path.abspath('..'))
import roc
import pygame
from OpenGL.GL import *
from py3dutil import vect, quat
import models
import fonts
import gametimer
from platform import *
import pipeline
from roc import models
from roc import fonts
from roc import gametimer
from roc.platform import *
from roc import pipeline
import time
import collections
import random
@ -24,8 +28,8 @@ class partycle(object):
@classmethod
def random(cls):
x, y = [((random.random() * 2.0) - 1.0) * 10.0 for _ in xrange(2)]
xd, yd = [((random.random() * 2.0) - 1.0) * 4.0 for _ in xrange(2)]
x, y = [((random.random() * 2.0) - 1.0) * 10.0 for _ in range(2)]
xd, yd = [((random.random() * 2.0) - 1.0) * 4.0 for _ in range(2)]
hue = random.random()
m1 = 1.0
h1 = hue * 6.0
@ -56,7 +60,7 @@ class partycle(object):
self.yd *= 0.985
self.rot += self.rotd
class test_universe(roc.base_universe):
class test_universe(roc.universe.base_universe):
def __init__(self):
self.font = models.mgr.fontlib["micross20"]
self.text1 = models.TextModel("micross20", "#$% 0123 ,,,, Hello world!\xa8\xa8\xa8F", (1.0, 1.0, 0.5, 1.0))
@ -112,7 +116,7 @@ class test_universe(roc.base_universe):
self.text1.render()
glPopMatrix()
for x in xrange(gametimer.num_frames(10)):
for x in range(gametimer.num_frames(10)):
self.move = self.move + self.moveinc
if self.move > 300.0:
self.moveinc = -1.0
@ -139,7 +143,7 @@ class test_universe(roc.base_universe):
for x in xrange(gametimer.num_frames(1000)):
self.string = self.string + str(len(self.string) % 10)
"""
for x in xrange(gametimer.num_frames(100)):
for x in range(gametimer.num_frames(100)):
self.string = str(round(gametimer.get_fps(), 1))
#print len(gametimer.g_framelist)
@ -148,20 +152,21 @@ class test_universe(roc.base_universe):
glPopMatrix()
# texture test
mdl2 = models.mgr.create("m_dralthi")
mdl2 = models.mgr.create("m_particle")
mdl2.layers[0].color = None
#print mdl2.layers[0].mesh
for party in self.particles:
glPushMatrix()
glTranslate(600.0 + party.x, 350.0 + party.y, 6.0)
glRotate(party.rot, 0.0, 0.0, 1.0)
#glColor4f(*party.color)
glColor4f(*party.color)
mdl2.render()
glPopMatrix()
roc.video.width = 1024
roc.video.height = 768
roc.init2d()
roc.set_universe(test_universe())
roc.main()

View file

@ -122,17 +122,17 @@ class shader_manager(object):
try:
shaderinit()
except:
print "Shader type %s failed to initialize" % (shadername,)
print("Shader type %s failed to initialize" % (shadername,))
continue
try:
self.select("ffp")
except:
print "Shader type %s failed to access the fixed function pipeline" % (shadername,)
print("Shader type %s failed to access the fixed function pipeline" % (shadername,))
continue
try:
self.select("standard")
except:
print "Shader type %s failed to load the \"standard\" vertex and fragment shaders" % (shadername,)
print("Shader type %s failed to load the \"standard\" vertex and fragment shaders" % (shadername,))
continue
workable_shaders.append(shadername)
@ -143,7 +143,7 @@ class shader_manager(object):
shadertypes = self.detect()
if not shadertypes:
raise ValueError, "No working shaders detected"
raise ValueError("No working shaders detected")
self.init_shadertype(shadertypes[0])
@ -171,28 +171,28 @@ class shader_manager(object):
except GLError:
p = self.shaderlib[shader]
v, f = self.shaderprograms[shader]
print "Shader failed to execute: %s" % (shader,)
print "Vertex shader log:"
print("Shader failed to execute: %s" % (shader,))
print("Vertex shader log:")
lenarr = GLintArray.zeros(1)
glGetShaderiv(v, GL_INFO_LOG_LENGTH, lenarr)
infoarr = GLcharArray.zeros(lenarr[0])
outsize = GLsizeiArray.zeros(1)
glGetShaderInfoLog(v, lenarr[0], outsize, infoarr)
print ''.join([chr(x) for x in infoarr[:outsize[0]]])
print "Fragment shader log:"
print(''.join([chr(x) for x in infoarr[:outsize[0]]]))
print("Fragment shader log:")
lenarr = GLintArray.zeros(1)
glGetShaderiv(f, GL_INFO_LOG_LENGTH, lenarr)
infoarr = GLcharArray.zeros(lenarr[0])
outsize = GLsizeiArray.zeros(1)
glGetShaderInfoLog(f, lenarr[0], outsize, infoarr)
print ''.join([chr(x) for x in infoarr[:outsize[0]]])
print "Program info log:"
print(''.join([chr(x) for x in infoarr[:outsize[0]]]))
print("Program info log:")
lenarr = GLintArray.zeros(1)
glGetProgramiv(p, GL_INFO_LOG_LENGTH, lenarr)
infoarr = GLcharArray.zeros(lenarr[0])
outsize = GLsizeiArray.zeros(1)
glGetProgramInfoLog(p, lenarr[0], outsize, infoarr)
print ''.join([chr(x) for x in infoarr[:outsize[0]]])
print(''.join([chr(x) for x in infoarr[:outsize[0]]]))
glDeleteShader(v)
glDeleteShader(f)
glDeleteProgram(p)
@ -215,5 +215,6 @@ class shader_manager(object):
def init():
global mgr
mgr = shader_manager()
print("initiated shader mgr: %s" % (mgr,))
mgr = None

View file

@ -20,9 +20,9 @@ else:
ffile = fmod.match_font(fontname)
if not ffile:
print "Unable to find font... here is a list of fonts:\n"
print("Unable to find font... here is a list of fonts:\n")
for x in sorted(fmod.get_fonts()):
print x
print(x)
sys.exit(0)
fontsize = int(fontsize)
@ -36,7 +36,7 @@ images = []
imsizes = []
maxwidth = 0
maxheight = 0
for char in xrange(start, end):
for char in range(start, end):
letter = chr(char)
sz = f.size(letter)
maxwidth = max(maxwidth, sz[0])
@ -45,30 +45,30 @@ for char in xrange(start, end):
images.append(im)
imsizes.append(sz)
print len(images)
print(len(images))
maxwidth += 1
maxheight += 1
ratio = float(maxwidth) / float(maxheight)
print "Ratio %s" % (ratio,)
print("Ratio %s" % (ratio,))
reqwidth = maxwidth * len(images)
ratioheight = int(math.ceil(math.sqrt(len(images) * ratio)))
ratiowidth = int(math.ceil(len(images) / math.sqrt(len(images) * ratio)))
print [ratioheight, ratiowidth]
print([ratioheight, ratiowidth])
reqwidth = maxwidth * ratiowidth
reqheight = maxheight * ratioheight
print [reqheight, reqwidth]
print([reqheight, reqwidth])
texsize = 16
while texsize < reqheight or texsize < reqwidth:
texsize *= 2
print texsize
print(texsize)
tex = pygame.Surface((texsize, texsize), pygame.SRCALPHA, 32)
tex.fill((0, 0, 0, 0))

View file

@ -18,7 +18,8 @@ def enable_vsync():
def skipping_next_frame():
return False
def set_res((width_in, height_in)):
def set_res(xxx_todo_changeme):
(width_in, height_in) = xxx_todo_changeme
global height, width, hwnd
load_window_pos()