|
|
@ -9,6 +9,7 @@ import sig.engine.PaletteColor; |
|
|
|
import sig.engine.Panel; |
|
|
|
import sig.engine.Panel; |
|
|
|
import sig.engine.Rectangle; |
|
|
|
import sig.engine.Rectangle; |
|
|
|
import sig.engine.Sprite; |
|
|
|
import sig.engine.Sprite; |
|
|
|
|
|
|
|
import sig.engine.Transform; |
|
|
|
|
|
|
|
|
|
|
|
public class DrawLoop { |
|
|
|
public class DrawLoop { |
|
|
|
public static Panel panel; |
|
|
|
public static Panel panel; |
|
|
@ -61,56 +62,85 @@ public class DrawLoop { |
|
|
|
yOffset+=f.getGlyphHeight(); |
|
|
|
yOffset+=f.getGlyphHeight(); |
|
|
|
charCount=0; |
|
|
|
charCount=0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Draw_Sprite_Partial_Ext(x+i*f.getGlyphWidth()-xOffset, y+yOffset, f.getCharInfo(finalS.charAt(i)).getX(), f.getCharInfo(finalS.charAt(i)).getY(), f.getCharInfo(finalS.charAt(i)).getWidth(), f.getCharInfo(finalS.charAt(i)).getHeight(), f.getSprite(), 0,alpha,currentCol); |
|
|
|
Draw_Sprite_Partial_Ext(x+i*f.getGlyphWidth()-xOffset, y+yOffset, f.getCharInfo(finalS.charAt(i)).getX(), f.getCharInfo(finalS.charAt(i)).getY(), f.getCharInfo(finalS.charAt(i)).getWidth(), f.getCharInfo(finalS.charAt(i)).getHeight(), f.getSprite(), 0,alpha,currentCol,Transform.NONE); |
|
|
|
charCount++; |
|
|
|
charCount++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Draw_Sprite(double x, double y, Sprite sprite){ |
|
|
|
public static void Draw_Sprite(double x, double y, Sprite sprite){ |
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0); |
|
|
|
Draw_Sprite_Partial(x,y,0,0,sprite.getWidth(),sprite.getHeight(),sprite,0,Transform.NONE ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Draw_Animated_Sprite(double x, double y, AnimatedSprite sprite, double frameIndex){ |
|
|
|
public static 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); |
|
|
|
Draw_Sprite_Partial(x,y,frameRectangle.getX(),frameRectangle.getY(),frameRectangle.getWidth(),frameRectangle.getHeight(),sprite,frameIndex,Transform.NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Draw_Sprite_Partial(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index){ |
|
|
|
public static 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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static void Draw_Animated_Sprite(double x, double y, AnimatedSprite sprite, double frameIndex,Transform transform){ |
|
|
|
|
|
|
|
Rectangle frameRectangle=sprite.getFrame((int)frameIndex); |
|
|
|
|
|
|
|
Draw_Sprite_Partial(x,y,frameRectangle.getX(),frameRectangle.getY(),frameRectangle.getWidth(),frameRectangle.getHeight(),sprite,frameIndex, transform); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void Draw_Sprite_Partial(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Transform transform){ |
|
|
|
|
|
|
|
boolean horizontal = transform==Transform.HORIZONTAL||transform==Transform.HORIZ_VERTIC; |
|
|
|
|
|
|
|
boolean vertical = transform==Transform.VERTICAL||transform==Transform.HORIZ_VERTIC; |
|
|
|
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++){ |
|
|
|
if (X+x-xOffset<0||Y+y-yOffset<0||X-xOffset+x>=RabiClone.BASE_WIDTH||Y-yOffset+y>=RabiClone.BASE_HEIGHT) { |
|
|
|
if (X+x-xOffset<0||Y+y-yOffset<0||X-xOffset+x>=RabiClone.BASE_WIDTH||Y-yOffset+y>=RabiClone.BASE_HEIGHT) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
int index = (Y-(int)yOffset+(int)y)*RabiClone.BASE_WIDTH+X-(int)xOffset+(int)x; |
|
|
|
int index = |
|
|
|
|
|
|
|
((vertical? |
|
|
|
|
|
|
|
sprite.getHeight()-(Y-(int)yOffset): |
|
|
|
|
|
|
|
(Y-(int)yOffset)) |
|
|
|
|
|
|
|
+(int)y)*RabiClone.BASE_WIDTH+ |
|
|
|
|
|
|
|
(horizontal? |
|
|
|
|
|
|
|
sprite.getWidth()-(X-(int)xOffset): |
|
|
|
|
|
|
|
(X-(int)xOffset)) |
|
|
|
|
|
|
|
+(int)x; |
|
|
|
|
|
|
|
|
|
|
|
if (index<0||index>=p.length||sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]==32||p[index]==sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]) { |
|
|
|
if (index<0||index>=p.length||sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]==32||p[index]==sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Draw(p,index,sprite.getBi_array()[Y*sprite.getCanvasWidth()+X],Alpha.ALPHA0); |
|
|
|
Draw(p,index,sprite.getBi_array()[Y*sprite.getCanvasWidth()+X],Alpha.ALPHA0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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, Transform transform){ |
|
|
|
Draw_Sprite_Partial_Ext(x, y, xOffset, yOffset, w, h, sprite, 0, alpha, PaletteColor.NORMAL); |
|
|
|
Draw_Sprite_Partial_Ext(x, y, xOffset, yOffset, w, h, sprite, 0, alpha, PaletteColor.NORMAL, Transform.NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Draw_Animated_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, AnimatedSprite sprite, double frameIndex, Alpha alpha){ |
|
|
|
public static void Draw_Animated_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, AnimatedSprite sprite, double frameIndex, Alpha alpha, 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, alpha, PaletteColor.NORMAL); |
|
|
|
Draw_Sprite_Partial_Ext(x, y, frameRectangle.getX(), frameRectangle.getY(), frameRectangle.getWidth(), frameRectangle.getHeight(), sprite, 0, alpha, PaletteColor.NORMAL, Transform.NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Alpha alpha, PaletteColor col){ |
|
|
|
public static void Draw_Sprite_Partial_Ext(double x, double y, double xOffset, double yOffset, double w, double h, Sprite sprite, double frame_index, Alpha alpha, PaletteColor col, Transform transform){ |
|
|
|
|
|
|
|
boolean horizontal = transform==Transform.HORIZONTAL||transform==Transform.HORIZ_VERTIC; |
|
|
|
|
|
|
|
boolean vertical = transform==Transform.VERTICAL||transform==Transform.HORIZ_VERTIC; |
|
|
|
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++){ |
|
|
|
if (X+x-xOffset<0||Y+y-yOffset<0||X-xOffset+x>=RabiClone.BASE_WIDTH||Y-yOffset+y>=RabiClone.BASE_HEIGHT) { |
|
|
|
if (X+x-xOffset<0||Y+y-yOffset<0||X-xOffset+x>=RabiClone.BASE_WIDTH||Y-yOffset+y>=RabiClone.BASE_HEIGHT) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
int index = (Y-(int)yOffset+(int)y)*RabiClone.BASE_WIDTH+X-(int)xOffset+(int)x; |
|
|
|
int index = |
|
|
|
|
|
|
|
((vertical? |
|
|
|
|
|
|
|
sprite.getHeight()-(Y-(int)yOffset): |
|
|
|
|
|
|
|
(Y-(int)yOffset)) |
|
|
|
|
|
|
|
+(int)y)*RabiClone.BASE_WIDTH+ |
|
|
|
|
|
|
|
(horizontal? |
|
|
|
|
|
|
|
sprite.getWidth()-(X-(int)xOffset): |
|
|
|
|
|
|
|
(X-(int)xOffset)) |
|
|
|
|
|
|
|
+(int)x; |
|
|
|
if (index<0||index>=p.length||sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]==32||p[index]==sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]) { |
|
|
|
if (index<0||index>=p.length||sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]==32||p[index]==sprite.getBi_array()[Y*sprite.getCanvasWidth()+X]) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|