Homebrew am i missing something?

  • Thread starter Thread starter redact
  • Start date Start date
  • Views Views 1,063
  • Replies Replies 2

redact

‮҉
Member
Joined
Dec 2, 2007
Messages
3,161
Solutions
3
Reaction score
175
Trophies
1
Location
-
XP
705
Country
Mauritania
so i recently started doing a course to learn c++ (as well as java and some other stuff)
and i thought maybe i could practice by doing some ds dev...

i started fooling around with the hello world that came with the examples

CODE#include
#include

int main(void)
{
ÂÂÂÂint i;

ÂÂÂÂconsoleDemoInit();

ÂÂÂÂvideoSetMode(MODE_FB0);

ÂÂÂÂvramSetBankA(VRAM_A_LCD);

ÂÂÂÂprintf("Hello World!\n");
ÂÂÂÂprintf("www.Drunkencoders.com");

ÂÂÂÂfor(i = 0; i < 256 * 192; i++)
ÂÂÂÂÂÂÂÂVRAM_A = RGB15(31,0,0);

ÂÂÂÂreturn 0;
}


and after fiddling a bit i got some sexy patterns happening
CODE#include //libnds
#include //standard input/output

int main(void)
{
ÂÂÂÂint i;

ÂÂÂÂconsoleDemoInit();

ÂÂÂÂvideoSetMode(MODE_FB0);

ÂÂÂÂvramSetBankA(VRAM_A_LCD);

ÂÂÂÂprintf("COLORS!\n");

ÂÂÂÂfor(i = 0; i < 256 * 192; i++)
ÂÂÂÂÂÂÂÂVRAM_A = RGB15((0),(i%257/2),(i%255/2));

ÂÂÂÂreturn 0;
}


both of these code snippets will compile and run perfectly fine. if, however i edit the code slightly...
CODE#include //libnds
#include //standard input/output

int main(void)
{
ÂÂÂÂint i;
ÂÂÂÂint r, g, b;

ÂÂÂÂconsoleDemoInit();

ÂÂÂÂvideoSetMode(MODE_FB0);

ÂÂÂÂvramSetBankA(VRAM_A_LCD);

ÂÂÂÂprintf("COLORS!\n");

ÂÂÂÂfor(i = 0; i < 256 * 192; i++)
ÂÂÂÂÂÂÂÂr=0;
ÂÂÂÂÂÂÂÂg=(i%257/2);
ÂÂÂÂÂÂÂÂb=(i%255/2);
ÂÂÂÂÂÂÂÂVRAM_A = RGB15(r,g,b);

ÂÂÂÂreturn 0;
}


other info:
IDE: programmers notepad (was already pre-configured for libnds on installation of dkp)


screenshots:

working:
jshot20100310060126.png

not working:
jshot20100310060008.png


edit: bbcode
 
You forgot to add braces to the for-loop code block:

CODEÂÂÂÂfor(i = 0; i < 256 * 192; i++)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂr=0;
ÂÂÂÂÂÂÂÂg=(i%257/2);
ÂÂÂÂÂÂÂÂb=(i%255/2);
ÂÂÂÂÂÂÂÂVRAM_A = RGB15(r,g,b);
ÂÂÂÂ}
 
of course, i knew i was missing something
thanks man
smile.gif


edit: congrats on your first post
cool.gif
 

Site & Scene News

Popular threads in this forum