CabaretVoltaire Posted February 3, 2004 Share Posted February 3, 2004 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 Quote Link to comment Share on other sites More sharing options...
eric_ruck Posted February 3, 2004 Share Posted February 3, 2004 You define a one pixel black sprite, then use hscale and vscale to cover the area you want...I'm feeling a bit hurried to look up the code now, PM me if you need and I can find it. Eric Quote Link to comment Share on other sites More sharing options...
CabaretVoltaire Posted February 4, 2004 Author Share Posted February 4, 2004 Hi Eric, I can't use hscale/vscale as I want to be able to set individual pixels in the sprite. I think I've worked out the sprite format now, I'm using a 64*32*1bpp sprite and I am able to toggle pixels on it fine However I'm having problems with the compiler and pointers, grr. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.