MiniB3D Compile Error

Monkey Programming Forums/User Modules/MiniB3D Compile Error

Irvau(Posted 2014) [#1]
So, I'm new to MiniB3D (and Monkey X as a whole), so I've been looking around at some tutorials and stuff. I tried making my own simple app, but it didn't compile and execute. I keep on getting an error: "Cannot convert from Into to TMesh". Here's the code:

format_codebox('
Strict

Import mojo
Import minib3d


Class Game Extends App

Field Camera:TCamera
Field Light:TLight
Field Floor:TMesh
Field Started:Bool

Method OnCreate%()
SetUpdateRate 30
SetRender()
Return 0
End


Method OnUpdate%()
If KeyHit(KEY_CLOSE) Or KeyHit(KEY_ESCAPE) Then Error ""
If Not Started Then Return 0
UpdateWorld()
Return 0
End


Method Init:Void()
Camera = CreateCamera()
Camera.PositionEntity 0,0,0
Floor = CreatePlane()
Floor.PositionEntitiy 0,5,0
Light = CreateLight(2)
Light.PositionEntitiy 0,2,0
End


Method OnRender%()
Init()
If Not Started Then Return 0
RenderWorld()
Return 0
End
End

Function Main%()
New Game
Return 0
End
')

It just won't compile right. It points to the "Floor = CreatePlane()" segment as the offending line.
I'd really like some help understanding this, so I can compile something with it for once. Thanks in advance!


Cocopino(Posted 2014) [#2]
@ Irvau

According to Adam, CreatePlane should be or have been removed from the code because it didn't render right.
You can use CreateGrid(x,y) instead.

Also, looking at your code, there's no trigger that switches Started to true, so probably nothing ever gets rendered ;)


Irvau(Posted 2014) [#3]
@Cocopino
OHHHHHH......
ok.
It'd really help if documentation existed for miniB3D. Apparently you can look through the module code to figure out the commands, but I'm not too keen on trying that.
Oh, and about that "no trigger" thing: I really don't care right now about that, really. It would be nice to at least get a black screen window before I started worrying about rendering.
But thanks for the notice anyways!


Irvau(Posted 2014) [#4]
@Cocopino (and anyone else out there)
Well, I tried that, and that part worked fine. However, now the compiler stumbles on "Floor.PositionEnitity". It then opens up the code for the MiniB3D module pointing to a specific line. It also pops up a window saying "Memory Access Violation".
D:
I need help once again. Please?


Cocopino(Posted 2014) [#5]
Yes, documentation would sure be nice :)
The module more or less tries to mimic this list: http://www.blitzmax.com/b3ddocs/command_list_3d_cat.php so maybe that is of a bit of help.

Your code doesn't run for me either, first error I encountered was the misspelling of "Floor.PositionEntitiy" (should be PositionEntity). But since you're only trying to run whatever kind of program, here's a simple setup of a light, a camera and a spinning cube:

format_codebox('
Import mojo
Import minib3d

Function Main()
New Game
End

Class Game Extends App

Field cam:TCamera
Field cube:TMesh
Field light:TLight

Field init_gl:Bool = False

Method OnCreate()
SetUpdateRate 30
End

Method Init()

If init_gl Then Return

SetRender()

cube = CreateCube()
cube.EntityColor(255, 100, 100)

cam = CreateCamera()
cam.CameraClsColor(0, 0, 80)
cam.PositionEntity(0.5, 1, -5)
cam.PointEntity(cube)

light = CreateLight(2)
light.PositionEntity(1, 2, -2)
light.PointEntity(cube)

init_gl = True

End

Method OnUpdate()

If KeyHit(KEY_CLOSE) Or KeyHit(KEY_ESCAPE) Then Error ""
If Not init_gl Then Init(); Return

cube.TurnEntity(1, 0, 1)
UpdateWorld()

End

Method OnRender()

If not init_gl Then Init(); Return
RenderWorld()

End

End
')

Some more advanced examples can be found in your modules/minib3d/examples folder.
Good luck!


Irvau(Posted 2014) [#6]
Thanks for that code!
Oh, and, yeah... I messed up on the spelling there. :/
Well, even when I corrected the spelling, it still wouldn't compile. It worked whenever I added the "int trigger", for some reason. ???
Anyways, I'll probably just base myself of off that. Thanks!