Homebrew DS App Studio Has Advanced Much

RoyalCardMan

DS App Studio™ Developer
OP
Member
Joined
Aug 11, 2010
Messages
628
Trophies
0
Age
31
Location
In the middle of gun fire.
Website
www.awsomisoft.com
XP
145
Country
United States
I am advancing DS App Studio really fast, it seems. I have just implemented two new functions that allow you to draw backgrounds on both screens. Here is the code for a project that I was working on.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// 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
start2D(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.
form("Form1");

ÂÂÂÂÂÂ // First, load a background by going to Resources|Load Background.
ÂÂÂÂÂÂ // Then, click Load from File and choose a background to load.
ÂÂÂÂÂÂ // Then, name the background Desert and click Accept. Now, replace
ÂÂÂÂÂÂ // the say function with drawbackground, and for Index, use 1, and
ÂÂÂÂÂÂ // for layer, use 3, and for the background to load, in quotes, enter
ÂÂÂÂÂÂ // the name of the background.
ÂÂÂÂÂÂ drawtopback(1, 3, "Desert");
ÂÂÂÂÂÂ drawbottomback(2, 3, "TopBack");
ÂÂÂÂÂÂ addobject("sprite", 0, 0);
ÂÂÂÂÂÂ
endif();<!--c2--></div><!--ec2-->

And here were the results.

<img src="http://img802.imageshack.us/img802/9487/screen1h.png" border="0" class="linked-image" />

And here is the next example having 3D on top, and 2D on the bottom.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// 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.
form("Form1");

ÂÂÂÂÂÂ // First, load a background by going to Resources|Load Background.
ÂÂÂÂÂÂ // Then, click Load from File and choose a background to load.
ÂÂÂÂÂÂ // Then, name the background Desert and click Accept. Now, replace
ÂÂÂÂÂÂ // the say function with drawbackground, and for Index, use 1, and
ÂÂÂÂÂÂ // for layer, use 3, and for the background to load, in quotes, enter
ÂÂÂÂÂÂ // the name of the background.ÂÂÂÂÂÂ
ÂÂÂÂÂÂ drawbottomback(2, 3, "Desert");
ÂÂÂÂÂÂ addobject("Point", 0, 0);
ÂÂÂÂÂÂ loop();
ÂÂÂÂÂÂÂÂ ogladdlight(8, 8, 8);
ÂÂÂÂÂÂÂÂ ogldrawmodel("statue", 0, 0);
ÂÂÂÂÂÂÂÂ ifstylusheld();
ÂÂÂÂÂÂÂÂÂÂ setobjectxy("Point", "stylus.px", "stylus.py");
ÂÂÂÂÂÂÂÂ endif();
ÂÂÂÂÂÂÂÂ ifbuttonheld("UP");
ÂÂÂÂÂÂÂÂÂÂ oglrotatemodelx("statue", +50);
ÂÂÂÂÂÂÂÂ endif();
ÂÂÂÂÂÂÂÂ ifbuttonheld("LEFT");
ÂÂÂÂÂÂÂÂÂÂ oglrotatemodely("statue", -50);
ÂÂÂÂÂÂÂÂ endif();
ÂÂÂÂÂÂÂÂ ifbuttonheld("RIGHT");
ÂÂÂÂÂÂÂÂÂÂ oglrotatemodely("statue", +50);
ÂÂÂÂÂÂÂÂ endif();
ÂÂÂÂÂÂÂÂ ifbuttonheld("DOWN");
ÂÂÂÂÂÂÂÂÂÂ oglrotatemodelx("statue", -50);
ÂÂÂÂÂÂÂÂ endif();
ÂÂÂÂÂÂ endloop();
ÂÂÂÂÂÂ
endif();<!--c2--></div><!--ec2-->

And is the screenshot.

<img src="http://img855.imageshack.us/img855/2420/screen2cp.png" border="0" class="linked-image" />

This is such a big advancement for DS App Studio.

Edit: I did a little comparison, and here is the result of the C++ version:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#include <nds.h>
#include <maxmod9.h>
#include "soundbank.h"
#include "soundbank_bin.h"
#include <stdio.h>
ÂÂtouchPosition stylus;ÂÂPrintConsole topScreen; PrintConsole bottomScreen;ÂÂ
#include "ad.h"

#include <filesystem.h>

#include <stdlib.h>

#include <string.h>

#include <dirent.h>
ÂÂint test = 0; int once = 1;
#define FRAMES_PER_ANIMATION 1
ÂÂ
void dirlist(const char* path) {ÂÂÂÂDIR* pdir = opendir(path);ÂÂÂÂchar *dnbuf;ÂÂÂÂif (pdir != NULL) {ÂÂÂÂÂÂÂÂwhile(true) {ÂÂÂÂÂÂÂÂÂÂÂÂstruct dirent* pent = readdir(pdir);ÂÂÂÂÂÂÂÂÂÂÂÂif(pent == NULL) break;ÂÂÂÂif(strcmp(".", pent->d_name) != 0 && strcmp("..", pent->d_name) != 0) {dnbuf = (char *)malloc(strlen(pent->d_name)+strlen(path)+2);ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂsprintf(dnbuf, "%s/%s", (strcmp("/",path) == 0)?"":Path, pent->d_name); struct stat *statbuf = (struct stat*)malloc(sizeof(statbuf));ÂÂÂÂÂÂÂÂÂÂÂÂstat(dnbuf, statbuf);ÂÂÂÂÂÂÂÂif(S_ISDIR(statbuf->st_mode)) {ÂÂÂÂprintf("%s <DIR> ", dnbuf);ÂÂÂÂdirlist(dnbuf);} else {ÂÂÂÂprintf("%s (%d) ", dnbuf, (int)statbuf->st_size);ÂÂÂÂ} free(dnbuf);ÂÂÂÂfree(statbuf);ÂÂÂÂ}ÂÂÂÂ}ÂÂÂÂclosedir(pdir);ÂÂÂÂ} else {ÂÂÂÂprintf("opendir() failure. ");}}ÂÂvoid renderCube(int size1f, int size2f,int size3f, int size4f,ÂÂint angle,int rgbc, int rgbc2, int rgbc3){ÂÂÂÂglPushMatrix();ÂÂÂÂglTranslatef(0, 0, -4);ÂÂÂÂglRotatef32i(degreesToAngle(angle), inttof32(1), inttof32(1), inttof32(1));ÂÂÂÂglBegin(GL_QUADS);ÂÂÂÂÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size1f,ÂÂsize1f,ÂÂsize1f);ÂÂÂÂÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size1f,ÂÂsize1f,ÂÂsize1f);ÂÂÂÂÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size1f, -size1f,ÂÂsize1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂglVertex3f(-size1f, -size1f,ÂÂsize1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size2f,ÂÂsize2f, -size2f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size2f,ÂÂsize2f, -size2f); glColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size2f, -size2f, -size2f);ÂÂÂÂÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂglVertex3f(-size2f, -size2f, -size2f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size3f,ÂÂsize3f,ÂÂsize3f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size3f,ÂÂsize3f,ÂÂsize3f);ÂÂÂÂÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size3f,ÂÂsize3f, -size3f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂglVertex3f(-size3f,ÂÂsize3f, -size3f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size4f, -size4f,ÂÂsize4f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size4f, -size4f,ÂÂsize4f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size4f, -size4f, -size4f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂglVertex3f(-size4f, -size4f, -size4f); glColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size1f, size1f,ÂÂ-size1f);ÂÂÂÂÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size1f, size1f,ÂÂ size1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f( size1f,-size1f,ÂÂ size1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂglVertex3f( size1f,-size1f,ÂÂ-size1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size1f, size1f,ÂÂ-size1f); glColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size1f, size1f,ÂÂ size1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂÂÂÂÂglVertex3f(-size1f,-size1f,ÂÂ size1f);ÂÂÂÂglColor3b(rgbc,rgbc2,rgbc3);ÂÂÂÂglVertex3f(-size1f,-size1f,ÂÂ-size1f);ÂÂÂÂglEnd();ÂÂÂÂglPopMatrix(1); }
#include"Sprite.h"
typedef struct
{ÂÂÂÂ
int x;ÂÂÂÂ
int y;
ÂÂÂÂu16* sprite_gfx_mem[12];ÂÂÂÂ
int gfx_frame;ÂÂÂÂ
int state;ÂÂÂÂ
int anim_frame;
}Sprite;
void initSprite(Sprite *sprite, u8* gfx)
{
int i;
for(i = 0; i < 12; i++)
{sprite->sprite_gfx_mem = oamAllocateGfx(&oamSub, SpriteSize_32x32, SpriteColorFormat_256Color);
dmaCopy(gfx, sprite->sprite_gfx_mem, 32*32);gfx += 32*32;}}

#include"Point.h"
typedef struct
{ÂÂÂÂ
int x;ÂÂÂÂ
int y;
ÂÂÂÂu16* sprite_gfx_mem[12];ÂÂÂÂ
int gfx_frame;ÂÂÂÂ
int state;ÂÂÂÂ
int anim_frame;
}Point;
void initPoint(Point *sprite, u8* gfx)
{
int i;
for(i = 0; i < 12; i++)
{sprite->sprite_gfx_mem = oamAllocateGfx(&oamSub, SpriteSize_32x32, SpriteColorFormat_256Color);
dmaCopy(gfx, sprite->sprite_gfx_mem, 32*32);gfx += 32*32;}}

#include "Desert.h"

#include "TopBack.h"

#include"statue_bin.h"
;
#include "font.h"
const int tile_base = 0; const int map_base = 20;ÂÂint i = 0;ÂÂint main(int argc, char **argv) { consoleDemoInit();ÂÂswiWaitForVBlank(); mmInitDefaultMem((mm_addr)soundbank_bin); videoSetMode(MODE_5_2D); videoSetModeSub(MODE_5_2D); vramSetBankD(VRAM_D_SUB_SPRITE); vramSetBankA(VRAM_A_MAIN_BG_0x06000000); consoleInit(&topScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, true, true);ÂÂconsoleInit(&bottomScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true);ÂÂvideoSetMode(MODE_0_3D); vramSetBankA(VRAM_A_MAIN_BG_0x06000000);ÂÂconsoleInit(&topScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true);ÂÂconsoleInit(&bottomScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true); glInit(); bgSetPriority(0, 1); glMaterialShinyness();ÂÂglEnable(GL_ANTIALIAS); glClearColor(0,0,0,31); glClearPolyID(63); glClearDepth(0x7FFF); glViewport(0,0,255,191); glSetToonTableRange( 0, 15, RGB15(8,8,8) );glSetToonTableRange( 16, 31, RGB15(24,24,24) ); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(70, 256.0 / 192.0, 0.1, 40); glLight(0, RGB15(16,16,16) , 0,ÂÂÂÂÂÂÂÂfloattov10(-1.0),ÂÂÂÂÂÂÂÂ0); glLight(1, RGB15(16,16,16),ÂÂ floattov10(-1.0),ÂÂÂÂ0,ÂÂÂÂÂÂÂÂ0); gluLookAt(0.0, 0.0, -5.0, 0.0, 0.0, 0.0,0.0, 1.0, 0.0);ÂÂÂÂÂÂÂÂ Form1();while(1) {}}int speed = 70;int Form1(void){ÂÂ int bg1 = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 0,0); dmaCopy(DesertBitmap, bgGetGfxPtr(bg1), 256*256); dmaCopy(DesertPal, BG_PALETTE_SUB, 256*2); while(1) { glMaterialf(GL_AMBIENT, RGB15(6, 6,6)); glMaterialf(GL_DIFFUSE, RGB15(24,24,24));ÂÂÂÂglMaterialf(GL_SPECULAR, RGB15(0,0,0));ÂÂÂÂglMaterialf(GL_EMISSION, RGB15(0,0,0)); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1 | POLY_TOON_HIGHLIGHT);ÂÂ glMatrixMode(GL_PROJECTION); glPushMatrix(); glRotateXi(0); glRotateYi(0); glPolyFmt(POLY_ALPHA(255) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1 | POLY_TOON_HIGHLIGHT);ÂÂscanKeys(); u32 keys = keysHeld(); glCallList((u32*)statue_bin); glFlush(0);scanKeys(); touchRead(&stylus);ÂÂif ( keysHeld() & KEY_UP){ÂÂspeed-= 1;ÂÂglViewport(0,0,255,191); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(speed, 256.0 / 192.0, 0.1, 100);ÂÂÂÂglPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);ÂÂÂÂlcdMainOnTop();ÂÂÂÂvramSetBankD(VRAM_D_LCD);ÂÂÂÂvramSetBankC(VRAM_C_SUB_BG);ÂÂÂÂREG_DISPCAPCNT = DCAP_BANK(3) | DCAP_ENABLE | DCAP_SIZE(3);}scanKeys(); touchRead(&stylus);ÂÂif ( keysHeld() & KEY_DOWN){ÂÂspeed+= 1;ÂÂglViewport(0,0,255,191); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(speed, 256.0 / 192.0, 0.1, 100);ÂÂÂÂglPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);ÂÂÂÂlcdMainOnTop();ÂÂÂÂvramSetBankD(VRAM_D_LCD);ÂÂÂÂvramSetBankC(VRAM_C_SUB_BG);ÂÂÂÂREG_DISPCAPCNT = DCAP_BANK(3) | DCAP_ENABLE | DCAP_SIZE(3);}scanKeys(); touchRead(&stylus);ÂÂif ( keysHeld() & KEY_LEFT){ÂÂ glMatrixMode(GL_PROJECTION); glPushMatrix(); glRotateYi(-100); glPolyFmt(POLY_ALPHA(255) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1 | POLY_TOON_HIGHLIGHT);ÂÂ scanKeys(); u32 keys = keysHeld(); glCallList((u32*)statue_bin); glFlush(0);}scanKeys(); touchRead(&stylus);ÂÂif ( keysHeld() & KEY_RIGHT){ÂÂ glMatrixMode(GL_PROJECTION); glPushMatrix(); glRotateYi(100); glPolyFmt(POLY_ALPHA(255) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1 | POLY_TOON_HIGHLIGHT);ÂÂ scanKeys(); u32 keys = keysHeld(); glCallList((u32*)statue_bin); glFlush(0);}}}<!--c2--></div><!--ec2-->
 
General chit-chat
Help Users
    kenenthk @ kenenthk: Uremum