So right now i'm working on a project for the Atari Falcon (which will also be ported to DOS and other platforms) and that platform has a Motorola 68030 running at 16Mhz.
However, making things worse is the fact that the system bus is 16-bits only... So i need to make sure to optimize my graphical routines as fast as i can.
I want to use the RGB565 mode on this thing, since its the only one that is linear and not chunky/planar. Plus i like more colors
(RGB565 also happens to be the color mode the nspire uses so that should be useful too)
I'm also using a custom display mode, 320x180 rather than 320x240 for performance & convenience reasons. (including 1080p up-scaling)
So for a full RGB565 320x180 picture, i can basically just load the file with fopen & fread and just memcpy everything.
memcpy(myscreen_address, mybuffer, (320*180)*2);
Or i can simply use the optimised routines that came with Orion's devkit and use that.
(works the same as memcpy)
FastCopy32(mybuffer, myscreen_address, (320*180)*2);
That's pretty and fast... but how about sprites ?
I initially came up with this (no transparency for now, i have a solution for that) :
typedef struct tagBITMAP
unsigned short width;
unsigned short height;
unsigned long tsize;
unsigned char *data;
void Draw_Sprite(u32* framebuffer, BITMAP* bmp, short x, short y)
u32* dst = &framebuffer[((y * (RL_SCREEN_WIDTH)) + x) / 4];
memcpy(dst, bmp->data, bmp->tsize);
However, unless the picture uses the same width as the screen (320 here), the picture is not displayed properly.
If my sprite is 320x32, it will be displayed properly. However, if its width is anything but 320, it won't be displayed properly.
You see what i mean ?
So what can i do ? I've looked online and even n2DLIb but that library just draws every pixel individually.
That is horribly inefficient and i would like to use memory copying if possible.
We'll just assume that we don't want transparency for sprites. (i have a solution for that)
What would be the fastest way to display a moving sprite on-screen ?