diff --git a/.hgignore b/.hgignore index 3d5fd1f..3abbd1b 100644 --- a/.hgignore +++ b/.hgignore @@ -6,3 +6,4 @@ bin include pip-selfcheck.json __pycache__ +*.orig diff --git a/README b/README new file mode 100644 index 0000000..5c7f812 --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +roc is Cecil's game engine. It's not fancy, but it provides a solid foundation +for many of my games. It handles most of the boring grunt work like OpenGL, +shaders, fonts, UI, 3d models, and other nonsense. + +I'm sure "roc" had a very clever meaning when I first came up with it, but +I've long since forgotten what it was. I assume it had something to do with +the mythical bird of prey, but with the way my mind works, who knows? diff --git a/data/font/coure10.png b/data/font/coure10.png deleted file mode 100644 index 45440c9..0000000 Binary files a/data/font/coure10.png and /dev/null differ diff --git a/data/font/coure10.tfd b/data/font/coure10.tfd deleted file mode 100644 index e14fb48..0000000 --- a/data/font/coure10.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/font/micross20.png b/data/font/micross20.png deleted file mode 100644 index fac17ec..0000000 Binary files a/data/font/micross20.png and /dev/null differ diff --git a/data/font/micross20.tfd b/data/font/micross20.tfd deleted file mode 100644 index 2d133bf..0000000 --- a/data/font/micross20.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/font/micross42.png b/data/font/micross42.png deleted file mode 100644 index c4169e9..0000000 Binary files a/data/font/micross42.png and /dev/null differ diff --git a/data/font/micross42.tfd b/data/font/micross42.tfd deleted file mode 100644 index f12cb08..0000000 --- a/data/font/micross42.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/font/monopro6.png b/data/font/monopro6.png deleted file mode 100644 index 64be624..0000000 Binary files a/data/font/monopro6.png and /dev/null differ diff --git a/data/font/monopro6.tfd b/data/font/monopro6.tfd deleted file mode 100644 index 5e7e64a..0000000 --- a/data/font/monopro6.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/font/proggysquaresz12.png b/data/font/proggysquaresz12.png deleted file mode 100644 index 50c2d01..0000000 Binary files a/data/font/proggysquaresz12.png and /dev/null differ diff --git a/data/font/proggysquaresz12.tfd b/data/font/proggysquaresz12.tfd deleted file mode 100644 index 76db60f..0000000 --- a/data/font/proggysquaresz12.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/font/proggytinysz12.png b/data/font/proggytinysz12.png deleted file mode 100644 index d62117e..0000000 Binary files a/data/font/proggytinysz12.png and /dev/null differ diff --git a/data/font/proggytinysz12.tfd b/data/font/proggytinysz12.tfd deleted file mode 100644 index 5e7e64a..0000000 --- a/data/font/proggytinysz12.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/font/vgafix12.png b/data/font/vgafix12.png deleted file mode 100644 index bc5b810..0000000 Binary files a/data/font/vgafix12.png and /dev/null differ diff --git a/data/font/vgafix12.tfd b/data/font/vgafix12.tfd deleted file mode 100644 index a66ef11..0000000 --- a/data/font/vgafix12.tfd +++ /dev/null @@ -1,102 +0,0 @@ -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 diff --git a/data/shaders/shadow_pass1.frag b/data/shaders/shadow_pass1.frag deleted file mode 100644 index f4a2ab7..0000000 --- a/data/shaders/shadow_pass1.frag +++ /dev/null @@ -1,13 +0,0 @@ -uniform sampler2D TextureMap; - -varying float CameraDepth; -varying vec2 TexCoord; - -void main() -{ - // draw the typical textured output to visual framebuffer - gl_FragData[0] = texture2D(TextureMap, TexCoord); - - // write "normaliized vertex depth" to the depthmap's alpha. - gl_FragData[1] = vec4(vec3(0.0), CameraDepth); -} \ No newline at end of file diff --git a/data/shaders/shadow_pass1.vert b/data/shaders/shadow_pass1.vert deleted file mode 100644 index 377efc0..0000000 --- a/data/shaders/shadow_pass1.vert +++ /dev/null @@ -1,24 +0,0 @@ -uniform vec3 CameraPos; -uniform vec3 CameraDir; -uniform float DepthNear; -uniform float DepthFar; - -varying float CameraDepth; // normalized camera depth -varying vec2 TexCoord; - -void main() -{ - // offset = vector to vertex from camera's position - vec3 offset = (gl_Vertex.xyz / gl_Vertex.w) - CameraPos; - - // z = distance from vertex to camera plane - float z = -dot(offset, CameraDir); - - // Depth from vertex to camera, mapped to [0,1] - CameraDepth = (z - DepthNear) / (DepthFar - DepthNear); - - // typical interpolated coordinate for texture lookup - TexCoord = gl_MultiTexCoord0.xy; - - gl_Position = ftransform(); -} \ No newline at end of file diff --git a/data/shaders/shadow_pass2.frag b/data/shaders/shadow_pass2.frag deleted file mode 100644 index ab181e9..0000000 --- a/data/shaders/shadow_pass2.frag +++ /dev/null @@ -1,25 +0,0 @@ -uniform sampler2D DepthTexture; -uniform sampler2D ShadowTexture; - -varying vec2 DepthTexCoord; -varying vec3 ShadowNear; -varying vec3 ShadowDir; - -const vec3 shadowColor = vec3(0.0); - -void main() -{ - // read from DepthTexture - // (depth is stored in texture's alpha component) - float cameraDepth = texture2D(DepthTexture, DepthTexCoord).a; - - vec3 shadowPos = (cameraDepth * ShadowDir) + ShadowNear; - float l = dot(shadowPos.yz, shadowPos.yz); - float d = shadowPos.x; - - // k = shadow density: 0=opaque, 1=transparent - // (use texture's red component as the density) - float k = texture2D(ShadowTexture, vec2(l, d)).r; - - gl_FragColor = vec4(shadowColor, k); -} \ No newline at end of file diff --git a/data/shaders/shadow_pass2.vert b/data/shaders/shadow_pass2.vert deleted file mode 100644 index 52e01e3..0000000 --- a/data/shaders/shadow_pass2.vert +++ /dev/null @@ -1,49 +0,0 @@ -uniform mat3 WorldToShadow; -uniform vec3 SphereOrigin; - -uniform vec3 CameraPos; -uniform vec3 CameraDir; -uniform float DepthNear; -uniform float DepthFar; - -varying vec2 DepthTexCoord; -varying vec3 ShadowNear; -varying vec3 ShadowDir; - -void main() -{ - vec4 tmp1 = ftransform(); - gl_Position = tmp1; - - // Predivide out w to avoid perspective-correct interpolation. - // The quantities being interpolated are screen-space texture - // coordinates and vectors to the near and far shadow plane, - // all of which have to be bilinearly interpolated. - // This could potentially be done by setting glHint, - // but it wouldn't be guaranteed to work on all hardware. - - gl_Position.xyz /= gl_Position.w; - gl_Position.w = 1.0; - - // Grab the transformed vertex's XY components as a texcoord - // for sampling from the depth texture from pass 1. - // Normalize them from [0,0] to [1,1] - - DepthTexCoord = gl_Position.xy * 0.5 + 0.5; - - // offset = vector to vertex from camera's position - vec3 offset = (gl_Vertex.xyz / gl_Vertex.w) - CameraPos; - - // z = distance from vertex to camera plane - float z = -dot(offset, CameraDir); - - vec3 shadowOffsetNear = offset * DepthNear / z; - vec3 shadowOffsetFar = offset * DepthFar / z; - - vec3 worldPositionNear = CameraPos + shadowOffsetNear; - vec3 worldPositionFar = CameraPos + shadowOffsetFar; - - vec3 shadowFar = WorldToShadow * (worldPositionFar - SphereOrigin); - ShadowNear = WorldToShadow * (worldPositionNear - SphereOrigin); - ShadowDir = shadowFar - ShadowNear; -} \ No newline at end of file diff --git a/data/shaders/sprite.frag b/data/shaders/sprite.frag deleted file mode 100755 index fb132e5..0000000 --- a/data/shaders/sprite.frag +++ /dev/null @@ -1,17 +0,0 @@ -varying vec4 ambientGlobal/*,ambientA[8],diffuseA[8]*/; -varying vec4 pixelpos; -uniform sampler2D tex; - -void main() -{ - vec4 color = ambientGlobal; - vec4 white = vec4(1.0, 1.0, 1.5, 1.0); - //color = white; - - vec4 texcolor = texture2D(tex, gl_TexCoord[0].st); - color = clamp(texcolor * color, 0.0, 1.0); - //color = color * vec4(1.0, 1.0, 1.0, 0.5); - gl_FragColor = color; - // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - -} \ No newline at end of file diff --git a/data/shaders/sprite.vert b/data/shaders/sprite.vert deleted file mode 100755 index e43949b..0000000 --- a/data/shaders/sprite.vert +++ /dev/null @@ -1,15 +0,0 @@ -varying vec4 ambientGlobal/*,ambientA[8],diffuseA[8]*/; -varying vec3 normal/*,lightDirA[8],halfVectorA[8]*/; -/*varying float distA[8];*/ -varying vec4 pixelpos; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - pixelpos = gl_ModelViewMatrix * gl_Vertex; - ambientGlobal = gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_Position = ftransform(); -} diff --git a/data/shaders/standard.frag b/data/shaders/standard.frag deleted file mode 100755 index 3aec6dd..0000000 --- a/data/shaders/standard.frag +++ /dev/null @@ -1,141 +0,0 @@ -varying vec4 ambientGlobal/*,ambientA[8],diffuseA[8]*/; -varying vec4 pixelpos; -uniform sampler2D tex; -varying vec3 normal/*,lightDirA[8],halfVectorA[8]*/; -/*varying float distA[8];*/ - - -vec4 overlay_blend(vec4 base, vec4 blend) -{ - vec4 lumCoeff = vec4(0.2125, 0.7154, 0.0721, 1.0); - vec4 white = vec4(1.0, 1.0, 1.0, 1.0); - vec4 result; - float luminance = dot(base, lumCoeff); - - if (luminance < 0.45) - result = 2.0 * blend * base; - else if (luminance > 0.55) - result = white - 2.0 * (white - blend) * (white - base); - else - { - vec4 result1 = 2.0 * blend * base; - vec4 result2 = white - 2.0 * (white - blend) * (white - base); - result = mix(result1, result2, (luminance - 0.45) * 10.0); - } - return result; -} - -vec4 process_lightsource(gl_LightSourceParameters light, vec4 incolor) -{ - vec3 n,halfV,viewV,lightDir,halfVector; - float NdotL,NdotHV,dist; - vec4 color = vec4(0.0, 0.0, 0.0, 1.0); - vec4 spec = vec4(0.0, 0.0, 0.0, 1.0); - vec4 white = vec4(1.0, 1.0, 1.0, 1.0); - float att; - - /* a fragment shader can't write a varying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - vec3 aux, ldir; - vec4 d,a; - if (light.position[3] == 1.0) - { - aux = vec3(light.position-pixelpos); - ldir = normalize(aux); - dist = length(aux); - } - else - { - ldir = normalize(vec3(light.position)); - dist = 0.0; - } - - halfVector = normalize(light.halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - d = gl_FrontMaterial.diffuse * light.diffuse; - - /* The ambient terms have been separated since one of them */ - /* suffers attenuation */ - a = gl_FrontMaterial.ambient * light.ambient; - - /* compute the dot product between normal and normalized lightdir */ - NdotL = dot(n,ldir); - -#define SHADOW_FUZZ 0.1 - - if (NdotL > 0.0) { - NdotL = ((1.0 - SHADOW_FUZZ) * NdotL) + SHADOW_FUZZ; - - att = 1.0 / (light.constantAttenuation + - light.linearAttenuation * dist + - light.quadraticAttenuation * dist * dist); - color = att * (d * NdotL + a); - - - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - - //spec = att * gl_FrontMaterial.specular * light.specular * pow(NdotHV,gl_FrontMaterial.shininess); - spec = att * white * light.specular * pow(NdotHV,10.0); - - } - else if (NdotL > (-1.0 * SHADOW_FUZZ)) { - float fraction; - NdotL = (NdotL+SHADOW_FUZZ); - fraction = NdotL / SHADOW_FUZZ; - - att = 1.0 / (light.constantAttenuation + - light.linearAttenuation * dist + - light.quadraticAttenuation * dist * dist); - color = att * fraction * (d * NdotL + a); - - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - - //spec = att * fraction * gl_FrontMaterial.specular * light.specular * pow(NdotHV,gl_FrontMaterial.shininess); - spec = att * white * light.specular * pow(NdotHV,10.0); - - } - - - // blend mode SCREEN - color = white - ((white - color) * (white - incolor)); - // blend mode AVG - //color = (color + incolor) * 0.5; - // blend mode LIGHTEN - //color = max(color, incolor); - // blend mode OVERLAY - //color = overlay_blend(incolor, color); - // blend mode DODGE - //color = incolor / (white - color); - // blend mode MULTIPLY - //color = color * incolor; - - color += clamp(spec, 0.0, 1.0); - return clamp(color, 0.0, 1.0); - -} - -void main() -{ - vec4 color = ambientGlobal; - vec4 white = vec4(1.0, 1.0, 1.0, 1.0); - //color = white; - - color = process_lightsource(gl_LightSource[0], color); - color = process_lightsource(gl_LightSource[1], color); - color = process_lightsource(gl_LightSource[2], color); - color = process_lightsource(gl_LightSource[3], color); - color = process_lightsource(gl_LightSource[4], color); - color = process_lightsource(gl_LightSource[5], color); - color = process_lightsource(gl_LightSource[6], color); - color = process_lightsource(gl_LightSource[7], color); - - vec4 texcolor = texture2D(tex, gl_TexCoord[0].st); - gl_FragColor = clamp(texcolor * color, 0.0, 1.0); - // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); - -} \ No newline at end of file diff --git a/data/shaders/standard.vert b/data/shaders/standard.vert deleted file mode 100644 index 9d75179..0000000 --- a/data/shaders/standard.vert +++ /dev/null @@ -1,15 +0,0 @@ -varying vec4 ambientGlobal/*,ambientA[8],diffuseA[8]*/; -varying vec3 normal/*,lightDirA[8],halfVectorA[8]*/; -/*varying float distA[8];*/ -varying vec4 pixelpos; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - pixelpos = gl_ModelViewMatrix * gl_Vertex; - ambientGlobal = gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_Position = ftransform(); -} diff --git a/data/shaders/test.frag b/data/shaders/test.frag deleted file mode 100644 index 03f0e92..0000000 --- a/data/shaders/test.frag +++ /dev/null @@ -1,12 +0,0 @@ -varying vec3 normal; -varying vec3 lightdir; -uniform sampler2D tex; - -void main() -{ - float intensity; - intensity = dot(lightdir, normalize(normal)); - - var; - gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * vec4(intensity, intensity, intensity, 1.0); -} \ No newline at end of file diff --git a/data/shaders/test.vert b/data/shaders/test.vert deleted file mode 100644 index 5cdab5e..0000000 --- a/data/shaders/test.vert +++ /dev/null @@ -1,13 +0,0 @@ -varying vec3 normal; -varying vec3 lightdir; - -void main() -{ - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - normal = gl_NormalMatrix * gl_Normal; - vec4 newpos = ftransform(); - gl_Position = newpos; - - lightdir = normalize(vec3(gl_LightSource[0].position) - vec3(gl_ModelViewMatrix * gl_Vertex)); -} \ No newline at end of file diff --git a/data/sprite/bluelight_static.png b/data/sprite/bluelight_static.png deleted file mode 100644 index d7197da..0000000 Binary files a/data/sprite/bluelight_static.png and /dev/null differ diff --git a/data/sprite/fuzzy_particle.png b/data/sprite/fuzzy_particle.png deleted file mode 100644 index b27b654..0000000 Binary files a/data/sprite/fuzzy_particle.png and /dev/null differ diff --git a/data/sprite/hard_particle.png b/data/sprite/hard_particle.png deleted file mode 100755 index 630fbec..0000000 Binary files a/data/sprite/hard_particle.png and /dev/null differ diff --git a/data/sprite/medium_particle.png b/data/sprite/medium_particle.png deleted file mode 100755 index ebfb3bb..0000000 Binary files a/data/sprite/medium_particle.png and /dev/null differ diff --git a/data/sprite/redlight_static.png b/data/sprite/redlight_static.png deleted file mode 100644 index abdd029..0000000 Binary files a/data/sprite/redlight_static.png and /dev/null differ diff --git a/data/sprite/soft_particle.png b/data/sprite/soft_particle.png deleted file mode 100755 index 09c5643..0000000 Binary files a/data/sprite/soft_particle.png and /dev/null differ diff --git a/data/sprite/star_sprite_inner.png b/data/sprite/star_sprite_inner.png deleted file mode 100644 index a2d66b1..0000000 Binary files a/data/sprite/star_sprite_inner.png and /dev/null differ diff --git a/data/sprite/star_sprite_main.png b/data/sprite/star_sprite_main.png deleted file mode 100644 index a9b4f77..0000000 Binary files a/data/sprite/star_sprite_main.png and /dev/null differ diff --git a/data/sprite/star_sprite_washout.png b/data/sprite/star_sprite_washout.png deleted file mode 100644 index 412fc27..0000000 Binary files a/data/sprite/star_sprite_washout.png and /dev/null differ diff --git a/data/sprite/whitelight_static.png b/data/sprite/whitelight_static.png deleted file mode 100644 index b15444a..0000000 Binary files a/data/sprite/whitelight_static.png and /dev/null differ diff --git a/data/sprite/yellowlight_static.png b/data/sprite/yellowlight_static.png deleted file mode 100644 index 78331a7..0000000 Binary files a/data/sprite/yellowlight_static.png and /dev/null differ diff --git a/data/tex/black.png b/data/tex/black.png deleted file mode 100644 index 1090894..0000000 Binary files a/data/tex/black.png and /dev/null differ diff --git a/data/tex/dralthi.png b/data/tex/dralthi.png deleted file mode 100644 index 408167e..0000000 Binary files a/data/tex/dralthi.png and /dev/null differ diff --git a/data/tex/nm_flat.png b/data/tex/nm_flat.png deleted file mode 100644 index 22f4692..0000000 Binary files a/data/tex/nm_flat.png and /dev/null differ diff --git a/data/tex/plasma1.png b/data/tex/plasma1.png deleted file mode 100644 index 46d9a19..0000000 Binary files a/data/tex/plasma1.png and /dev/null differ diff --git a/data/tex/plasma2.png b/data/tex/plasma2.png deleted file mode 100644 index d5ace7f..0000000 Binary files a/data/tex/plasma2.png and /dev/null differ diff --git a/data/tex/star_sprite_main.png b/data/tex/star_sprite_main.png deleted file mode 100644 index 1dc8b77..0000000 Binary files a/data/tex/star_sprite_main.png and /dev/null differ diff --git a/data/tex/test1.png b/data/tex/test1.png deleted file mode 100644 index 0ce9fa3..0000000 Binary files a/data/tex/test1.png and /dev/null differ diff --git a/data/tex/white.png b/data/tex/white.png deleted file mode 100644 index b82ed71..0000000 Binary files a/data/tex/white.png and /dev/null differ diff --git a/data/tex/whitelight_static.png b/data/tex/whitelight_static.png deleted file mode 100644 index b15444a..0000000 Binary files a/data/tex/whitelight_static.png and /dev/null differ diff --git a/data/ui/button_bg_corner.png b/data/ui/button_bg_corner.png deleted file mode 100755 index ed0aaa7..0000000 Binary files a/data/ui/button_bg_corner.png and /dev/null differ diff --git a/data/ui/button_bg_edge.png b/data/ui/button_bg_edge.png deleted file mode 100755 index aa550e8..0000000 Binary files a/data/ui/button_bg_edge.png and /dev/null differ diff --git a/data/ui/button_corner.png b/data/ui/button_corner.png deleted file mode 100755 index ad04941..0000000 Binary files a/data/ui/button_corner.png and /dev/null differ diff --git a/data/ui/button_edge.png b/data/ui/button_edge.png deleted file mode 100755 index 2eca13b..0000000 Binary files a/data/ui/button_edge.png and /dev/null differ diff --git a/data/ui/frame_bg_corner.png b/data/ui/frame_bg_corner.png deleted file mode 100755 index 97ff535..0000000 Binary files a/data/ui/frame_bg_corner.png and /dev/null differ diff --git a/data/ui/frame_bg_edge.png b/data/ui/frame_bg_edge.png deleted file mode 100755 index 16f5ba2..0000000 Binary files a/data/ui/frame_bg_edge.png and /dev/null differ diff --git a/data/ui/frame_corner.png b/data/ui/frame_corner.png deleted file mode 100755 index ab12886..0000000 Binary files a/data/ui/frame_corner.png and /dev/null differ diff --git a/data/ui/frame_edge.png b/data/ui/frame_edge.png deleted file mode 100755 index f2500d3..0000000 Binary files a/data/ui/frame_edge.png and /dev/null differ diff --git a/data/xml/constants.xml b/data/xml/constants.xml deleted file mode 100644 index 836de95..0000000 --- a/data/xml/constants.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/data/xml/def/bases.xml b/data/xml/def/bases.xml deleted file mode 100644 index c9c9f28..0000000 --- a/data/xml/def/bases.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/xml/def/commodities.xml b/data/xml/def/commodities.xml deleted file mode 100644 index d5a4c91..0000000 --- a/data/xml/def/commodities.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/data/xml/def/components.xml b/data/xml/def/components.xml deleted file mode 100644 index 44c7278..0000000 --- a/data/xml/def/components.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/xml/def/engines.xml b/data/xml/def/engines.xml deleted file mode 100644 index b75e3c2..0000000 --- a/data/xml/def/engines.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data/xml/def/factions.xml b/data/xml/def/factions.xml deleted file mode 100644 index 7b4dae9..0000000 --- a/data/xml/def/factions.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/data/xml/def/models.xml b/data/xml/def/models.xml deleted file mode 100755 index 7df099c..0000000 --- a/data/xml/def/models.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/xml/def/shaders.xml b/data/xml/def/shaders.xml deleted file mode 100644 index 87c9135..0000000 --- a/data/xml/def/shaders.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/data/xml/def/ships.xml b/data/xml/def/ships.xml deleted file mode 100755 index 5f0d76e..0000000 --- a/data/xml/def/ships.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/xml/def/sprites.xml b/data/xml/def/sprites.xml deleted file mode 100755 index 5f08046..0000000 --- a/data/xml/def/sprites.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data/xml/def/stellars.xml b/data/xml/def/stellars.xml deleted file mode 100644 index 15cf568..0000000 --- a/data/xml/def/stellars.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/xml/def/systems.xml b/data/xml/def/systems.xml deleted file mode 100644 index df6d0af..0000000 --- a/data/xml/def/systems.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/data/xml/def/textures.xml b/data/xml/def/textures.xml deleted file mode 100755 index f2bcfcf..0000000 --- a/data/xml/def/textures.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data/xml/def/weapons.xml b/data/xml/def/weapons.xml deleted file mode 100644 index 7b23f39..0000000 --- a/data/xml/def/weapons.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data/xml/engines.xml b/data/xml/engines.xml deleted file mode 100644 index 5efd993..0000000 --- a/data/xml/engines.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - LX-20 Light Freighter Engine - The LX-20 is one of the cheapest, simplest, and least effective engine designs available. It is commonly found equipped on the cheapest freighters, where its general reliability and the ease of finding replacement parts for it serves well. No reputable dealer would ever stock an engine this decrepit, but you can probably find a servicable one littering any spaceport since most people consider them useless. - 18000 - 0 - 150 - 3800 - eng_large - - - Plasma Vector Drive - This is the engine equipped as standard on the Kestrel fighter. Top-of-the-line by any account, there is no downside except the price. It's small and lightweight, and it provides tremendous speed and agility with a minimal fuel cost. - 0.05 - 25 - 22000 - 550000 - eng_advanced - - diff --git a/data/xml/factions.xml b/data/xml/factions.xml deleted file mode 100644 index e93b0a7..0000000 --- a/data/xml/factions.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - Government FactionGroup - -1 - - - Neutral FactionGroup - -1 - - - Criminal FactionGroup - -1 - - - Colonial Alliance Navy - 10000 - - - Colonial Alliance Police - 10000 - - - Associated Worlds Navy - 10000 - - - Associated Worlds Police - 10000 - - - Evon Naval Forces - 10000 - - - Evon Police Forces - 10000 - - - Royal Victorian Navy - 10000 - - - Victorian Police Forces - 10000 - - - Independent Defense Fleet - 10001 - - - Corsair Navy - 10002 - - diff --git a/data/xml/models.xml b/data/xml/models.xml deleted file mode 100755 index 0e24d86..0000000 --- a/data/xml/models.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - mesh_sprite - mat_test - - - - - mesh_sprite - mat_star - - - - - mesh_centered_sprite - mat_star - - - - - mesh_centered_sprite - mat_particle - - - - - mesh_centered_sprite - mat_dralthi - - - - - - mesh_sprite - mat_ui_frame_corner - - - mesh_sprite - mat_ui_frame_bg_corner - - - - - mesh_sprite - mat_ui_frame_edge - - - mesh_sprite - mat_ui_frame_bg_edge - - - - - mesh_sprite - mat_ui_frame_corner - - - mesh_sprite - mat_ui_frame_bg_corner - - - - - mesh_sprite - mat_ui_frame_edge - - - mesh_sprite - mat_ui_frame_bg_edge - - - - - mesh_sprite - mat_blank - - - - - mesh_sprite - mat_ui_frame_edge - - - mesh_sprite - mat_ui_frame_bg_edge - - - - - mesh_sprite - mat_ui_frame_corner - - - mesh_sprite - mat_ui_frame_bg_corner - - - - - mesh_sprite - mat_ui_frame_edge - - - mesh_sprite - mat_ui_frame_bg_edge - - - - - mesh_sprite - mat_ui_frame_corner - - - mesh_sprite - mat_ui_frame_bg_corner - - - - - - - - mesh_sprite - mat_ui_button_corner - - - mesh_sprite - mat_ui_button_bg_corner - - - - - mesh_sprite - mat_ui_button_edge - - - mesh_sprite - mat_ui_button_bg_edge - - - - - mesh_sprite - mat_ui_button_corner - - - mesh_sprite - mat_ui_button_bg_corner - - - - - mesh_sprite - mat_ui_button_edge - - - mesh_sprite - mat_ui_button_bg_edge - - - - - mesh_sprite - mat_blank - - - - - mesh_sprite - mat_ui_button_edge - - - mesh_sprite - mat_ui_button_bg_edge - - - - - mesh_sprite - mat_ui_button_corner - - - mesh_sprite - mat_ui_button_bg_corner - - - - - mesh_sprite - mat_ui_button_edge - - - mesh_sprite - mat_ui_button_bg_edge - - - - - mesh_sprite - mat_ui_button_corner - - - mesh_sprite - mat_ui_button_bg_corner - - - - - - diff --git a/data/xml/shaders.xml b/data/xml/shaders.xml deleted file mode 100755 index be9262d..0000000 --- a/data/xml/shaders.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - standard - standard - - - test - test - - - sprite - sprite - - - shadow_pass1 - shadow_pass1 - - - shadow_pass2 - shadow_pass2 - - \ No newline at end of file diff --git a/data/xml/ships.xml b/data/xml/ships.xml deleted file mode 100755 index d2f65dc..0000000 --- a/data/xml/ships.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - Spacetruck - m_fr_spacetruck - 55 - 64 - 35 - 15000 - 15000 - 2450 - 0 - 1 - The commercial backbone of the colonies, the Space Truck carries a lot of cargo and does it very cheaply. They are perfect for trading in heavily patrolled sectors, but in rougher areas their lack of defensive systems and voluminous cargo hold makes them an obvious target. - - - Kestrel - m_fi_kestrel - Graceful lines and top-end equipment make this fighter a favourite of civilian pilots. - 215 - 120 - 200 - 480 - 5 - 28 - 6 - 1 - - - Thor Class Battlestation - m_bs_thor - Massive and bristling with armaments and defenses, the Thor class battlestations are the Colonial Alliance's most powerful line of defense against any aggressor. Indeed, simulations show that in a best case scenario one of thsese battlestations could potentially defeat an entire foreign Navy single-handedly. - 451000000 - 6000000 - 140000 - 28 - - - Nav Buoy - m_misc_navbuoy0 - 1500 - - - Nav Buoy Test - m_misc_navbuoy_test - 1500 - - - Bob - m_pl_bob - 4.5e22 - - - - Starter Pack - Not for Resale - - - New pilots get this ship with this equipment - - - Thor Class Battlestation - - Massive and bristling with armaments and defenses, the Thor class battlestations are the Colonial Alliance's most powerful line of defense against any aggressor. Indeed, simulations show that in a best case scenario one of thsese battlestations could potentially defeat an entire foreign Navy single-handedly. - - - Bob - - A planet - - - - Nav Buoy - Navigation buoys are typically used to mark a route or a specific point in space. - - - - - Nav Buoy - Navigation buoys are typically used to mark a route or a specific point in space. - - - - - diff --git a/data/xml/sprites.xml b/data/xml/sprites.xml deleted file mode 100755 index fe02b6b..0000000 --- a/data/xml/sprites.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - tex/test1.png - - \ No newline at end of file diff --git a/data/xml/stellars.xml b/data/xml/stellars.xml deleted file mode 100644 index 60def60..0000000 --- a/data/xml/stellars.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - Bob - earthy - Bob is a rich agricultural planet, with a moderate industrial sector, large population centers, and a stable ecosystem. It's a pleasant place, with a little something for everyone, but is otherwise fairly nondescript. - 7.4e24 - 8552.3 - - \ No newline at end of file diff --git a/data/xml/textures.xml b/data/xml/textures.xml deleted file mode 100755 index d041dac..0000000 --- a/data/xml/textures.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - tex/black.png - - - - - tex/white.png - - - - tex/nm_flat.png - - - - - - - - tex/test1.png - - - tex/whitelight_static.png - - - tex/star_sprite_main.png - - - tex/dralthi.png - - - - - ui/button_corner.png - - - ui/button_edge.png - - - ui/button_bg_corner.png - - - ui/button_bg_edge.png - - - ui/frame_corner.png - - - ui/frame_edge.png - - - ui/frame_bg_corner.png - - - ui/frame_bg_edge.png - - - - - - - - - - - - - - - - - - - - - - - - - - - - tex/plasma1.png - - - tex/plasma2.png - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data/xml/weapons.xml b/data/xml/weapons.xml deleted file mode 100644 index 22bba03..0000000 --- a/data/xml/weapons.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - Light Blaster - The staggering ubiquity of the blaster class weapons is due to their simplicity and reliability. This particular model is one of the smallest blaster models, and it is more of a mild deterrant than an actual combat weapon. Against any moderately capable fighter it would prove almost ineffective even in large numbers, and it would be absolutely laughable to suggest that it would be of any use at all against a larger ship. Still, they are often found on shuttles and small freighters hoping that any agressor will see that numerous guns are mounted without bothering to scan too closely. - 250 - 0.2 - 2 - w_lightblaster - - - 250 - wp_lightblaster - 1000 - - - hard_particle - - 400 - 20 - 20 - - \ No newline at end of file diff --git a/looprun.bat b/looprun.bat deleted file mode 100755 index 9f601e3..0000000 --- a/looprun.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -:restart -roc_test.py -pause -echo Starting... -goto restart diff --git a/refuge.py b/refuge.py deleted file mode 100755 index a00855e..0000000 --- a/refuge.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/local/bin/python2.4 - -import pygame -from pygame.locals import * -import os -import sys -import math -import random -import inputs -import gamedata -import gametimer -import video -import glwrapper -import init_universe -import universe -import time -import components -try: - from PIL import PngImagePlugin -except: - import PngImagePlugin -from .gameobj import * -from player import * -from particles import * -from ai import * - -pygame.init() -gamedata.load_gamedata() - -size = width, height = (1600,1200) -size = width, height = (1024,768) - -video.set_res(size) -video.init() -video.enable_vsync() -gametimer.start_loop() -init_universe.init() -view = None -skipping = False -while True: - events = pygame.event.get() - #if skipping: - # print "SKIPPING! Forced? %s" % (video.get_forced_redraw(),) - gametimer.next_frame(skipping) - """ - if guiscreen != None or guidlg != None: - video.force_redraw() # irrelevant right now, but when we exit the gui, we'll need a full redraw! - for ev in events: - if ev.type == QUIT: - inputs.add_command('exit') - break - if 'exit' in inputs.commands: - break - if guiscreen: - guiscreen.distribute_events(*events) - continue - """ - pygame.event.pump() - for ev in events: - if ev.type == QUIT: - inputs.add_command('exit') - break - elif ev.type == KEYUP: - inputs.keyup(ev.key) - elif ev.type == KEYDOWN: - inputs.keydown(ev.key) - #elif ev.type == VIDEOEXPOSE: - # video.force_redraw() - elif ev.type in (MOUSEBUTTONDOWN, MOUSEBUTTONUP): - pass - - if 'exit' in inputs.commands: - break - - #map.handle_keys(keys) - #units.mgr.update() - #view.update() - - #if video.get_forced_redraw(): - # video.get_scr().fill((0,0,0)) - - #skipping = video.skipping_next_frame() - - - if not skipping: - universe.next_frame() - video.predraw() - universe.render() - - if not skipping: - video.next_frame() - inputs.next_frame() - else: - video.reset_skipping() - - - diff --git a/__init__.py b/roc/__init__.py similarity index 100% rename from __init__.py rename to roc/__init__.py diff --git a/asset.py b/roc/asset.py similarity index 100% rename from asset.py rename to roc/asset.py diff --git a/camera.py b/roc/camera.py similarity index 100% rename from camera.py rename to roc/camera.py diff --git a/config.py b/roc/config.py similarity index 100% rename from config.py rename to roc/config.py diff --git a/deprecate.py b/roc/deprecate.py similarity index 100% rename from deprecate.py rename to roc/deprecate.py diff --git a/enums.py b/roc/enums.py similarity index 100% rename from enums.py rename to roc/enums.py diff --git a/files.py b/roc/files.py similarity index 100% rename from files.py rename to roc/files.py diff --git a/fonts.py b/roc/fonts.py similarity index 100% rename from fonts.py rename to roc/fonts.py diff --git a/gamedata.py b/roc/gamedata.py similarity index 100% rename from gamedata.py rename to roc/gamedata.py diff --git a/gameobj.py b/roc/gameobj.py similarity index 100% rename from gameobj.py rename to roc/gameobj.py diff --git a/gametimer.py b/roc/gametimer.py similarity index 100% rename from gametimer.py rename to roc/gametimer.py diff --git a/inputs.py b/roc/inputs.py similarity index 100% rename from inputs.py rename to roc/inputs.py diff --git a/lesson6.py b/roc/lesson6.py similarity index 100% rename from lesson6.py rename to roc/lesson6.py diff --git a/models.py b/roc/models.py similarity index 100% rename from models.py rename to roc/models.py diff --git a/physics.py b/roc/physics.py similarity index 100% rename from physics.py rename to roc/physics.py diff --git a/pipeline.py b/roc/pipeline.py similarity index 100% rename from pipeline.py rename to roc/pipeline.py diff --git a/platform.py b/roc/platform.py similarity index 100% rename from platform.py rename to roc/platform.py diff --git a/platform_darwin.py b/roc/platform_darwin.py similarity index 100% rename from platform_darwin.py rename to roc/platform_darwin.py diff --git a/platform_posix.py b/roc/platform_posix.py similarity index 100% rename from platform_posix.py rename to roc/platform_posix.py diff --git a/platform_win32.py b/roc/platform_win32.py similarity index 100% rename from platform_win32.py rename to roc/platform_win32.py diff --git a/roc_core.py b/roc/roc_core.py similarity index 100% rename from roc_core.py rename to roc/roc_core.py diff --git a/roc_engine.py b/roc/roc_engine.py similarity index 100% rename from roc_engine.py rename to roc/roc_engine.py diff --git a/roc_main.py b/roc/roc_main.py similarity index 100% rename from roc_main.py rename to roc/roc_main.py diff --git a/shader.py b/roc/shader.py similarity index 100% rename from shader.py rename to roc/shader.py diff --git a/ui.py b/roc/ui.py similarity index 100% rename from ui.py rename to roc/ui.py diff --git a/video.py b/roc/video.py similarity index 100% rename from video.py rename to roc/video.py diff --git a/widgets.py b/roc/widgets.py similarity index 100% rename from widgets.py rename to roc/widgets.py diff --git a/roc_test.py b/roc_test.py deleted file mode 100755 index 7c3af9a..0000000 --- a/roc_test.py +++ /dev/null @@ -1,174 +0,0 @@ -#import roc -import os -import sys -import roc -import pygame -from OpenGL.GL import * -from py3dutil import vect, quat -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 -import math - -class partycle(object): - def __init__(self, x, y, xd, yd, rot, rotd, color): - self.x = x - self.y = y - self.xd = xd - self.yd = yd - self.rot = rot - self.rotd = rotd - self.color = color - - @classmethod - def random(cls): - 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 - s1 = 1.0 - abs((h1 % 2.0) - 1.0) - if h1 < 1.0: - r, g, b = 1.0, s1, 0.0 - elif h1 < 2.0: - r, g, b = s1, 1.0, 0.0 - elif h1 < 3.0: - r, g, b = 0.0, 1.0, s1 - elif h1 < 4.0: - r, g, b = 0.0, s1, 1.0 - elif h1 < 5.0: - r, g, b = s1, 0.0, 1.0 - elif h1 < 6.0: - r, g, b = 1.0, 0.0, s1 - - rot = random.random() * 90.0 - rotd = ((random.random() * 2.0) - 1.0) * 3.0 - rv = cls(x, y, xd, yd, rot, rotd, (r, g, b, 1.0)) - - return rv - - def movestep(self): - self.x += self.xd - self.y += self.yd - self.xd *= 0.985 - self.yd *= 0.985 - self.rot += self.rotd - -class test_engine(roc.engine.base_engine): - 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)) - self.string = "" - self.move = 199.0 - self.moveinc = 1.0 - self.particles = collections.deque() - self.particles.append(partycle.random()) - - - - def frame(self, events): - #print "*** Starting frame" - # pink triangle - glDisable(GL_BLEND) - glDisable(GL_TEXTURE_2D) - glBegin(GL_TRIANGLE_STRIP) - glNormal3f(0.0, 0.0, 1.0) - glTexCoord2f(0.0, 0.0) - glColor4f(1.0, 0.0, 0.5, 0.0) - glVertex3f( 20.0, 50.0, 1.0) - glVertex3f( 20.0, 600.0, 1.0) - glVertex3f( 400.0, 50.0, 1.0) - glEnd() - - # yellow square - glBegin(GL_TRIANGLE_STRIP) - glNormal3f(0.0, 0.0, 1.0) - glTexCoord2f(0.0, 0.0) - glColor4f(0.0, 0.2, 0.5, 0.8) - glVertex3f( 150.0, 20.0, -50.0) - glVertex3f( 150.0, 400.0, -50.0) - glVertex3f( 360.0, 20.0, -50.0) - glVertex3f( 360.0, 400.0, -50.0) - glEnd() - glEnable(GL_BLEND) - glEnable(GL_TEXTURE_2D) - glColor4f(1.0, 1.0, 1.0, 1.0) - - # texture test - mdl = models.mgr.create("m_test") - glPushMatrix() - glTranslate(100.0, 300.0, -5.0) - mdl.render() - glPopMatrix() - - - - - # font test - glPushMatrix() - glTranslate(200.0, 200.0, 5.0) - self.text1.render() - glPopMatrix() - - for x in range(gametimer.num_frames(10)): - self.move = self.move + self.moveinc - if self.move > 300.0: - self.moveinc = -1.0 - elif self.move < 200.0: - self.moveinc = 1.0 - for party in self.particles: - party.movestep() - if self.moveinc > 0.0: - party = partycle.random() - self.particles.append(party) - #print party.color - else: - self.particles.popleft() - - - glPushMatrix() - glTranslate(self.move, 250.0, 5.0) - - - """ - if len(self.string) > 61: - self.string = "" - - for x in xrange(gametimer.num_frames(1000)): - self.string = self.string + str(len(self.string) % 10) - """ - for x in range(gametimer.num_frames(100)): - self.string = str(round(gametimer.get_fps(), 1)) - #print len(gametimer.g_framelist) - - - self.font.render(self.string) - glPopMatrix() - - # texture test - 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) - mdl2.render() - glPopMatrix() - - - -roc.video.width = 1024 -roc.video.height = 768 -roc.init2d() -roc.set_engine(test_engine()) -roc.main() - - - diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..716ef1d --- /dev/null +++ b/setup.py @@ -0,0 +1,24 @@ +# setup.py + +long_description = open('README', 'r').read() + +from distutils.core import setup +from pickle import load, dump +import os + +""" +buildno = 0 +if os.path.exists('buildno'): + buildno = load(open('buildno', 'rb')) + buildno += 1 +dump(buildno, open('buildno', 'wb')) +""" + +dist = setup(name = "roc", + version = "0.1.0", + description = "roc game engine", + long_description = long_description, + author = "Bradley Lawrence", + author_email = "codeninja@iambitter.org", + packages = ['roc']) +