Add anchor point support
git-svn-id: svn://svn.cc65.org/cc65/trunk@5917 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
5b479a4f51
commit
c250482137
1 changed files with 37 additions and 3 deletions
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "attrib.h"
|
#include "attrib.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
@ -86,6 +88,32 @@ static enum Mode GetMode (const Collection* A)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned GetActionPointX (const Collection* A)
|
||||||
|
/* Return the sprite mode from the attribute collection A */
|
||||||
|
{
|
||||||
|
/* Check for a action point x attribute */
|
||||||
|
const char* ActionPointX = GetAttrVal (A, "ax");
|
||||||
|
if (ActionPointX) {
|
||||||
|
return atoi(ActionPointX);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned GetActionPointY (const Collection* A)
|
||||||
|
/* Return the sprite mode from the attribute collection A */
|
||||||
|
{
|
||||||
|
/* Check for a action point y attribute */
|
||||||
|
const char* ActionPointY = GetAttrVal (A, "ay");
|
||||||
|
if (ActionPointY) {
|
||||||
|
return atoi(ActionPointY);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void encodeSprite(StrBuf *D, enum Mode M, char ColorBits, char ColorMask, char LineBuffer[512],
|
static void encodeSprite(StrBuf *D, enum Mode M, char ColorBits, char ColorMask, char LineBuffer[512],
|
||||||
int i, int LastOpaquePixel) {
|
int i, int LastOpaquePixel) {
|
||||||
/*
|
/*
|
||||||
|
@ -218,9 +246,15 @@ StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A)
|
||||||
char ColorBits;
|
char ColorBits;
|
||||||
char ColorMask;
|
char ColorMask;
|
||||||
|
|
||||||
/* Anchor point of the sprite */
|
/* Action point of the sprite */
|
||||||
OX = 0;
|
OX = GetActionPointX (A);
|
||||||
OY = 0;
|
OY = GetActionPointY (A);
|
||||||
|
if (OX >= GetBitmapWidth (B)) {
|
||||||
|
Error ("Action point X cannot be larger than bitmap width");
|
||||||
|
}
|
||||||
|
if (OY >= GetBitmapHeight (B)) {
|
||||||
|
Error ("Action point Y cannot be larger than bitmap height");
|
||||||
|
}
|
||||||
|
|
||||||
/* Output the image properties */
|
/* Output the image properties */
|
||||||
Print (stdout, 1, "Image is %ux%u with %u colors%s\n",
|
Print (stdout, 1, "Image is %ux%u with %u colors%s\n",
|
||||||
|
|
Loading…
Add table
Reference in a new issue