DS App Studio 3D Example

Discussion in 'NDS - Emulation and Homebrew' started by RoyalCardMan, Jan 19, 2011.

Jan 19, 2011
  1. RoyalCardMan
    OP

    Member RoyalCardMan DS App Studio™ Developer

    Joined:
    Aug 11, 2010
    Messages:
    628
    Location:
    In the middle of gun fire.
    Country:
    United States
    Hi All!

    As I continue the 3D functions, I will show examples of the functions.

    Here is this example:

    [​IMG]

    Here is the download:
    Download

    Here is the code, but it is not usable in DS App Studio version on the site, but the new version will be released soon.

    Code:
    // Project Name: NDS App - AwsomiSoft - www.awsomisoft.com
    
    // Description: this template is a very simple project it 
    // contains the basic code for a DS App Studio application
    
    // Version: 0.4.6
    
    // whenever using 2D or 3D you must use the start2D or 2D function
    start3D(256, 256);
    
    // first, you must tell it to start the first form
    startform("Form1");
    wait();
    endif();
    // and this creates the form. To add another form, just
    // do createform and in quotes the name of the form.
    createform("Form1");
    ÂÂÂÂÂÂ 
    ÂÂÂÂÂÂ Int("zoom", 70);
    ÂÂÂÂÂÂ Int("direction", 0);
    ÂÂÂÂÂÂ Int("angle", 0);
    ÂÂÂÂÂÂ initcamera("0", "0", "zoom", 255, 191);
    ÂÂÂÂÂÂ text(0, 0, "This is a 3D example using DS App Studio!", "bottom");
    ÂÂÂÂÂÂ text(0, 10, "Renderer: OpenGL", "bottom");
    ÂÂÂÂÂÂ text(0, 15, "Use the arrow keys to change the zoom and direction of the camera.", "bottom");
    ÂÂÂÂÂÂ loop();
    ÂÂÂÂÂÂÂÂÂÂ Int("zoome", "zoom");
    ÂÂÂÂÂÂÂÂÂÂ Int("angle", "+=", 1);
    ÂÂÂÂÂÂÂÂÂÂ ogldrawcube("1", "1", "1", "1", "angle", cl_blue);
    ÂÂÂÂÂÂÂÂÂÂ ifbuttonheld("DOWN");
    ÂÂÂÂÂÂÂÂÂÂÂÂ Int("zoom", "+=", 1);
    ÂÂÂÂÂÂÂÂÂÂÂÂ initcamera("0", "0", "zoom", 255, 191);
    ÂÂÂÂÂÂÂÂÂÂ endif();
    ÂÂÂÂÂÂÂÂÂÂ ifbuttonheld("UP");
    ÂÂÂÂÂÂÂÂÂÂÂÂ Int("zoom", "-=", 1);
    ÂÂÂÂÂÂÂÂÂÂÂÂ initcamera("0", "0", "zoom", 255, 191);
    ÂÂÂÂÂÂÂÂÂÂ endif();
    ÂÂÂÂÂÂÂÂÂÂ ifbuttonheld("LEFT");
    ÂÂÂÂÂÂÂÂÂÂÂÂ Int("direction", "-=", 5);
    ÂÂÂÂÂÂÂÂÂÂÂÂ initcamera("direction", "0", "zoome", 255, 191);
    ÂÂÂÂÂÂÂÂÂÂ endif();
    ÂÂÂÂÂÂÂÂÂÂ ifbuttonheld("RIGHT");
    ÂÂÂÂÂÂÂÂÂÂÂÂ Int("direction", "+=", 5);
    ÂÂÂÂÂÂÂÂÂÂÂÂ initcamera("direction", "0", "zoome", 255, 191);
    ÂÂÂÂÂÂÂÂÂÂ endif();
    ÂÂÂÂÂÂ endloop();
    ÂÂÂÂÂÂ 
    endif();
    Most of the code is just the movement. It is basic stuff. I will add other things to make it simpler, but in this example you create two variables, direction and zoom, and you basically say if a button is pressed, increase or decrease the variables and make the camera adapt to those changes.
     

Share This Page