GP32 Need Some Results


Splinter

Member
Well ive been doing alot of learning of c++ and i am understanding how arrays, simple pointers etc work. I was just wondering if someone could explain how to do certain things. So far ive been learning to code and i just dont understand how to get graphics and thaty sort of stuff. Ive only ever made programs that use the build in kernel (is that what its called?) or whatever comes up with an exe.

I know i should just wait until i understand more but i find motivation hard when theres a lack of results anywhere near what i want.

So if anyone could explain how to get say a black background, a white pixel and move the white pixel around. Sounds stupid but anyway, thankyou for your time :)
 
Well ive been doing alot of learning of c++ and i am understanding how arrays, simple pointers etc work. I was just wondering if someone could explain how to do certain things. So far ive been learning to code and i just dont understand how to get graphics and thaty sort of stuff. Ive only ever made programs that use the build in kernel (is that what its called?) or whatever comes up with an exe.

I know i should just wait until i understand more but i find motivation hard when theres a lack of results anywhere near what i want.

So if anyone could explain how to get say a black background, a white pixel and move the white pixel around. Sounds stupid but anyway, thankyou for your time :)

#include "gp32.h"
u16 *framebuffer = (u16*)FRAMEBUFFER;
int main() {
gp_setCpuspeed(33);
gp_initFramebuffer(framebuffer,16,85);
gp_clearFramebuffer16 (framebuffer ,0x0000);

int x=10,y=10,z=0;
while (1) {
short backup;
backup = framebuffer[x+240*y];
framebuffer[x+240*y]=0xFFFF;

for (z=0;z<5000;z++) z=z;
framebuffer[x+240*y]=backup;

if ( gp_getButton()&BUTTON_RIGHT) y+=1;
if ( gp_getButton()&BUTTON_LEFT ) y-=1;
if ( gp_getButton()&BUTTON_UP ) x+=1;
if ( gp_getButton()&BUTTON_DOWN ) x-=1;
if (x>239) x=239;
if (x<1) x=1;
if (y>319) y=319;
if (y<1) y=1;

}

}
 
Last edited by a moderator:
Back
Top