FIXED streched mode

This commit is contained in:
downthecrop 2024-10-24 12:03:16 -07:00
parent fce9b4eea7
commit 668345b81e
5 changed files with 191 additions and 8 deletions

View file

@ -13,6 +13,7 @@ import rt4.Tile;
*/
public abstract class Plugin {
long timeOfLastDraw;
long timeOfLastLateDraw;
void _init() {
Init();
@ -24,6 +25,12 @@ public abstract class Plugin {
timeOfLastDraw = nowTime;
}
void _lateDraw() {
long nowTime = System.currentTimeMillis();
LateDraw(nowTime - timeOfLastLateDraw);
timeOfLastLateDraw = nowTime;
}
/**
* Draw() is called by the client rendering loop so that plugins can draw information onto the screen.
* This will be called once per frame, meaning it is framerate bound.
@ -31,6 +38,14 @@ public abstract class Plugin {
*/
public void Draw(long timeDelta) {}
/**
* LateDraw() is called at the end of a finalized frame
* This will be called once per frame, meaning it is framerate bound.
* @param timeDelta the time (ms) elapsed since the last draw call.
*/
public void LateDraw(long timeDelta) {}
/**
* Init() is called when the plugin is first loaded
*/

View file

@ -160,6 +160,11 @@ public class PluginRepository {
pluginsSnapshot.forEach(Plugin::_draw);
}
public static void LateDraw() {
List<Plugin> pluginsSnapshot = new ArrayList<>(loadedPlugins.values());
pluginsSnapshot.forEach(Plugin::_lateDraw);
}
public static void NPCOverheadDraw(Npc npc, int screenX, int screenY) {
loadedPlugins.values().forEach((plugin) -> plugin.NPCOverheadDraw(npc, screenX, screenY));
}

View file

@ -12,7 +12,7 @@ import java.awt.*;
public abstract class FrameBuffer {
@OriginalMember(owner = "client!vk", name = "e", descriptor = "[I")
protected int[] pixels;
public int[] pixels;
@OriginalMember(owner = "client!vk", name = "g", descriptor = "Ljava/awt/Image;")
protected Image image;

View file

@ -921,6 +921,7 @@ public final class client extends GameShell {
Preferences.safeMode = false;
Preferences.write(GameShell.signLink);
}
PluginRepository.LateDraw();
}
@OriginalMember(owner = "client!client", name = "c", descriptor = "(B)V")