|
|
@ -375,8 +375,12 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Draw(int index, int col) { |
|
|
|
void Draw(int index, int col) { |
|
|
|
|
|
|
|
if (((col>>>24)&0xff)!=255) { |
|
|
|
|
|
|
|
pixel[index]=ColorLerpNoAlpha(new Color(pixel[index]),new Color(col),((col>>>24)&0xff)/255f).getColor(); |
|
|
|
|
|
|
|
} else { |
|
|
|
pixel[index]=col; |
|
|
|
pixel[index]=col; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
@ -536,33 +540,36 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Sprite(double x, double y, Sprite sprite){ |
|
|
|
public void Draw_Sprite(double x, double y, Sprite sprite){ |
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0,Transform.NONE ); |
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0,Color.WHITE,Transform.NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Animated_Sprite(double x, double y, AnimatedSprite sprite, double frameIndex){ |
|
|
|
public void Draw_Animated_Sprite(double x, double y, AnimatedSprite sprite, double frameIndex){ |
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
Draw_Sprite_Partial(x,y,frameRectangle.getX(),frameRectangle.getY(),frameRectangle.getWidth(),frameRectangle.getHeight(),sprite,frameIndex,Transform.NONE); |
|
|
|
Draw_Sprite_Partial(x,y,frameRectangle.getX(),frameRectangle.getY(),frameRectangle.getWidth(),frameRectangle.getHeight(),sprite,frameIndex,Color.WHITE,Transform.NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Sprite(double x, double y, Sprite sprite, Color col){ |
|
|
|
|
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0,col,Transform.NONE); |
|
|
|
|
|
|
|
} |
|
|
|
public void Draw_Sprite(double x, double y, Sprite sprite, Transform transform){ |
|
|
|
public void Draw_Sprite(double x, double y, Sprite sprite, Transform transform){ |
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0,transform); |
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0,Color.WHITE,transform); |
|
|
|
} |
|
|
|
} |
|
|
|
public void Draw_Animated_Sprite(double x, double y, AnimatedSprite sprite, double frameIndex, Transform transform){ |
|
|
|
public void Draw_Animated_Sprite(double x, double y, AnimatedSprite sprite, double frameIndex, Color col, Transform transform){ |
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
Draw_Sprite_Partial(x,y,frameRectangle.getX(),frameRectangle.getY(),frameRectangle.getWidth(),frameRectangle.getHeight(),sprite,frameIndex, transform); |
|
|
|
Draw_Sprite_Partial(x,y,frameRectangle.getX(),frameRectangle.getY(),frameRectangle.getWidth(),frameRectangle.getHeight(),sprite,frameIndex,col,transform); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Sprite_Partial(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Transform transform){ |
|
|
|
public void Draw_Sprite_Partial(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Color col, Transform transform){ |
|
|
|
Draw_Sprite_Partial_Ext(x,y,xOffset,yOffset,w,h,sprite,frame_index, Color.WHITE,transform); |
|
|
|
Draw_Sprite_Partial_Ext(x,y,xOffset,yOffset,w,h,sprite,frame_index, col,transform); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, Transform transform){ |
|
|
|
public void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, Color col, Transform transform){ |
|
|
|
Draw_Sprite_Partial_Ext(x, y, xOffset, yOffset, w, h, sprite, 0, Color.WHITE, transform); |
|
|
|
Draw_Sprite_Partial_Ext(x, y, xOffset, yOffset, w, h, sprite, 0, col, transform); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Animated_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, AnimatedSprite sprite, double frameIndex, Transform transform){ |
|
|
|
public void Draw_Animated_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, AnimatedSprite sprite, double frameIndex, Color col, Transform transform){ |
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
Draw_Sprite_Partial_Ext(x, y, frameRectangle.getX(), frameRectangle.getY(), frameRectangle.getWidth(), frameRectangle.getHeight(), sprite, 0, Color.WHITE, transform); |
|
|
|
Draw_Sprite_Partial_Ext(x, y, frameRectangle.getX(), frameRectangle.getY(), frameRectangle.getWidth(), frameRectangle.getHeight(), sprite, 0, col, transform); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Color col, Transform transform){ |
|
|
|
public void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Color col, Transform transform){ |
|
|
@ -585,7 +592,17 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
if (((sprite.getImg().getRGB(X,Y)>>>24)&0xFF)==0||index<0||index>=pixel.length) { |
|
|
|
if (((sprite.getImg().getRGB(X,Y)>>>24)&0xFF)==0||index<0||index>=pixel.length) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Draw(index,(col==Color.WHITE)?sprite.getImg().getRGB(X,Y):col.getColor()); |
|
|
|
if (col==Color.WHITE) { |
|
|
|
|
|
|
|
Draw(index,sprite.getImg().getRGB(X,Y)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Color img = new Color(sprite.getImg().getRGB(X,Y)); |
|
|
|
|
|
|
|
Draw(index,new Color( |
|
|
|
|
|
|
|
(int)Math.min(255.0f,Math.max(0,(float)img.r * col.r / 255.0f)), |
|
|
|
|
|
|
|
(int)Math.min(255.0f,Math.max(0,(float)img.g * col.g / 255.0f)), |
|
|
|
|
|
|
|
(int)Math.min(255.0f,Math.max(0,(float)img.b * col.b / 255.0f)), |
|
|
|
|
|
|
|
(int)Math.min(255.0f,Math.max(0,(float)img.a * col.a / 255.0f))).getColor() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -994,6 +1011,10 @@ public class Panel extends JPanel implements Runnable,KeyListener { |
|
|
|
{ return new Color((int)((c2.r * t) + c1.r * (1.0f - t)),(int)((c2.g * t) + c1.g * (1.0f - t)),(int)((c2.b * t) + c1.b * (1.0f - t)),(int)((c2.a * t) + c1.a * (1.0f - t))); } |
|
|
|
{ return new Color((int)((c2.r * t) + c1.r * (1.0f - t)),(int)((c2.g * t) + c1.g * (1.0f - t)),(int)((c2.b * t) + c1.b * (1.0f - t)),(int)((c2.a * t) + c1.a * (1.0f - t))); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Color ColorLerpNoAlpha(Color c1, Color c2, float t) |
|
|
|
|
|
|
|
{ return new Color((int)((c2.r * t) + c1.r * (1.0f - t)),(int)((c2.g * t) + c1.g * (1.0f - t)),(int)((c2.b * t) + c1.b * (1.0f - t))); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Clear(Color col){ |
|
|
|
public void Clear(Color col){ |
|
|
|
for (int y=0;y<JavaProjectTemplate.WINDOW_HEIGHT;y++) { |
|
|
|
for (int y=0;y<JavaProjectTemplate.WINDOW_HEIGHT;y++) { |
|
|
|
for (int x=0;x<JavaProjectTemplate.WINDOW_WIDTH;x++) { |
|
|
|
for (int x=0;x<JavaProjectTemplate.WINDOW_WIDTH;x++) { |
|
|
|