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>
This commit is contained in:
parent
14bfa6347f
commit
6790816a3a
Binary file not shown.
@ -60,6 +60,7 @@ public class RabiClone {
|
|||||||
final static long TARGET_FRAMETIME = 8333333l;
|
final static long TARGET_FRAMETIME = 8333333l;
|
||||||
static long lastReportedTime = System.currentTimeMillis();
|
static long lastReportedTime = System.currentTimeMillis();
|
||||||
public static long TIME = 0;
|
public static long TIME = 0;
|
||||||
|
public static long scaleTime;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.setProperty("sun.java2d.transaccel", "True");
|
System.setProperty("sun.java2d.transaccel", "True");
|
||||||
|
@ -197,7 +197,9 @@ public class Panel extends JPanel implements Runnable,KeyListener {
|
|||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
//super.paintComponent(g);
|
//super.paintComponent(g);
|
||||||
// perform draws on pixels
|
// 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);
|
g.drawImage(this.imageBuffer,0,0,getWidth(),getHeight(),0,0,RabiClone.BASE_WIDTH,RabiClone.BASE_HEIGHT,this);
|
||||||
|
RabiClone.scaleTime=System.currentTimeMillis()-startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,11 +48,13 @@ public class Map {
|
|||||||
|
|
||||||
public static Map LoadMap(Maps map) {
|
public static Map LoadMap(Maps map) {
|
||||||
try {
|
try {
|
||||||
if (RabiClone.CURRENT_MAP!=map) {
|
if (RabiClone.CURRENT_MAP!=null) {
|
||||||
resetMapData(RabiClone.CURRENT_MAP.getMap());
|
if (RabiClone.CURRENT_MAP!=map) {
|
||||||
} else {
|
resetMapData(RabiClone.CURRENT_MAP.getMap());
|
||||||
resetAndReloadEventData(RabiClone.CURRENT_MAP);
|
} else {
|
||||||
return RabiClone.CURRENT_MAP.getMap();
|
resetAndReloadEventData(RabiClone.CURRENT_MAP);
|
||||||
|
return RabiClone.CURRENT_MAP.getMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RabiClone.CURRENT_MAP=map;
|
RabiClone.CURRENT_MAP=map;
|
||||||
Map newMap = RabiClone.CURRENT_MAP.getMap()!=null?RabiClone.CURRENT_MAP.getMap():new Map();
|
Map newMap = RabiClone.CURRENT_MAP.getMap()!=null?RabiClone.CURRENT_MAP.getMap():new Map();
|
||||||
|
@ -44,7 +44,7 @@ public class LevelRenderer extends Object{
|
|||||||
if (RabiClone.player!=null) {
|
if (RabiClone.player!=null) {
|
||||||
Draw_Animated_Object(RabiClone.player,RabiClone.player.facing_direction?Transform.HORIZONTAL:Transform.NONE);
|
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,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 spacebarPressed = RabiClone.TIME;
|
||||||
long jump_slide_fall_StartAnimationTimer = -1;
|
long jump_slide_fall_StartAnimationTimer = -1;
|
||||||
long slide_time = -1;
|
long slide_time = -1;
|
||||||
long slide_time2 = -1;
|
|
||||||
long slide_time3 = 0;
|
|
||||||
long jumpHoldTime = TimeUtils.millisToNanos(150);
|
long jumpHoldTime = TimeUtils.millisToNanos(150);
|
||||||
|
|
||||||
final static long slideBufferTime = TimeUtils.millisToNanos(200);
|
final static long slideBufferTime = TimeUtils.millisToNanos(200);
|
||||||
@ -144,7 +142,6 @@ public class Player extends AnimatedObject implements CollisionEntity {
|
|||||||
facing_direction = RIGHT;
|
facing_direction = RIGHT;
|
||||||
}
|
}
|
||||||
state = State.IDLE;
|
state = State.IDLE;
|
||||||
slide_time3 = (System.nanoTime() - slide_time2);
|
|
||||||
}
|
}
|
||||||
if (KeyHeld(Action.MOVE_LEFT) && !KeyHeld(Action.MOVE_RIGHT)) {
|
if (KeyHeld(Action.MOVE_LEFT) && !KeyHeld(Action.MOVE_RIGHT)) {
|
||||||
if (facing_direction == LEFT && x_velocity > -sliding_velocity * 1.5 ||
|
if (facing_direction == LEFT && x_velocity > -sliding_velocity * 1.5 ||
|
||||||
@ -244,7 +241,6 @@ public class Player extends AnimatedObject implements CollisionEntity {
|
|||||||
|
|
||||||
private void performSlide() {
|
private void performSlide() {
|
||||||
slide_time = RabiClone.TIME;
|
slide_time = RabiClone.TIME;
|
||||||
slide_time2 = System.nanoTime();
|
|
||||||
if (facing_direction) {
|
if (facing_direction) {
|
||||||
x_velocity = sliding_velocity;
|
x_velocity = sliding_velocity;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user