From d65eb10ef10cd2ee88ec92555ac424193ceffa28 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Mon, 23 May 2022 20:18:21 +0000 Subject: [PATCH] Include delta game time in update loop Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 --- bin/RabiClone.jar | Bin 11413 -> 11562 bytes src/sig/RabiClone.java | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/RabiClone.jar b/bin/RabiClone.jar index 5fa5a0aa8b665778e5884d28e80dccb0c16272be..c755515d24b3534664dcb84500a1c1cd8de04fbe 100644 GIT binary patch delta 1493 zcmYk6X;9Nw6vh8xO@JZ|2}?{^A_20L2na#|?Nnq-aexE~5R@Gv+X#r#g3$z`AYlt= zSwtWVWl_MghfP+sh?oW~0;24Z%~%AqD3pxTY2Sx)-+AxMz4y~E-@C>~#f>a02Lr%h zFtA;gqhceoug)b>eXF;xJY^7und})sL4?6BYiMd%u5d5iFwCEVRVavx7!8cP@PUKW zF__5G`$PU+?*uFXA=>F;>?oRv-hG)UR3%-g6pelv+Y`NAK$b$%DWO*H67R&7Y`@y* zY<<1AyWj;7XKdi?>o_fnq)_uuYMVsBTEW?BZI?mRR|mDadqZ=i*%hp#)Oh{nL3ArtCoZikgm`+sEeEMi0!4#r0>oaz->f*^e`7&>cfJDD2iCabq(cf z9>J@{c2H^R6a|W}#%9L1=22vNU?B(WAYOUNRKrG#GMG69)vOZ!SZJM?AxP=Y%Rvzo zLX9o53FAe9BM?FweR>SlJNIm<2?f7;UP*N>m-9_V_@mhp1=%9RI=kGOhKQWE=)A$= zpdDaV2$%8PXMWY>*9quAGVN4KdP%TjKVIv316L7|Ad&P8kc5UVoOTl>XwvW}K>312 z=?v4ZvtB=A>E+Iqn+9qsjXV17?SW4Hjvr~gMu=mB0?w$Uokcv7lvY2Ubni_LCq{BF zWlN#CdNquO?iVCemyVygaye|ZK6`9Dp!Bu(p17Y0d%ma01i&${&Z*CW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oe}!<>6-kNFAqj&9X+FA$bV(snwxUH&Y`KNRw>z@UOJQK zNDc2?6SK9eu1Z|LAy&MwtLTpx`?TkuLryfhJ(!h#^Vy;`cJ+%ZedoMNIQ21PBJY;k zeY!Ja<$hjC+2yNzP&#_8^x0?fzq5Ir%(t%C1{OTt9SXT_xV)W2fe+efmONI1@oSKSNO1RKbOLx>&;L69=*7# z&~q_s&c3F72Uj|G$a@ORP~rKRGNWgiK>n(KtqPLN_hlC<-mQ%D>Zw@Kx2|GAU*4nYW%X|P@26gW@xG?F(Tc79aDZ(6;rsi4 z{uXuXGni$6F!0y4@5m_COIFK*5SwQg-BS_5`B^9t*DK%#nkX*c$C5W1(c}uvs!sl`qsg{M6J#a;i5FTW diff --git a/src/sig/RabiClone.java b/src/sig/RabiClone.java index 0e5bb86..92703c4 100644 --- a/src/sig/RabiClone.java +++ b/src/sig/RabiClone.java @@ -25,10 +25,16 @@ public class RabiClone { f.setVisible(true); p.render(); + + long lastGameTime = System.nanoTime(); while (true) { + long timePassed = System.nanoTime()-lastGameTime; + lastGameTime=System.nanoTime(); + if (KeyHeld(KeyEvent.VK_UP)) { - System.out.println("Up Held: "+UPCOUNT++); + System.out.println("Up Held: "+UPCOUNT+++" (+"+(float)(timePassed/1000000f)+"ms)"); } + } } private static Boolean KeyHeld(int key) {