Fixed The main flicker problem

This commit is contained in:
Ziver Koc 2008-02-15 15:09:43 +00:00
parent ac1e224d26
commit a66e3beb05
24 changed files with 50 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before After
Before After

View file

@ -64,24 +64,9 @@ public class LWJGLGameWindow {
this.fps = fps;
this.title = title;
MultiPrintStream.makeInstance(new MultiPrintStream("log.txt"));
try {
DisplayMode dm = new DisplayMode(width, height);
Display.setDisplayMode(dm);
createWindow(dm, fullscreen);
Display.setTitle(title);
Display.setFullscreen(fullscreen);
initOpenGl();
run();
} catch (Exception e) {
e.printStackTrace(System.err);
Sys.alert(title, "An error occured and the game will exit.");
} finally {
cleanup();
}
System.exit(0);
}
public void createWindow(DisplayMode dm, boolean fullscreen){
@ -94,6 +79,10 @@ public class LWJGLGameWindow {
Display.setTitle(title);
Display.setFullscreen(fullscreen);
//Display.setVSyncEnabled(true);
// Create the display window
Display.create();
initOpenGl();
run();
@ -114,17 +103,12 @@ public class LWJGLGameWindow {
// grab the mouse, dont want that hideous cursor when we're playing!
Mouse.setGrabbed(false);
// Create the display window
Display.create();
// enable textures since we're going to use these for our sprites
GL11.glEnable(GL11.GL_TEXTURE_2D);
// Enable Smooth Shading
GL11.glShadeModel(GL11.GL_SMOOTH);
// disable the OpenGL depth test since we're rendering 2D graphics
GL11.glDisable(GL11.GL_DEPTH_TEST);
//GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
//GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do
// disable lights (we do not nead them)
GL11.glDisable(GL11.GL_LIGHTING);
// Black Background
@ -168,9 +152,6 @@ public class LWJGLGameWindow {
int frame = 0;
while (!exit) {
timer.startTimer();
// Always call Window.update(), all the time - it does some behind the
// scenes work, and also displays the rendered output
Display.update();
// Check for close requests
if (Display.isCloseRequested()) {

View file

@ -0,0 +1,38 @@
package ei.engine.test;
import ei.engine.LWJGLGameWindow;
import ei.engine.math.Vector2f;
import ei.engine.scene.Box;
public class EngineTest extends LWJGLGameWindow{
private Box box;
private float pos;
public static void main(String[] args){
new EngineTest();
}
public EngineTest() {
super("EngineTest");
}
protected void init(){
box = new Box("lol");
box.setSize(new Vector2f(100,100));
pos = 0;
}
protected void update() {
super.update();
pos += 0.2f;
box.setLocation(new Vector2f(200+pos,200+pos));
box.update();
}
/**
* this method shid be overriden
*/
protected void render(){
box.render();
}
}

View file

@ -25,7 +25,7 @@ public class GameStateTestState extends GameState{
public void init() {
rootNode = new Node("InGameNode");
sprite1 = new Sprite("tank","data/units/tank.png");
sprite1 = new Sprite("tank","data/units/tank/tank0000.png");
//sprite1.setScale(new Vector2f(0.5f,0.5f));
sprite1.setLocation(new Vector3f(400,300,0.2f));
rootNode.add(sprite1);
@ -43,7 +43,7 @@ public class GameStateTestState extends GameState{
p.getLocation().setZ(0.1f);
rootNode.add(p);
sound1 = new Sound("sound","data/sounds/center.wav");
sound1 = new Sound("sound","data/sounds/ei.ogg");
sound1.loop();
sound1.setLocation(sprite1.getLocation());
rootNode.add(sound1);

View file

@ -16,7 +16,7 @@ public class EI extends LWJGLGameWindow{
}
public EI() {
super("EI",60,LWJGLPropertiesDialog.SOW_ALWAYS);
super("EI",60,LWJGLPropertiesDialog.SOW_ONCE);
}
protected void init(){