1. mercluke

    OP mercluke ‮҉
    Member

    Joined:
    Dec 2, 2007
    Messages:
    3,163
    Country:
    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:
    [​IMG]
    not working:
    [​IMG]

    edit: bbcode
     
  2. emunch

    emunch Newbie
    Newcomer

    Joined:
    Sep 14, 2009
    Messages:
    1
    Country:
    Norway
    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);
    ÂÂÂÂ}
     
  3. mercluke

    OP mercluke ‮҉
    Member

    Joined:
    Dec 2, 2007
    Messages:
    3,163
    Country:
    of course, i knew i was missing something
    thanks man [​IMG]

    edit: congrats on your first post [​IMG]
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - something, missing,