Add drawing color options for sprites

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 3 years ago
parent 5e1f69a9d0
commit 6a418eb9db
  1. BIN
      PaletteReference.png
  2. 1
      README.md
  3. BIN
      sprites/Profont.gif
  4. 7
      src/sig/DrawLoop.java
  5. 4
      src/sig/engine/Object.java
  6. 37
      src/sig/engine/PaletteColor.java
  7. 1
      src/sig/engine/Sprite.java
  8. 3
      src/sig/objects/EditorRenderer.java

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 (みずえ) 水恵
Turn off inline hints: (F1, search "Preferences: Open Settings (JSON)) "editor.inlayHints.enabled": false
Profont: 7x14 per tile.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,6 +1,7 @@
package sig;
import sig.engine.Alpha;
import sig.engine.PaletteColor;
import sig.engine.Panel;
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){
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;
for(int X=(int)xOffset;X<(int)(w+xOffset);X++){
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]) {
continue;
} 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);
}
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) {
return panel.KEYS.getOrDefault(key,false);
}

@ -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")),
TILE_SHEET(new File(new File("..","sprites"),"tiles.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.engine.Alpha;
import sig.engine.MouseScrollValue;
import sig.engine.PaletteColor;
import sig.engine.Panel;
import sig.engine.Sprite;
import sig.map.Map;
@ -58,7 +59,7 @@ public class EditorRenderer extends LevelRenderer{
@Override
public void draw(byte[] 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

Loading…
Cancel
Save