Implement profiling on scaling image up, fix missing null when loading map

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago committed by GitHub
parent 14bfa6347f
commit 6790816a3a
  1. BIN
      bin/RabiClone.jar
  2. 1
      src/sig/RabiClone.java
  3. 2
      src/sig/engine/Panel.java
  4. 2
      src/sig/map/Map.java
  5. 2
      src/sig/objects/LevelRenderer.java
  6. 4
      src/sig/objects/Player.java

Binary file not shown.

@ -60,6 +60,7 @@ public class RabiClone {
final static long TARGET_FRAMETIME = 8333333l;
static long lastReportedTime = System.currentTimeMillis();
public static long TIME = 0;
public static long scaleTime;
public static void main(String[] args) {
System.setProperty("sun.java2d.transaccel", "True");

@ -197,7 +197,9 @@ public class Panel extends JPanel implements Runnable,KeyListener {
public void paintComponent(Graphics g) {
//super.paintComponent(g);
// perform draws on pixels
long startTime = System.currentTimeMillis();
g.drawImage(this.imageBuffer,0,0,getWidth(),getHeight(),0,0,RabiClone.BASE_WIDTH,RabiClone.BASE_HEIGHT,this);
RabiClone.scaleTime=System.currentTimeMillis()-startTime;
}
/**

@ -48,12 +48,14 @@ public class Map {
public static Map LoadMap(Maps map) {
try {
if (RabiClone.CURRENT_MAP!=null) {
if (RabiClone.CURRENT_MAP!=map) {
resetMapData(RabiClone.CURRENT_MAP.getMap());
} else {
resetAndReloadEventData(RabiClone.CURRENT_MAP);
return RabiClone.CURRENT_MAP.getMap();
}
}
RabiClone.CURRENT_MAP=map;
Map newMap = RabiClone.CURRENT_MAP.getMap()!=null?RabiClone.CURRENT_MAP.getMap():new Map();
DataInputStream stream = new DataInputStream(new FileInputStream(map.getFile()));

@ -44,7 +44,7 @@ public class LevelRenderer extends Object{
if (RabiClone.player!=null) {
Draw_Animated_Object(RabiClone.player,RabiClone.player.facing_direction?Transform.HORIZONTAL:Transform.NONE);
Draw_Text(4,4,new String(RabiClone.player.y_velocity),Font.PROFONT_12);
Draw_Text(4,4+Font.PROFONT_12.getGlyphHeight(),new String(RabiClone.player.slide_time3),Font.PROFONT_12);
Draw_Text(4,4+Font.PROFONT_12.getGlyphHeight(),new String(RabiClone.scaleTime),Font.PROFONT_12);
}
}

@ -59,8 +59,6 @@ public class Player extends AnimatedObject implements CollisionEntity {
long spacebarPressed = RabiClone.TIME;
long jump_slide_fall_StartAnimationTimer = -1;
long slide_time = -1;
long slide_time2 = -1;
long slide_time3 = 0;
long jumpHoldTime = TimeUtils.millisToNanos(150);
final static long slideBufferTime = TimeUtils.millisToNanos(200);
@ -144,7 +142,6 @@ public class Player extends AnimatedObject implements CollisionEntity {
facing_direction = RIGHT;
}
state = State.IDLE;
slide_time3 = (System.nanoTime() - slide_time2);
}
if (KeyHeld(Action.MOVE_LEFT) && !KeyHeld(Action.MOVE_RIGHT)) {
if (facing_direction == LEFT && x_velocity > -sliding_velocity * 1.5 ||
@ -244,7 +241,6 @@ public class Player extends AnimatedObject implements CollisionEntity {
private void performSlide() {
slide_time = RabiClone.TIME;
slide_time2 = System.nanoTime();
if (facing_direction) {
x_velocity = sliding_velocity;
} else {

Loading…
Cancel
Save