fix outfit glitches, init combobox, move shaders, remove unused particles files, create timer utility

This commit is contained in:
Eduardo Bart
2011-12-28 17:38:29 -02:00
parent 11bb365dce
commit 400afa9981
32 changed files with 273 additions and 269 deletions

View File

@@ -1 +1,10 @@
-- place any code for testing purposes here
-- place any code for testing purposes here
function init()
local box = UIComboBox.create()
box:setStyle('ComboBox')
box:moveTo({x=100, y=8})
UI.display(box)
end
addEvent(init)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

View File

@@ -55,3 +55,17 @@ function resolveFileFullPath(filePath, depth)
return filePath
end
end
function extends(base)
local derived = {}
function derived.internalCreate()
local instance = base.create()
for k,v in pairs(derived) do
instance[k] = v
end
return instance
end
derived.create = derived.internalCreate
return derived
end

View File

@@ -15,4 +15,5 @@ Module
importStyles 'styles/listboxes.otui'
importStyles 'styles/items.otui'
importStyles 'styles/creatures.otui'
importStyles 'styles/comboboxes.otui'
return true

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

View File

@@ -0,0 +1,9 @@
ComboBox < UIComboBox
font: verdana-11px-antialised
color: #aaaaaa
size: 86 20
text-margin: 3
border-image:
source: /core_styles/images/combobox.png
border: 1
border.right: 17

View File

@@ -7,4 +7,5 @@ Module
onLoad: |
require 'tooltip/tooltip'
require 'messagebox/messagebox'
require 'uicombobox/uicombobox'
return true

View File

@@ -0,0 +1 @@
UIComboBox = extends(UIWidget)

View File

@@ -0,0 +1,10 @@
uniform float opacity; // painter opacity
uniform vec4 color; // painter color
uniform float time; // time in seconds since shader linkage
uniform sampler2D texture; // map texture
varying vec2 textureCoords; // map texture coords
void main()
{
gl_FragColor = texture2D(texture, textureCoords) * color * opacity;
}

View File

@@ -1,6 +1,6 @@
uniform float opacity;
uniform vec4 color;
uniform float ticks;
uniform float opacity; // painter opacity
uniform vec4 color; // painter color
uniform float time; // time in seconds since shader linkage
uniform sampler2D texture; // outfit texture
varying vec2 textureCoords; // outfit texture coords
@@ -38,3 +38,4 @@ void main()
{
gl_FragColor = calcOutfitPixel() * color * opacity;
}

View File

@@ -1,102 +0,0 @@
ParticleSystem
AttractionAffector
position: 320 180
acceleration: 500
repelish: true
delay: 0.5
// Fire
Emitter
position: 295 180
duration: 0.5
burstRate: 0.0166
burstCount: 3
delay: 0
particle-min-duration: 0.3
particle-max-duration: 0.5
particle-position-radius: 0
particle-min-velocity: 200
particle-max-velocity: 240
particle-min-velocity-angle: -10
particle-max-velocity-angle: 10
particle-acceleration: 0
particle-start-size: 16 16
particle-final-size: 64 64
particle-colors: #ffcc0050 #ffff0025 #ff000000
particle-colors-stops: 0 0.15 0.3
particle-composition-mode: addition
particle-texture: circle2.png
// Fire ball
Emitter
position: 295 180
duration: 0
burstRate: 0.0166
burstCount: 3
delay: 0
particle-min-duration: 0.5
particle-max-duration: 0.9
particle-position-radius: 0
particle-min-velocity: 80
particle-max-velocity: 110
particle-min-velocity-angle: -30
particle-max-velocity-angle: 30
particle-acceleration: 0
particle-start-size: 16 16
particle-final-size: 32 32
particle-composition-mode: addition
particle-colors: #19191980 #0f0f0f80 #00000000
particle-colors-stops: 0 0.45 0.9
particle-texture: circle2.png
ParticleSystem
AttractionAffector
position: 320 180
acceleration: 30
repelish: true
// Smoke
Emitter
position: 295 180
duration: 0.7
burstRate: 0.0166
burstCount: 3
delay: 0.4
particle-min-duration: 0.9
particle-max-duration: 0.9
particle-position-radius: 0
particle-min-velocity: 60
particle-max-velocity: 85
particle-min-velocity-angle: -20
particle-max-velocity-angle: 20
particle-acceleration: 0
particle-start-size: 8 8
particle-final-size: 64 64
particle-colors: #66666610 #00000000
particle-colors-stops: 0 0.9
particle-texture: circle2.png

View File

@@ -1,123 +0,0 @@
varying vec2 textureCoords;
uniform float opacity;
uniform vec4 color;
uniform float ticks;
uniform sampler2D texture;
void main()
{
gl_FragColor = texture2D(texture, textureCoords) * color * opacity;
}
/*
varying vec2 textureCoords;
uniform vec4 color;
uniform float ticks;
uniform sampler2D texture;
void main()
{
int num = 4;
vec4 sum = vec4(0);
int i, j;
for(i=-num/2;i<num/2;++i) {
for(j=-num/2;j<num/2;++j) {
sum += texture2D(texture, textureCoords + vec2(i+1, j+1)*0.001) * 1.0/(num*num);
}
}
float period = ticks/1000.0;
float a = (sin(period)+1.0)/2.0;
sum.a = 0;
gl_FragColor = vec4(1,1,1,2) - texture2D(texture, textureCoords);
}
*/
/*
uniform sampler2D texture;
varying vec2 textureCoords;
void main()
{
vec4 sum = vec4(0);
vec2 texcoord = textureCoords;
int j;
int i;
for( i= -4 ;i < 4; i++)
{
for (j = -3; j < 3; j++)
{
sum += texture2D(texture, texcoord + vec2(j, i)*0.004) * 0.25;
}
}
if (texture2D(texture, texcoord).r < 0.3)
{
gl_FragColor = sum*sum*0.012 + texture2D(texture, texcoord);
}
else
{
if (texture2D(texture, texcoord).r < 0.5)
{
gl_FragColor = sum*sum*0.009 + texture2D(texture, texcoord);
}
else
{
gl_FragColor = sum*sum*0.0075 + texture2D(texture, texcoord);
}
}
}
*/
/*
uniform sampler2D texture;
varying vec2 textureCoords;
uniform vec4 color;
uniform float opacity;
uniform float ticks;
uniform float rt_w = 18*32;
uniform float rt_h = 14*32;
uniform float radius = 300.0;
uniform float angle = 0.2;
uniform vec2 center = vec2(8*32, 5*32);
vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
vec2 texSize = vec2(rt_w, rt_h);
vec2 tc = uv * texSize;
tc -= center;
float dist = length(tc);
if (dist < radius)
{
float percent = (radius - dist) / radius;
float theta = percent * percent * ((int)ticks % 1000)/1000.0 * 8.0;
float s = sin(theta);
float c = cos(theta);
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
}
tc += center;
vec3 color = texture2D(texture, tc / texSize).rgb;
return vec4(color, 1.0);
}
void main (void)
{
vec2 uv = textureCoords.st;
gl_FragColor = PostFX(texture, uv, ticks) * opacity;
}
*/
/*
uniform float opacity;
vec4 calculatePixel();
void main()
{
gl_FragColor = calculatePixel() * opacity;
}
varying vec2 textureCoords;
uniform vec4 color;
uniform sampler2D texture;
vec4 calculatePixel() {
return texture2D(texture, textureCoords) * color;
}
*/