Added BlitzMax (MonkeyMax) native file

Added BlitzMax (MonkeyMax) native file

' ***** Start diddy.bmax.bmx ******
Global diddy_mouseWheel:Float = 0.0

Type diddy
	Function systemMillisecs:Float()
		Return Millisecs()
	EndFunction

	Function setGraphics(w:int, h:int, fullScreen:Int = False)
		local d% = 0
		if fullScreen then d = 32
		Graphics w, h, d, 60
	EndFunction

	Function setMouse(x:Int, y:Int)
		MoveMouse(x, y)
	EndFunction

	Function showKeyboard()
	EndFunction

	Function launchBrowser(address:String, windowName:String)
	EndFunction

	Function launchEmail(email:String, subject:String, text:String)
	EndFunction

	Function realMod:Float( value:Float, amount:Float )
		Return value Mod amount
	EndFunction

	Function startVibrate(millisecs:int)
	EndFunction

	Function stopVibrate()
	EndFunction

	Function getDayOfMonth:Int()
		Local date$ = CurrentDate()
		Return Int(date[..2])
	EndFunction

	Function getDayOfWeek:Int()
		Return 0
	EndFunction

	Function getMonth:Int()
		Local date$ = CurrentDate()
		Return (Instr("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC", date$[3..6].ToUpper(), 1) / 3) + 1
	EndFunction

	Function getYear:Int()
		Local date$ = CurrentDate()
		Return Int(date[date.length - 4..]);
	EndFunction

	Function getHours:Int()
		Local time$ = CurrentTime()
		Return Int(time[..2])
	EndFunction

	Function getMinutes:Int()
		Local time$ = CurrentTime()
		Return Int(time[3..5])
	EndFunction

	Function getSeconds:Int()
		Local time$ = CurrentTime()
		Return Int(time[6..8])
	EndFunction

	Function getMilliSeconds:Int()
		Return Millisecs()
	EndFunction

	Function startGps()
	EndFunction

	Function getLatitiude:String()
		Return ""
	EndFunction

	Function getLongitude:String()
		Return ""
	EndFunction

	Function showAlertDialog(title:String, message:String)
	EndFunction

	Function getInputString:String()
		Return "";
	EndFunction

	Function getPixel:Int( x:int, y:int )
'		unsigned char pix[4];
'		glReadPixels(x, app->graphics->height-y ,1 ,1 ,GL_RGBA ,GL_UNSIGNED_BYTE ,pix);
'		return (pix[3]<<24) | (pix[0]<<16) | (pix[1]<<8) |  pix[2];
		Return 0
	EndFunction

	Function mouseZInit()
	EndFunction

	Function mouseZ:Float()
		Local ret:Float = BlitzMaxMouseZ() - diddy_mouseWheel
		diddy_mouseWheel = BlitzMaxMouseZ()
		Return ret
	EndFunction
EndType

Function BlitzMaxMouseZ:Float()
	Return MouseZ()
EndFunction

' ***** End diddy.bmax.bmx ******

error: pathspec 'src/diddy/native/diddy.bmax.bmx' did not match any file(s) known to git


...

no idea why git thinks this is a change

' Blue Moon
' an implementation of Lua in pure BlitzMax

SuperStrict

'Framework Brl.Blitz
'Import Brl.LinkedList
'Import Brl.Map
'Import Brl.Reflection

Import "bluecompiler.bmx"
Import "bluevm.bmx"

'Const file:String = "tests/checktable.lua"
'Const file:String = "tests/mandelbrot.lua"
'Const file:String = "tests/sieve.lua"
'Const file:String = "tests/attrib.lua"
Const file:String = "test1.lua"

Const outFile:String = "out.lua.so"

Print BlueCompiler.ShowBytecode(file)

Local code:BlueBinary = BlueCompiler.CompileFileForLoad(file)
Local vm:BlueVM = New BlueVM
Local tl:BlueLuaVal = vm.LoadObjectCode(code)

Local stk:Stack = BlueJIT.BPtoS(vm.mem.stack)
stk.retIP = Null ; stk.prevBase = Null
Local vc:Int = 10, upvars:Int = 1
stk.varp = Long Ptr(Byte Ptr(stk) + BlueJIT.STACKFRAME_INC) + upvars
stk.func = vm.funIndex[0]
stk.argv = Null	'may want to add space?
stk.retv = Null
stk.argc = 0
stk.retc = 0

Function lpr:Int(vm:BlueVM, argc:Int, argv:Long Ptr, retv:Long Ptr)
	Print vm.mem.ValToMaxString(argv[0])
	Return 0
End Function
Function addtri:Int(vm:BlueVM, argc:Int, argv:Long Ptr, retv:Long Ptr)
	Double Ptr(retv)[0] = Double Ptr(argv)[0] + Double Ptr(argv)[1] + Double Ptr(argv)[2]
	Return 1
End Function
Function ret3:Int(vm:BlueVM, argc:Int, argv:Long Ptr, retv:Long Ptr)
	Double Ptr(retv)[0] = 21
	Double Ptr(retv)[1] = 23
	Double Ptr(retv)[2] = 25
	Return 3
End Function
vm._ENV.Set("pr", vm.ValueFromFunction(lpr))
vm._ENV.Set("quux", vm.ValueFromNumber(7.5))
vm._ENV.Set("addtriple", vm.ValueFromFunction(addtri))
vm._ENV.Set("ret3", vm.ValueFromFunction(ret3))

Print "running..."
Local t:Int = MilliSecs()
Local test:Int(_:Byte Ptr) = stk.func.mcode - BlueJIT.PROLOGUESZ ; test(stk)
t = MilliSecs() - t
Print t
Print "run complete"

Print "done."
End

Rem
Local files:TList = CreateList()
Local as:String, ld:String, showHelp:Int, output:String = "a.out", doAssemble:Int = 1
Local keepAsm:Int, makeExe:Int = 1, asOpts:String, ldOpts:String, showAST:Int, showVersion:Int

?MacOS
as = "clang -m32 -c " ; ld = "clang -Wl,-no_pie -m32 -read_only_relocs suppress "
?Not MacOS
as = "gcc -m32 -c " ; ld = "gcc -m32 "
?

For Local a:Int = 1 Until AppArgs.Length
	Select AppArgs[a]
		Case "-?", "--help"
			showHelp = 1
		Case "-v"
			showVersion = 1
		Case "-o"
			If makeExe = 0
				Print "warning: -c and -o are mutually exclusive; -c is overruling -o"
			Else
				a :+ 1 ; output = AppArgs[a] ; makeExe = 2
			EndIf
		Case "-c"
			If makeExe = 2
				Print "warning: -o and -c are mutually exclusive; -o is overruling -c"
			Else
				doAssemble = 1 ; makeExe = 0
			EndIf
		Case "-s"
			keepAsm = 1
		Case "-S"
			keepAsm = 1 ; doAssemble = 0 ; makeExe = 0
		Case "--as"
			a :+ 1 ; as = AppArgs[a] + " "
		Case "--ld"
			a :+ 1 ; ld = AppArgs[a] + " "
		Case "--as-opt"
			a :+ 1 ; asOpts :+ AppArgs[a] + " "
		Case "--ld-opt"
			a :+ 1 ; ldOpts :+ AppArgs[a] + " "
		Case "--tree"
			showAST = 1 ; makeExe = 0
		Case "-w"     ; YBCodeGen.SetWarningLevel 0
		Case "--werr" ; YBCodeGen.SetWarningLevel 2
		Case "--warn" ; YBCodeGen.SetWarningLevel 1
		Default
			files.AddLast AppArgs[a]
	End Select
Next
If AppArgs.Length = 1 Then Print "ybc: no input files" ; End

If showVersion Then DisplayVersion
If showHelp Then DisplayHelp

?Win32
Local rm:String = "del /Q "
?Not Win32
Local rm:String = "rm "
?

Local allOFiles:String = ""
For Local file:String = EachIn files
	Try
		Local tree:TParseNode = YBParseFile(file)
		If showAST
			Print tree.ToString()
		Else
			YBCodeGen.Build tree
			YBAssembler.Emit file + ".s", YBCodeGen.syms, YBCodeGen.funs, YBCodeGen.vars, YBCodeGen.strs
			If doAssemble
				system_(as + asOpts + file + ".s -o " + file + ".o")
				allOFiles :+ file + ".o "
			EndIf
			If Not keepAsm
				system_ rm + file + ".s"
			EndIf
		EndIf
	Catch e:Object
		Print "Compile error:~n    " + e.ToString()
		Print "Compilation halted."
		?Debug
		Throw e
		?
		End
	End Try
Next

?Linux
Local bLib:String = "b-lib-linux"
?Not Linux
Local bLib:String = "b-lib"
?
If makeExe
	If Not FileType("b-lib.o") Then system_ as + bLib + ".s -o b-lib.o"
	system_(ld + ldOpts + "-o " + output + " " + allOFiles + " b-lib.o")
	system_(rm + allOFiles)
EndIf

Print "done."
End
End Rem
Rem
Function DisplayVersion()
	Print "Shadow SIMD Compiler: version 0.0"
End Function

Function DisplayHelp()
	Print "OVERVIEW: ybc compiler for B~n"
	Print "USAGE: ybc [options] <files>~n"
	Print "OPTIONS:~n"
	Print "  -?, --help  Display this message"
	Print "  -v          Show the compiler version"
	Print "  -o          Set the name of the output executable (default 'a.out')"
	Print "  -c          Produce separate .o files instead of an executable"
	Print "  -s          Keep text assembly .s files"
	Print "  -S          Only produce text assembly, do not assemble binaries"
	Print "  --as        Set the command to use as the assembler"
	Print "  --ld        Set the command to use as the linker"
	Print "  --as-opt    Add an option to pass to the assembler (can repeat)"
	Print "  --ld-opt    Add an option to pass to the linker (can repeat)"
	Print "  --tree      Display the AST of the program source instead of compiling"
	Print "  -w          Silence warnings"
	Print "  --werr      Convert warnings to errors"
	Print "  --warn      Notify but do not halt on warnings (default)"
End Function
End Rem

error: pathspec 'blue.bmx' did not match any file(s) known to git


Forgot to add new test file

Forgot to add new test file

refs gh-115

'For testing if including from another directory works

error: pathspec 't/data/test.mod1/inc/include.bmx' did not match any file(s) known to git


Added mak collide sample.

Added mak collide sample.

Strict

Import MaxB3D.Drivers

Const T_DUDE=1,T_WALLS=2

Type TDude
	Field mesh:TMesh
	Field speed#
End Type

Const DUDE_COUNT = 50

Graphics 800,600

SetCollisions T_DUDE,T_DUDE,COLLISION_METHOD_POLYGON,COLLISION_RESPONSE_SLIDE
SetCollisions T_DUDE,T_WALLS,COLLISION_METHOD_POLYGON,COLLISION_RESPONSE_SLIDE

Local walls:TMesh=CreateCube()
SetEntityColor walls,0,32,192
SetEntityType walls,T_WALLS
FitMesh walls,-40,0,-40,80,80,80
FlipMesh walls

Local col:TMesh=CreateCube()
FitMesh col,-1,0,-1,2,40,2
SetEntityColor col,255,0,0
SetEntityAlpha col,.75
SetEntityType col,T_WALLS
For Local k=30 To 359+30 Step 60
	Local t:TEntity=CopyEntity( col )
	SetEntityRotation t,0,k,0
	MoveEntity t,0,0,34
Next
FreeEntity col

Local camera:TCamera=CreateCamera()
SetEntityPosition camera,0,50,-46
TurnEntity camera,45,0,0

Local light:TLight=CreateLight()
TurnEntity light,45,45,0

Local player:TMesh=CreateCube()
SetEntityColor player,0,255,0
SetEntityPosition player,0,3,0
SetEntityRadius player,2
SetEntityType player,T_DUDE

Local nose:TMesh=CreateCube( player )
SetEntityColor nose,0,255,0
SetEntityScale nose,.5,.5,.5
SetEntityPosition nose,0,0,1.5

Rem
sphere=CreateSphere()
EntityShininess sphere,.5
EntityType sphere,T_DUDE

an#=0
an_step#=360.0/n_dudes

For k=1 To n_dudes
	d.Dude=New Dude
	d\entity=CopyEntity( sphere )
	EntityColor d\entity,Rnd(255),Rnd(255),Rnd(255)
	TurnEntity d\entity,0,an,0
	MoveEntity d\entity,0,2,37
	ResetEntity d\entity
	d\speed=Rnd( .4,.49 )
	an=an+an_step
Next

FreeEntity sphere

ok=True

End Rem

While Not KeyHit(KEY_ESCAPE) And Not AppTerminate()
	If KeyDown(KEY_LEFT) TurnEntity player,0,5,0
	If KeyDown(KEY_RIGHT) TurnEntity player,0,-5,0
	If KeyDown(KEY_UP) MoveEntity player,0,0,.5
	If KeyDown(KEY_DOWN) MoveEntity player,0,0,-.5
	If KeyDown(KEY_A) TranslateEntity player,0,.2,0
	If KeyDown(KEY_Z) TranslateEntity player,0,-.2,0

	Rem
	For d.Dude=Each Dude
		If EntityDistance( player,d\entity )>2
			PointEntity d\entity,player
			If KeyDown(15) TurnEntity d\entity,0,180,0
		EndIf
		MoveEntity d\entity,0,0,d\speed
	Next
	End Rem
	UpdateWorld
	RenderWorld

	Rem
	Goto skip
	If ok
		'
		'sanity check!
		'make sure nothings gone through anything else...
		'
		For d=Each Dude
			If EntityY( d\entity )<.9
				ok=False
				bad$="Bad Dude Y: "+EntityY( d\entity )
			EndIf
			For d2.Dude=Each Dude
				If d=d2 Then Exit
				If EntityDistance( d\entity,d2\entity )<.9
					ok=False
					bad$="Dude overlap!"
				EndIf
			Next
		Next
	EndIf

	If ok
		Text 0,0,"Dudes OK"
	Else
		CameraClsColor camera,255,0,0
		Text 0,0,bad$
	EndIf
	.skip
	End Rem

	Flip
Wend

error: pathspec 'doc/samples/mak/collide.bmx' did not match any file(s) known to git