put1! c trop fort ce truc!!
pour écrire un pixel à l'écran:
//////first thing we do is include the necessary headers
#include “gba.h” //this is were all the registers are defined (like REG_DISPCNT)
#include “screenmode.h” //this is the header file we just wrote
/////////////////////////////// RGB macro
/************************************************************
* The GBA stores 15 bit color in blue green red format meaning
* the first 5 bits are the red the next 5 bits are green and the next
* 5 blue. This macro just shifts the colors over the correct amount.
* RGB is the more standard way to represent color.
************************************************************/
#define RGB(r,g,b) ((r)+((g)<<5)+((b)<<10)) //both do the same thing but just in case you prefer RGB notation i included both macros
#define BGR(b,g,r) ((r)+((g)<<5)+((b)<<10))
///////////////////////////////PlotPixel()
/*********************************************************
* Plots a pixel by storing the color value into the proper
* place in video memory.
*********************************************************/
#define u16 unsigned short int //this just defines a 16bit unsigned data type to save typing
u16 VideoBuffer = (u16*) 0x6000000; //this is the start address of video memory
void PlotPixel(int x,int y, unsigned short int c) { VideoBuffer[(y) *240 + (x)] = (c); }
//////Now our main c function. This is the function that is called by the startup code ( you must include boot.asm in all your Projects)
void C_Entry(void)
{
int x,y; //these will be used to loop through all x and y positions on the screen
SetMode(MODE3 | BG2_ENABLE); //this sets up mode 3 and enables background 2. Backround 2 must be enabled for all bitmap modes
for(x = 0; x < 240; x++) //loop through all x’s
{
for(y = 0; y < 160; y++) //loop through all y’s
{
PlotPixel(x, y, RGB(31,0,0)); //plot the pixel
} //end y loop
} //end x loop
} //end C_Entry
trop bien... couleurs rgb, et tt et tt
C TROP DLA BALLE CE TRUC !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!