Add drawing color options for sprites
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
5e1f69a9d0
commit
6a418eb9db
BIN
PaletteReference.png
Normal file
BIN
PaletteReference.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
@ -28,3 +28,4 @@ Configuration is modified at the top of the script file while the command list i
|
|||||||
|
|
||||||
Mizue (みずえ) 水恵
|
Mizue (みずえ) 水恵
|
||||||
Turn off inline hints: (F1, search "Preferences: Open Settings (JSON)) "editor.inlayHints.enabled": false
|
Turn off inline hints: (F1, search "Preferences: Open Settings (JSON)) "editor.inlayHints.enabled": false
|
||||||
|
Profont: 7x14 per tile.
|
BIN
sprites/Profont.gif
Normal file
BIN
sprites/Profont.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -1,6 +1,7 @@
|
|||||||
package sig;
|
package sig;
|
||||||
|
|
||||||
import sig.engine.Alpha;
|
import sig.engine.Alpha;
|
||||||
|
import sig.engine.PaletteColor;
|
||||||
import sig.engine.Panel;
|
import sig.engine.Panel;
|
||||||
import sig.engine.Sprite;
|
import sig.engine.Sprite;
|
||||||
|
|
||||||
@ -49,6 +50,10 @@ public class DrawLoop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, Alpha alpha){
|
public static void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, Alpha alpha){
|
||||||
|
Draw_Sprite_Partial_Ext(x, y, xOffset, yOffset, w, h, sprite, alpha, PaletteColor.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, Alpha alpha, PaletteColor col){
|
||||||
byte[] p = panel.pixel;
|
byte[] p = panel.pixel;
|
||||||
for(int X=(int)xOffset;X<(int)(w+xOffset);X++){
|
for(int X=(int)xOffset;X<(int)(w+xOffset);X++){
|
||||||
for(int Y=(int)yOffset;Y<(int)(h+yOffset);Y++){
|
for(int Y=(int)yOffset;Y<(int)(h+yOffset);Y++){
|
||||||
@ -59,7 +64,7 @@ public class DrawLoop {
|
|||||||
if (index<0||index>=p.length||sprite.getBi_array()[Y*sprite.getWidth()+X]==32||p[index]==sprite.getBi_array()[Y*sprite.getWidth()+X]) {
|
if (index<0||index>=p.length||sprite.getBi_array()[Y*sprite.getWidth()+X]==32||p[index]==sprite.getBi_array()[Y*sprite.getWidth()+X]) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
Draw(p,index,sprite.getBi_array()[Y*sprite.getWidth()+X],alpha);
|
Draw(p,index,col==PaletteColor.NORMAL?sprite.getBi_array()[Y*sprite.getWidth()+X]:(byte)col.ordinal(),alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,10 @@ public abstract class Object implements GameEntity{
|
|||||||
DrawLoop.Draw_Sprite_Partial_Ext(x,y,xOffset,yOffset,w,h,sprite,alpha);
|
DrawLoop.Draw_Sprite_Partial_Ext(x,y,xOffset,yOffset,w,h,sprite,alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, Alpha alpha, PaletteColor col){
|
||||||
|
DrawLoop.Draw_Sprite_Partial_Ext(x,y,xOffset,yOffset,w,h,sprite,alpha,col);
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean KeyHeld(int key) {
|
protected boolean KeyHeld(int key) {
|
||||||
return panel.KEYS.getOrDefault(key,false);
|
return panel.KEYS.getOrDefault(key,false);
|
||||||
}
|
}
|
||||||
|
37
src/sig/engine/PaletteColor.java
Normal file
37
src/sig/engine/PaletteColor.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package sig.engine;
|
||||||
|
|
||||||
|
public enum PaletteColor {
|
||||||
|
EMERALD,
|
||||||
|
MANTIS,
|
||||||
|
YELLOW_GREEN,
|
||||||
|
YELLOW,
|
||||||
|
PEACH,
|
||||||
|
ORANGE,
|
||||||
|
CRIMSON,
|
||||||
|
RED,
|
||||||
|
PLUM,
|
||||||
|
VIOLET,
|
||||||
|
BYZANTIUM,
|
||||||
|
DEEP_RUBY,
|
||||||
|
PUCE,
|
||||||
|
OLD_ROSE,
|
||||||
|
MELON,
|
||||||
|
LIGHT_HOT_PINK,
|
||||||
|
PERSIAN_PINK,
|
||||||
|
SKY_MAGENTA,
|
||||||
|
RAZZMIC_BERRY,
|
||||||
|
BLACK,
|
||||||
|
JAPANESE_VIOLET,
|
||||||
|
FRENCH_LILAC,
|
||||||
|
AMETHYST,
|
||||||
|
ORCHID_PINK,
|
||||||
|
WHITE,
|
||||||
|
FRESH_AIR,
|
||||||
|
SKY_BLUE,
|
||||||
|
AZURE,
|
||||||
|
SLATE_BLUE,
|
||||||
|
DARK_ORCHID,
|
||||||
|
GRAPE,
|
||||||
|
MIDNIGHT_BLUE,
|
||||||
|
NORMAL;
|
||||||
|
}
|
@ -13,6 +13,7 @@ public enum Sprite{
|
|||||||
NANA_SMALL(new File(new File("..","sprites"),"1x.gif")),
|
NANA_SMALL(new File(new File("..","sprites"),"1x.gif")),
|
||||||
TILE_SHEET(new File(new File("..","sprites"),"tiles.gif")),
|
TILE_SHEET(new File(new File("..","sprites"),"tiles.gif")),
|
||||||
MAP_TILE_INFO(new File(new File("..","sprites"),"maptileinfo.gif")),
|
MAP_TILE_INFO(new File(new File("..","sprites"),"maptileinfo.gif")),
|
||||||
|
PROFONT(new File(new File("..","sprites"),"Profont.gif")),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import java.awt.event.MouseEvent;
|
|||||||
import sig.RabiClone;
|
import sig.RabiClone;
|
||||||
import sig.engine.Alpha;
|
import sig.engine.Alpha;
|
||||||
import sig.engine.MouseScrollValue;
|
import sig.engine.MouseScrollValue;
|
||||||
|
import sig.engine.PaletteColor;
|
||||||
import sig.engine.Panel;
|
import sig.engine.Panel;
|
||||||
import sig.engine.Sprite;
|
import sig.engine.Sprite;
|
||||||
import sig.map.Map;
|
import sig.map.Map;
|
||||||
@ -58,7 +59,7 @@ public class EditorRenderer extends LevelRenderer{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(byte[] p) {
|
public void draw(byte[] p) {
|
||||||
super.draw(p);
|
super.draw(p);
|
||||||
Draw_Sprite(16, 16, Sprite.MAP_TILE_INFO);
|
Draw_Sprite_Partial_Ext(16, 16, 0, 0, 96, 96, Sprite.PROFONT, Alpha.ALPHA0, PaletteColor.SKY_BLUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user