From ea6c725facd8ab6bedb9024df53b6f5d9ea111a4 Mon Sep 17 00:00:00 2001 From: atsb <44937323+atsb@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:45:13 +0200 Subject: [PATCH] Frametime graph is better 1. Fixes cursors for TekWar (Da best game) ;) 2. Fixes frametimes for VSync'd settings and small micro stutters 3. Changes framerate caps to be multiples so that the cap matches popular gaming monitor refresh rates 4. Removed the stupid sleeps.. really.. wtf were you thinking? 5. Removed the update text.. that's just bloat. Want an update, visit my github, it isn't rocket science. --- README.md | 2 +- .../Build/Architecture/BuildFrame.java | 6 +---- .../Build/Settings/BuildSettings.java | 2 +- .../Build/desktop/AWT/AWTMouse.java | 5 ++-- .../Build/desktop/DesktopMessage.java | 23 ------------------- .../m210projects/Launcher/desktop/Main.java | 2 +- .../m210projects/Tekwar/Screens/SmkMenu.java | 2 +- 7 files changed, 8 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 501944f..a311d2a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ NuBuildGDX is a fork of BuildGDX aiming for stability, bug fixing and performanc My goal is to get it in good shape for long term availability and support. I will also be personally maintaining some dependencies for this as some parts are very deeply intertwined with API versions and I don't trust upstream projects to not keep changing API's every release they do. -For renderer's, the PolyGDX and Classic ones will be removed. PolyGDX's performance is atrocious and Classic is basically unplayable due to its poor frametime graph (many micro stutters). Polymost is the best, smoothest and to be honest, the only one you should be using. +For renderer's, the PolyGDX will be removed. There is nothing wrong with Polymost, it is tried and tested. # Summary Reduce the bloat, increase the stability.. basically. diff --git a/src/ru/m210projects/Build/Architecture/BuildFrame.java b/src/ru/m210projects/Build/Architecture/BuildFrame.java index bec3e5c..8f6649b 100644 --- a/src/ru/m210projects/Build/Architecture/BuildFrame.java +++ b/src/ru/m210projects/Build/Architecture/BuildFrame.java @@ -120,12 +120,8 @@ public boolean process(boolean shouldRender) { if (shouldRender) { graphics.updateTime(); graphics.frameId++; - } else { - // Sleeps to avoid wasting CPU in an empty loop. - if (frameRate == -1) frameRate = 10; - if (frameRate == 0) frameRate = getConfig().backgroundFPS; - if (frameRate == 0) frameRate = 30; } + if (frameRate > 0) graphics.sync(frameRate); return shouldRender; diff --git a/src/ru/m210projects/Build/Settings/BuildSettings.java b/src/ru/m210projects/Build/Settings/BuildSettings.java index 5d90e50..2d58a8c 100644 --- a/src/ru/m210projects/Build/Settings/BuildSettings.java +++ b/src/ru/m210projects/Build/Settings/BuildSettings.java @@ -14,7 +14,7 @@ public class BuildSettings { public static BuildVariable vsync; public static BuildVariable paletteGamma; - public static final Integer[] fpslimits = { 0, 30, 60, 120, 144, 200, 250, 300 }; + public static final Integer[] fpslimits = { 0, 30, 60, 120, 144, 240, 320, 480}; public static void init(final Engine engine, final BuildConfig cfg) { diff --git a/src/ru/m210projects/Build/desktop/AWT/AWTMouse.java b/src/ru/m210projects/Build/desktop/AWT/AWTMouse.java index d5dbb09..d202aba 100644 --- a/src/ru/m210projects/Build/desktop/AWT/AWTMouse.java +++ b/src/ru/m210projects/Build/desktop/AWT/AWTMouse.java @@ -42,7 +42,7 @@ public class AWTMouse implements MouseMotionListener, MouseListener, MouseWheelListener, MouseInterface { - class TouchEvent { + static class TouchEvent { static final int TOUCH_DOWN = 0; static final int TOUCH_UP = 1; static final int TOUCH_DRAGGED = 2; @@ -88,7 +88,7 @@ public AWTMouse(JDisplay display) { try { robot = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()); - } catch (Exception e) {} + } catch (Exception ignored) {} this.display = display; Canvas canvas = display.getCanvas(); @@ -97,6 +97,7 @@ public AWTMouse(JDisplay display) canvas.removeMouseMotionListener(this); canvas.removeMouseWheelListener(this); } + assert canvas != null; canvas.addMouseListener(this); canvas.addMouseMotionListener(this); canvas.addMouseWheelListener(this); diff --git a/src/ru/m210projects/Build/desktop/DesktopMessage.java b/src/ru/m210projects/Build/desktop/DesktopMessage.java index d127e0c..4016476 100644 --- a/src/ru/m210projects/Build/desktop/DesktopMessage.java +++ b/src/ru/m210projects/Build/desktop/DesktopMessage.java @@ -46,23 +46,6 @@ public synchronized boolean show(String header, String message, MessageType type return false; BuildGdx.input.setCursorCatched(false); - if(message.length() >= 384) - { - message = message.substring(0, 384); - message += "..."; - } - -// DisplayMode fullscreen = null; -// if(BuildGdx.graphics != null && BuildGdx.graphics.isFullscreen()) { -// fullscreen = BuildGdx.graphics.getDisplayMode(); -// BuildGdx.graphics.setWindowedMode(BuildGdx.graphics.getWidth(), BuildGdx.graphics.getHeight()); -// } - - if(update) - { - message = "You are using the old version of BuildGdx and have to update it! \r\n \r\n \r\n" + message; - type = MessageType.Info; - } switch(type) { @@ -74,9 +57,6 @@ public synchronized boolean show(String header, String message, MessageType type ShowPanel(JOptionPane.INFORMATION_MESSAGE, JOptionPane.YES_NO_OPTION, header, message); } -// if(fullscreen != null) -// BuildGdx.graphics.setFullscreenMode(fullscreen); - Object selectedValue = panel.getValue(); if (selectedValue instanceof Integer) { if(((Integer)selectedValue).intValue() == JOptionPane.YES_OPTION) @@ -86,9 +66,6 @@ public synchronized boolean show(String header, String message, MessageType type return false; case Info: ShowPanel(JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, header, message); -// if(fullscreen != null) -// BuildGdx.graphics.setFullscreenMode(fullscreen); - return false; } diff --git a/src/ru/m210projects/Launcher/desktop/Main.java b/src/ru/m210projects/Launcher/desktop/Main.java index ead9529..869c4e0 100644 --- a/src/ru/m210projects/Launcher/desktop/Main.java +++ b/src/ru/m210projects/Launcher/desktop/Main.java @@ -56,7 +56,7 @@ public class Main { - public static String appversion = "v1.18"; + public static String appversion = "v1.18.1"; public static final String headerPath = "Headers"; public static final String iconPath = "Games"; public static final Platform platform = getPlatform(); diff --git a/src/ru/m210projects/Tekwar/Screens/SmkMenu.java b/src/ru/m210projects/Tekwar/Screens/SmkMenu.java index 9c55b15..6bd816a 100644 --- a/src/ru/m210projects/Tekwar/Screens/SmkMenu.java +++ b/src/ru/m210projects/Tekwar/Screens/SmkMenu.java @@ -91,7 +91,7 @@ public synchronized void show() { helpclock = 0; message = MessageType.NONE; - BuildGdx.input.setCursorCatched(false); + BuildGdx.input.setCursorCatched(true); game.pInput.ctrlResetKeyStatus(); init(init()); }