Begin basic playground code, eventually will become a model viewer

This commit is contained in:
Pazaz 2022-04-25 06:09:02 -04:00
parent 153d8569b5
commit 8fb5b3fc75
10 changed files with 121 additions and 34 deletions

29
playground/build.gradle Normal file
View file

@ -0,0 +1,29 @@
plugins {
id 'java'
id 'application'
}
mainClassName = 'com.itspazaz.rt4.Playground'
version = '1.0.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
dependencies {
compileOnly project(':deob-annotations')
implementation project(':signlink')
implementation project(':client') // TODO: abstract client/engine code
}
jar {
manifest {
attributes 'Main-Class': "$mainClassName"
}
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}

View file

@ -0,0 +1,56 @@
package com.itspazaz.rt4;
import rt4.*;
public class Playground extends GameShell {
public static Playground instance;
public static void main(String[] args) {
instance = new Playground();
instance.startApplication(32, "runescape");
GameShell.frame.setLocation(40, 40);
}
@Override
public void init() {
instance = this;
this.startApplet(32);
}
@Override
protected void mainInit() {
Keyboard.init();
Keyboard.start(GameShell.canvas);
Mouse.start(GameShell.canvas);
SoftwareRaster.frameBuffer.makeTarget();
}
@Override
protected void mainLoop() {
Keyboard.loop();
Mouse.loop();
GameShell.frame.setTitle(Keyboard.pressedKeys[Keyboard.KEY_CTRL] ? "pressed" : "not pressed");
}
@Override
protected void mainRedraw() {
SoftwareRaster.clear();
SoftwareRaster.drawRect(50, 50, 100, 100, 0xFF00FF);
SoftwareRaster.frameBuffer.draw(GameShell.canvas.getGraphics());
}
@Override
protected void mainQuit() {
Keyboard.stop(GameShell.canvas);
Mouse.stop(GameShell.canvas);
Keyboard.quit();
Mouse.quit();
}
@Override
protected void reset() {
}
}