hello world nintendo DS

Monkey Forums/Monkey Programming/hello world nintendo DS

slenkar(Posted 2011) [#1]
I managed to compile a hello world program for nintendo DS

using monkey..

the only difficulty was that the makefile didnt like spaces in the path to the source code,

is there a way of getting around this?

I was running make from the windows command line that is kind of like a dos emulator (is that why?)


ziggy(Posted 2011) [#2]
Put the full path to the file into double quotes.


MikeHart(Posted 2011) [#3]
Nintendo DS? Which target did you use? GLFW?


slenkar(Posted 2011) [#4]
Put the full path to the file into double quotes.

well im calling the makefile.. all im doing is
Execute "make"


in the makefile it says:

TARGET := $(notdir $(CURDIR))

somehow i have to do something to CURDIR
any ideas?

Nintendo DS? Which target did you use? GLFW?

I made a new target

each target is a class that extends the 'target' class

Import target
Class ndsTarget Extends Target

Method Begin()
ENV_TARGET="nds"
ENV_LANG="cpp"
_trans=New CppTranslator
End

Method MakeTarget()

Select ENV_HOST
Case "winnt","macos"

CreateDir CASED_CONFIG
CreateDataDir CASED_CONFIG+"/data"

Local main$=LoadString( "source/main.cpp" )
main=ReplaceBlock( main,"${BEGIN_CODE}","${END_CODE}",_trans.PostProcess( app.transCode ) )
SaveString main,"source/main.cpp"

If OPT_BUILD


Execute "make"

Endif
If OPT_RUN
Execute "c:/desmume/desmume.exe nds.nds"
Endif
End
End
End




Its pretty simple, because those guys at devkitpro already made the make file.


Thing is.....mojo isnt done, this will take some work,
so there is no input, graphics or sound :)

The guys at devkitpro created a simulation of a console on the DS so I was able to get this:


from this source:
Function Main()
Print "hello"
Local stringy:String="helloh"
If stringy.EndsWith("h")
Print "yes"
Endif

End


if your game is in a folder that has no spaces in its path monkey even opens the NDS emulator and loads in your nds file automatically!


Tibit(Posted 2011) [#5]
cool


slenkar(Posted 2011) [#6]
its quite daunting, getting a mojo target going, not sure where to start

the creation of the plain DS target was much easier,

I though it was going to be the other way round ! :)


slenkar(Posted 2011) [#7]
here a sample NDS file with input working:

http://www.mediafire.com/?4t7ahya746wi5wk


Hima(Posted 2011) [#8]
Awesome. I'd love to be able to build my game for NDS! I guess you have to add new command in order to handle the two displays too, right?


slenkar(Posted 2011) [#9]
yes probably
:)


got drawline to work :)

Strict
Import mojo



Class gayme Extends App

Method OnUpdate:Int()
Local hitty:Bool
If MouseHit(0)
Print "hit"
Print MouseX()
Print MouseY()
 hitty=True
Endif
'If MouseDown(0)
'Print "down"
'Print MouseX()
'Print MouseY()
'hitty=True
'Endif

Return 0
End Method
Method OnRender:Int()
Cls(255,255,255)
DrawLine(0,0,150,50)
'Print "draw stuff"
Return 0
End Method

Method OnCreate:Int()
Print "created"
Return 0
End Method
End Class





Function Main:Int()
Print "hello"
Local stringy:String="helloh"
If stringy.EndsWith("h")
Print "yes"
Endif
New gayme
Return 0
End



slenkar(Posted 2011) [#10]
does anyone know C?

There is a function in the DS:

void glLoadMatrix4x4(const m4x4 *m)


m4x4 is a struct

the struct has an array of ints (which is the matrix)

so how would I call the function?

I tried this:
	struct m4x4 ma;
	ma.m[0]=ix;
	ma.m[1]=iy;
	ma.m[4]=jx;
	ma.m[5]=jy;
	ma.m[12]=tx;
	ma.m[13]=ty;
	
	
	if( tformed ){
		glLoadMatrix4x4(&ma);



but it gives a lot of warnings in the compiler:
c:/nds/stdtest.build/nds/source/main.cpp:1313:14: note: 'ma.m4x4::m[14]' was declared here
c:/devkitPro/libnds/include/nds/arm9/videoGL.h:820:27: warning: 'ma.m4x4::m[15]' may be used uninitialized in this function
c:/nds/stdtest.build/nds/source/main.cpp:1313:14: note: 'ma.m4x4::m[15]' was declared here


and the screen goes blank when I try to scale it (unlike the HTML5 version of the same code)

Am I doing anything wrong?


slenkar(Posted 2011) [#11]
the project seems doomed, whenever i try to set the matrix it always acts the same whatever numbers i put in


slenkar(Posted 2011) [#12]
ok i got the matrix to work, but the fling demos crash the DS (hardware and emulation)
The first demo however, never crashes, you can even reset it.


Loofadawg(Posted 2011) [#13]
One step forward, two steps back. You'll get worked out though.


slenkar(Posted 2011) [#14]
yup you were right,

I was still using V35

I think it was the GC thrash crash,

All the demos seem to work



It goes about 0.01FPS on this demo but it will be useful for games with less stuff on the screen

It crashes when i press 'B' though