44import net .lax1dude .eaglercraft .internal .PlatformOpenGL ;
55import net .lax1dude .eaglercraft .internal .PlatformRuntime ;
66import net .lax1dude .eaglercraft .internal .vfs2 .VFile2 ;
7+ import net .lax1dude .eaglercraft .opengl .EaglercraftGPU ;
78import net .lax1dude .eaglercraft .opengl .GlStateManager ;
89import net .lax1dude .eaglercraft .profile .GuiScreenEditProfile ;
910import net .minecraft .src .AchievementList ;
@@ -106,7 +107,6 @@ public class Minecraft implements Runnable {
106107 public static byte [] field_28006_b = new byte [10485760 ];
107108 private static Minecraft theMinecraft ;
108109 public PlayerController playerController ;
109- private boolean fullscreen = false ;
110110 private boolean hasCrashed = false ;
111111 public int displayWidth ;
112112 public int displayHeight ;
@@ -152,7 +152,7 @@ public class Minecraft implements Runnable {
152152 long prevFrameTime = -1L ;
153153 public boolean inGameHasFocus = false ;
154154 public boolean isRaining = false ;
155- long systemTime = System . currentTimeMillis ();
155+ long systemTime = EagRuntime . steadyTimeMillis ();
156156 private int joinPlayerCounter = 0 ;
157157
158158 private String serverIP ;
@@ -162,7 +162,6 @@ public Minecraft() {
162162 StatList .func_27360_a ();
163163 this .displayWidth = Display .getWidth ();
164164 this .displayHeight = Display .getHeight ();
165- this .fullscreen = false ;
166165
167166 this .session = new Session ("Player" , "" );
168167 theMinecraft = this ;
@@ -277,7 +276,8 @@ private void loadScreen() throws LWJGLException {
277276 GL11 .glDisable (GL11 .GL_FOG );
278277 GL11 .glBindTexture (GL11 .GL_TEXTURE_2D , this .renderEngine .getTexture ("/title/mojang.png" ));
279278 var2 .startDrawingQuads ();
280- var2 .setColorOpaque_I (16777215 );
279+ // var2.setColorOpaque_I(16777215);
280+ var2 .setColorRGBA (255 , 255 , 255 , 255 );
281281 var2 .addVertexWithUV (0.0D , (double ) this .displayHeight , 0.0D , 0.0D , 0.0D );
282282 var2 .addVertexWithUV ((double ) this .displayWidth , (double ) this .displayHeight , 0.0D , 0.0D , 0.0D );
283283 var2 .addVertexWithUV ((double ) this .displayWidth , 0.0D , 0.0D , 0.0D , 0.0D );
@@ -290,8 +290,9 @@ private void loadScreen() throws LWJGLException {
290290 this .scaledTessellator ((var1 .getScaledWidth () - var3 ) / 2 , (var1 .getScaledHeight () - var4 ) / 2 , 0 , 0 , var3 , var4 );
291291 GL11 .glDisable (GL11 .GL_LIGHTING );
292292 GL11 .glDisable (GL11 .GL_FOG );
293- GL11 .glEnable (GL11 .GL_ALPHA_TEST );
293+ GL11 .glEnable (GL11 .GL_ALPHA );
294294 GL11 .glAlphaFunc (GL11 .GL_GREATER , 0.1F );
295+ Display .update ();
295296 }
296297
297298 public void scaledTessellator (int var1 , int var2 , int var3 , int var4 , int var5 , int var6 ) {
@@ -423,16 +424,15 @@ public void run() {
423424 }
424425
425426 try {
426- long var1 = System . currentTimeMillis ();
427+ long var1 = EagRuntime . steadyTimeMillis ();
427428 int var3 = 0 ;
428429
429430 while (this .running ) {
430431 try {
431432 AxisAlignedBB .clearBoundingBoxPool ();
432433 Vec3D .initialize ();
433- if (Display .isCloseRequested ()) {
434- this .shutdown ();
435- }
434+
435+ Display .checkContextLost ();
436436
437437 if (this .isGamePaused && this .theWorld != null ) {
438438 float var4 = this .timer .renderPartialTicks ;
@@ -442,7 +442,7 @@ public void run() {
442442 this .timer .updateTimer ();
443443 }
444444
445- long var23 = System .nanoTime ();
445+ long var23 = EagRuntime .nanoTime ();
446446
447447 for (int var6 = 0 ; var6 < this .timer .elapsedTicks ; ++var6 ) {
448448 ++this .ticksRan ;
@@ -456,10 +456,15 @@ public void run() {
456456 }
457457 }
458458
459- long var24 = System .nanoTime () - var23 ;
459+ long var24 = EagRuntime .nanoTime () - var23 ;
460460 this .checkGLError ("Pre render" );
461461 RenderBlocks .fancyGrass = this .gameSettings .fancyGrass ;
462462 this .sndManager .func_338_a (this .thePlayer , this .timer .renderPartialTicks );
463+ EaglercraftGPU .optimize ();
464+ PlatformOpenGL ._wglBindFramebuffer (0x8D40 , null );
465+ GL11 .glViewport (0 , 0 , this .displayWidth , this .displayHeight );
466+ GL11 .glClearColor (0.0f , 0.0f , 0.0f , 1.0f );
467+ GL11 .glPushMatrix ();
463468 GL11 .glEnable (GL11 .GL_TEXTURE_2D );
464469 if (this .theWorld != null ) {
465470 this .theWorld .updatingLighting ();
@@ -477,14 +482,12 @@ public void run() {
477482 this .entityRenderer .updateCameraAndRender (this .timer .renderPartialTicks );
478483 }
479484
480- if (!Display .isActive () && this .fullscreen ) {
481- this .toggleFullscreen ();
482- }
485+ GL11 .glPopMatrix ();
483486
484487 if (this .gameSettings .showDebugInfo ) {
485488 this .displayDebugInfo (var24 );
486489 } else {
487- this .prevFrameTime = System .nanoTime ();
490+ this .prevFrameTime = EagRuntime .nanoTime ();
488491 }
489492
490493 this .guiAchievement .updateAchievementWindow ();
@@ -496,7 +499,7 @@ public void run() {
496499 ++var3 ;
497500
498501 for (this .isGamePaused = !this .isMultiplayerWorld () && this .currentScreen != null
499- && this .currentScreen .doesGuiPauseGame (); System . currentTimeMillis () >= var1 + 1000L ; var3 = 0 ) {
502+ && this .currentScreen .doesGuiPauseGame (); EagRuntime . steadyTimeMillis () >= var1 + 1000L ; var3 = 0 ) {
500503 this .debug = var3 + " fps, " + WorldRenderer .chunksUpdated + " chunk updates" ;
501504 this .fps = var3 ;
502505 WorldRenderer .chunksUpdated = 0 ;
@@ -562,10 +565,10 @@ private void screenshotListener() {
562565 private void displayDebugInfo (long var1 ) {
563566 long var3 = 16666666L ;
564567 if (this .prevFrameTime == -1L ) {
565- this .prevFrameTime = System .nanoTime ();
568+ this .prevFrameTime = EagRuntime .nanoTime ();
566569 }
567570
568- long var5 = System .nanoTime ();
571+ long var5 = EagRuntime .nanoTime ();
569572 tickTimes [numRecordedFrameTimes & frameTimes .length - 1 ] = var1 ;
570573 frameTimes [numRecordedFrameTimes ++ & frameTimes .length - 1 ] = var5 - this .prevFrameTime ;
571574 this .prevFrameTime = var5 ;
@@ -853,7 +856,7 @@ public void runTick() {
853856 KeyBinding .func_35960_a (Mouse .getEventButton () - 100 );
854857 }
855858
856- long var5 = System . currentTimeMillis () - this .systemTime ;
859+ long var5 = EagRuntime . steadyTimeMillis () - this .systemTime ;
857860 if (var5 <= 200L ) {
858861 var3 = Mouse .getEventDWheel ();
859862 if (var3 != 0 ) {
@@ -1028,7 +1031,7 @@ public void runTick() {
10281031 }
10291032 }
10301033
1031- this .systemTime = System . currentTimeMillis ();
1034+ this .systemTime = EagRuntime . steadyTimeMillis ();
10321035 }
10331036
10341037 private void forceReload () {
0 commit comments