Jump to content
IGNORED

Lynx sprite format. Editing sprites programmatically.


Recommended Posts

What's the easiest way of editing sprites on the lynx?

 

I haven't done anything like this in a while so I'm a bit rusty.. I used to do alot of C but for the last few years I've been working in web development (html, javascript, etc) which has made me stupid ;) So please go easy on me.

 

 

I have a sprite:

 

Image[]={0x00,0x00, etc

 

Which I want to be solid black for 64*32 pixels. First, how do I define a new line in the sprite? There doesn't seem to be anything in the sprite struct to define height and width, just hscale and vscale.

 

Second how can I toggle individual pixels in this sprite between black white?

 

Would something like this work?

 

void TogglePixel(int x,int y,unsigned char *Image){

int ArrayPosition = (64 * y)+x; //gets the pixel position

int nibble = (ArrayPosition & 1)<<4; //is pixel position odd or even?

 

//two pixels per byte so divide by 2

Image[(ArrayPosition>>1)]^=(0xf0>>nibble); //xor by 0xf0, or if pixel is odd xor by 0xf

}

 

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...