diff --git a/doc/files/canvasz.txt b/doc/files/canvasz.txt new file mode 100644 index 0000000..b4bd84b --- /dev/null +++ b/doc/files/canvasz.txt @@ -0,0 +1,8 @@ +#title CanvasZ [RCBasic Doc] +#header function CanvasZ(c_num) + +Returns the Canvas Z Order. + +Note: Canvases with a higher Z order are drawn first and those with lower values will be drawn on top + +#ref SetCanvasZ diff --git a/doc/files/createplanemesh.txt b/doc/files/createplanemesh.txt new file mode 100644 index 0000000..8fd005f --- /dev/null +++ b/doc/files/createplanemesh.txt @@ -0,0 +1,10 @@ +#title CreatePlaneMesh [RCBasic Doc] +#header Function CreatePlaneMesh( w, h, tileCount_w, tileCount_h ) + +Creates a flat plane + +#list +#li w, h - The width and height of the plane +#li tileCount_w, TileCount_h - The number of subdivisions across and down the plane +#/list + diff --git a/doc/files/createspriteanimation.txt b/doc/files/createspriteanimation.txt new file mode 100644 index 0000000..b66598e --- /dev/null +++ b/doc/files/createspriteanimation.txt @@ -0,0 +1,9 @@ +#title CreateSpriteAnimation [RCBasic Doc] +#header Function CreateSpriteAnimation(sprite, anim_length, speed) + +Returns a new sprite animation id + +#list ul +#li anim_length - number of frames in the animation +#li speed - frames per second for the animation +#/list diff --git a/doc/files/createwateractor.txt b/doc/files/createwateractor.txt new file mode 100644 index 0000000..6d4a932 --- /dev/null +++ b/doc/files/createwateractor.txt @@ -0,0 +1,4 @@ +#title CreateWaterActor [RCBasic Doc] +#header function CreateWaterActor( mesh, waveHeight, waveSpeed, waveLength ) + +Creates an actor with water properties set on a base mesh diff --git a/doc/files/getan8scenename.txt b/doc/files/getan8scenename.txt new file mode 100644 index 0000000..5fbe4e1 --- /dev/null +++ b/doc/files/getan8scenename.txt @@ -0,0 +1,4 @@ +#title GetAN8SceneName$ [RCBasic Doc] +#header Function GetAN8SceneName$(an8_project, scene_num) + +Returns the name of a scene in an an8 project diff --git a/doc/files/getnuman8scenes.txt b/doc/files/getnuman8scenes.txt new file mode 100644 index 0000000..bf95065 --- /dev/null +++ b/doc/files/getnuman8scenes.txt @@ -0,0 +1,6 @@ +#title GetNumAN8Scenes [RCBasic Doc] +#header Function GetNumAN8Scenes(an8_project) + +Returns the number of scenes in an an8 project + +#ref LoadAN8 diff --git a/doc/files/getprojectionmatrix.txt b/doc/files/getprojectionmatrix.txt new file mode 100644 index 0000000..52703a6 --- /dev/null +++ b/doc/files/getprojectionmatrix.txt @@ -0,0 +1,12 @@ +#title GetProjectionMatrix [RCBasic Doc] +#header Sub GetProjectionMatrix(matA) + +Gets the camera projection matrix for the active canvas + +Possible values for projection_type +#list ul +#li PROJECTION_TYPE_ORTHOGRAPHIC +#li PROJECTION_TYPE_PERSPECTIVE +#/list + +#ref SetProjectionMatrix diff --git a/doc/files/getspriteanimation.txt b/doc/files/getspriteanimation.txt new file mode 100644 index 0000000..f1b0da7 --- /dev/null +++ b/doc/files/getspriteanimation.txt @@ -0,0 +1,6 @@ +#title GetSpriteAnimation [RCBasic Doc] +#header Function GetSpriteAnimation(sprite) + +Returns the current animation set on a sprite + +#ref SetSpriteAnimation diff --git a/doc/files/getspriteanimationframe.txt b/doc/files/getspriteanimationframe.txt new file mode 100644 index 0000000..35d0222 --- /dev/null +++ b/doc/files/getspriteanimationframe.txt @@ -0,0 +1,4 @@ +#title GetSpriteAnimationFrame [RCBasic Doc] +#header Function GetSpriteAnimationFrame(sprite, animation, anim_frame) + +Returns the frame index in the image source that is set to anim_frame in a sprite's animation diff --git a/doc/files/getspriteanimationlength.txt b/doc/files/getspriteanimationlength.txt new file mode 100644 index 0000000..9e1a1c3 --- /dev/null +++ b/doc/files/getspriteanimationlength.txt @@ -0,0 +1,4 @@ +#title GetSpriteAnimationLength [RCBasic Doc] +#header Function GetSpriteAnimationLength(sprite, animation) + +Returns the number of frames in a sprite animation diff --git a/doc/files/getspriteanimationspeed.txt b/doc/files/getspriteanimationspeed.txt new file mode 100644 index 0000000..9a73237 --- /dev/null +++ b/doc/files/getspriteanimationspeed.txt @@ -0,0 +1,4 @@ +#title GetSpriteAnimationSpeed [RCBasic Doc] +#header Function GetSpriteAnimationSpeed(sprite, animation) + +Returns the frames per second of a sprite animation diff --git a/doc/files/getspritecurrentanimationframe.txt b/doc/files/getspritecurrentanimationframe.txt new file mode 100644 index 0000000..ab019af --- /dev/null +++ b/doc/files/getspritecurrentanimationframe.txt @@ -0,0 +1,4 @@ +#title GetSpriteCurrentAnimationFrame [RCBasic Doc] +#header Function GetSpriteCurrentAnimationFrame(sprite) + +Returns the current frame of a sprite's animation diff --git a/doc/files/getspriteframe.txt b/doc/files/getspriteframe.txt new file mode 100644 index 0000000..18a3529 --- /dev/null +++ b/doc/files/getspriteframe.txt @@ -0,0 +1,4 @@ +#title GetSpriteFrame [RCBasic Doc] +#header Function GetSpriteFrame(sprite) + +Returns the current frame in a sprite's source that it's on in its animation diff --git a/doc/files/getspriteposition.txt b/doc/files/getspriteposition.txt new file mode 100644 index 0000000..f806908 --- /dev/null +++ b/doc/files/getspriteposition.txt @@ -0,0 +1,6 @@ +#title GetSpritePosition [RCBasic Doc] +#header Sub GetSpritePosition(sprite, ByRef x, ByRef y) + +Gets the position of a sprite on the canvas + +#ref TranslateSprite SetSpritePosition diff --git a/doc/files/getspriterotation.txt b/doc/files/getspriterotation.txt new file mode 100644 index 0000000..92b3159 --- /dev/null +++ b/doc/files/getspriterotation.txt @@ -0,0 +1,6 @@ +#title GetSpriteRotation [RCBasic Doc] +#header Function GetSpriteRotation(sprite) + +Returns the angle the sprite is rotated by + +#ref SetSpriteRotation RotateSprite diff --git a/doc/files/getspritescale.txt b/doc/files/getspritescale.txt new file mode 100644 index 0000000..2934309 --- /dev/null +++ b/doc/files/getspritescale.txt @@ -0,0 +1,6 @@ +#title GetSpriteScale [RCBasic Doc] +#header Sub GetSpriteScale(sprite, ByRef x, ByRef y) + +Gets the scale of a sprite + +#ref ScaleSprite SetSpriteScale diff --git a/doc/files/getspritesize.txt b/doc/files/getspritesize.txt new file mode 100644 index 0000000..c841c9a --- /dev/null +++ b/doc/files/getspritesize.txt @@ -0,0 +1,6 @@ +#title GetSpriteSize [RCBasic Doc] +#header Sub GetSpriteSize(sprite, ByRef w, ByRef h) + +Gets the size of a sprite's frames + +#ref CreateSprite diff --git a/doc/files/getspritesource.txt b/doc/files/getspritesource.txt new file mode 100644 index 0000000..58db383 --- /dev/null +++ b/doc/files/getspritesource.txt @@ -0,0 +1,6 @@ +#title GetSpriteSource [RCBasic Doc] +#header Function GetSpriteSource(sprite) + +Returns the source image the sprite renders its frames from + +#ref SetSpriteSource CreateSprite diff --git a/doc/files/getspritetype.txt b/doc/files/getspritetype.txt new file mode 100644 index 0000000..2c789e6 --- /dev/null +++ b/doc/files/getspritetype.txt @@ -0,0 +1,15 @@ +#title GetSpriteType [RCBasic Doc] +#header Function GetSpriteType(sprite) + +Returns the collison body type of a sprite. + +By default, sprites are dynamic when they are created. + +Possible types returned +#list ul +#li SPRITE_TYPE_STATIC +#li SPRITE_TYPE_KINEMATIC +#li SPRITE_TYPE_DYNAMIC +#/list + +#ref SetSpriteType diff --git a/doc/files/getworldtoviewportposition.txt b/doc/files/getworldtoviewportposition.txt new file mode 100644 index 0000000..bca3501 --- /dev/null +++ b/doc/files/getworldtoviewportposition.txt @@ -0,0 +1,4 @@ +#title GetWorldToViewportPosition [RCBasic Doc] +#header Sub GetWorldToViewportPosition(x, y, z, ByRef x, ByRef y) + +Get the 2D coordinates for the given 3D position on the active canvas diff --git a/doc/files/loadan8.txt b/doc/files/loadan8.txt new file mode 100644 index 0000000..634043e --- /dev/null +++ b/doc/files/loadan8.txt @@ -0,0 +1,6 @@ +#title LoadAN8 [RCBasic Doc] +#header Function LoadAN8( an8_file$ ) + +Loads an an8 project and returns an id that can be used in LoadMeshFromAN8() + +#ref LoadMeshFromAN8 diff --git a/doc/files/loadmeshfroman8.txt b/doc/files/loadmeshfroman8.txt new file mode 100644 index 0000000..952142b --- /dev/null +++ b/doc/files/loadmeshfroman8.txt @@ -0,0 +1,8 @@ +#title LoadMeshFromAN8 [RCBasic Doc] +#header Function LoadMeshFromAN8(an8_project, an8_scene$) + +Loads the figures in an anim8or scene as a mesh + +Note: This only loads figures from a scene and it loads meshes not anim8or objects + +#ref LoadAN8 LoadMesh LoadMeshFromArchive diff --git a/doc/files/numspriteanimationloops.txt b/doc/files/numspriteanimationloops.txt new file mode 100644 index 0000000..60b408f --- /dev/null +++ b/doc/files/numspriteanimationloops.txt @@ -0,0 +1,6 @@ +#title NumSpriteAnimationLoops [RCBasic Doc] +#header Function NumSpriteAnimationLoops(sprite) + +Returns the number of animation loops the actor has set + +#ref SetSpriteAnimationLoops SetSpriteAnimation diff --git a/doc/files/preupdate.txt b/doc/files/preupdate.txt new file mode 100644 index 0000000..8c9a5c1 --- /dev/null +++ b/doc/files/preupdate.txt @@ -0,0 +1,8 @@ +#title PreUpdate [RCBasic Doc] +#header Sub PreUpdate( ) + +Processes physics for sprites and actors. + +This is useful if you need to know the post solve positions and rotations prior to drawing them. + +#ref Update diff --git a/doc/files/rotatesprite.txt b/doc/files/rotatesprite.txt new file mode 100644 index 0000000..cdd75cc --- /dev/null +++ b/doc/files/rotatesprite.txt @@ -0,0 +1,6 @@ +#title RotateSprite [RCBasic Doc] +#header Sub RotateSprite(sprite, angle) + +Sets the angle the sprite is rotated by relative to its current rotation + +#ref SetSpriteRotation GetSpriteRotation diff --git a/doc/files/scalesprite.txt b/doc/files/scalesprite.txt new file mode 100644 index 0000000..bf23b2e --- /dev/null +++ b/doc/files/scalesprite.txt @@ -0,0 +1,6 @@ +#title ScaleSprite [RCBasic Doc] +#header Sub ScaleSprite(sprite, x, y) + +Sets the scale of a sprite relative to its current scale + +#ref SetSpriteScale GetSpriteScale diff --git a/doc/files/setcameraprojectionmatrix.txt b/doc/files/setcameraprojectionmatrix.txt new file mode 100644 index 0000000..dd73637 --- /dev/null +++ b/doc/files/setcameraprojectionmatrix.txt @@ -0,0 +1,12 @@ +#title SetCameraProjectionMatrix [RCBasic Doc] +#header Sub SetCameraProjectionMatrix(matA, projection_type) + +Sets the camera projection matrix for the active canvas + +Possible values for projection_type +#list ul +#li PROJECTION_TYPE_ORTHOGRAPHIC +#li PROJECTION_TYPE_PERSPECTIVE +#/list + +#ref GetCameraProjectionMatrix diff --git a/doc/files/setcanvasz.txt b/doc/files/setcanvasz.txt index ec72dd1..77d9ef4 100644 --- a/doc/files/setcanvasz.txt +++ b/doc/files/setcanvasz.txt @@ -3,6 +3,6 @@ Sets the Canvas Z Order. -Note: Canvases with a lower Z order are drawn first and those with higher values will be drawn on top +Note: Canvases with a higher Z order are drawn first and those with lower values will be drawn on top #ref SetCanvasZ diff --git a/doc/files/setprojectionmatrix.txt b/doc/files/setprojectionmatrix.txt new file mode 100644 index 0000000..fe36659 --- /dev/null +++ b/doc/files/setprojectionmatrix.txt @@ -0,0 +1,12 @@ +#title SetProjectionMatrix [RCBasic Doc] +#header Sub SetProjectionMatrix(matA, projection_type) + +Sets the camera projection matrix for the active canvas + +Possible values for projection_type +#list ul +#li PROJECTION_TYPE_ORTHOGRAPHIC +#li PROJECTION_TYPE_PERSPECTIVE +#/list + +#ref GetProjectionMatrix diff --git a/doc/files/setspriteanimation.txt b/doc/files/setspriteanimation.txt new file mode 100644 index 0000000..9a4666d --- /dev/null +++ b/doc/files/setspriteanimation.txt @@ -0,0 +1,8 @@ +#title SetSpriteAnimation [RCBasic Doc] +#header Sub SetSpriteAnimation(sprite, animation) + +Sets the current animation for a sprite + +Note: Once an animation is set, it will automatically start + +#ref GetSpriteAnimation diff --git a/doc/files/setspriteanimationframe.txt b/doc/files/setspriteanimationframe.txt new file mode 100644 index 0000000..825a242 --- /dev/null +++ b/doc/files/setspriteanimationframe.txt @@ -0,0 +1,6 @@ +#title SetSpriteAnimationFrame [RCBasic Doc] +#header Sub SetSpriteAnimationFrame(sprite, animation, anim_frame, frame) + +Sets a frame in a sprite animation + +#ref GetSpriteAnimationFrame diff --git a/doc/files/setspriteanimationlength.txt b/doc/files/setspriteanimationlength.txt new file mode 100644 index 0000000..7af2d54 --- /dev/null +++ b/doc/files/setspriteanimationlength.txt @@ -0,0 +1,6 @@ +#title SetSpriteAnimationLength [RCBasic Doc] +#header Sub SetSpriteAnimationLength(sprite, animation, anim_length) + +Sets the number of frames in a sprite animation + +#ref GetSpriteAnimationLength diff --git a/doc/files/setspriteanimationloops.txt b/doc/files/setspriteanimationloops.txt new file mode 100644 index 0000000..ccbae78 --- /dev/null +++ b/doc/files/setspriteanimationloops.txt @@ -0,0 +1,6 @@ +#title SetSpriteAnimationLoops [RCBasic Doc] +#header Sub SetSpriteAnimationLoops(sprite, num_loops) + +Sets the number of animation loops for the sprite + +#ref NumSpriteAnimationLoops diff --git a/doc/files/setspriteanimationspeed.txt b/doc/files/setspriteanimationspeed.txt new file mode 100644 index 0000000..116738c --- /dev/null +++ b/doc/files/setspriteanimationspeed.txt @@ -0,0 +1,4 @@ +#title SetSpriteAnimationSpeed [RCBasic Doc] +#header Sub SetSpriteAnimationSpeed(sprite, animation, speed) + +Sets the speed in frames per second for a sprite animation diff --git a/doc/files/setspriteframe.txt b/doc/files/setspriteframe.txt new file mode 100644 index 0000000..96633de --- /dev/null +++ b/doc/files/setspriteframe.txt @@ -0,0 +1,4 @@ +#title SetSpriteFrame [RCBasic Doc] +#header Sub SetSpriteFrame(sprite, frame) + +Sets a sprite to a frame in its frame sheet diff --git a/doc/files/setspriterotation.txt b/doc/files/setspriterotation.txt new file mode 100644 index 0000000..1ca2c9f --- /dev/null +++ b/doc/files/setspriterotation.txt @@ -0,0 +1,7 @@ +#title SetSpriteRotation [RCBasic Doc] +#header Sub SetSpriteRotation(sprite, angle) + +Sets the angle the sprite is rotated by + +#ref GetSpriteRotation RotateSprite + diff --git a/doc/files/setspritescale.txt b/doc/files/setspritescale.txt new file mode 100644 index 0000000..6bce8ed --- /dev/null +++ b/doc/files/setspritescale.txt @@ -0,0 +1,6 @@ +#title SetSpriteScale [RCBasic Doc] +#header Sub SetSpriteScale(sprite, x, y) + +Sets the scale of a sprite + +#ref ScaleSprite GetSpriteScale diff --git a/doc/files/setspritesolid.txt b/doc/files/setspritesolid.txt new file mode 100644 index 0000000..bc78604 --- /dev/null +++ b/doc/files/setspritesolid.txt @@ -0,0 +1,7 @@ +#title SetSpriteSolid [RCBasic Doc] +#header Sub SetSpriteSolid(sprite, flag) + +Sets whether a sprite has physics and collision response enabled + +#ref SpriteIsSolid + diff --git a/doc/files/setspritesource.txt b/doc/files/setspritesource.txt new file mode 100644 index 0000000..ab6b476 --- /dev/null +++ b/doc/files/setspritesource.txt @@ -0,0 +1,8 @@ +#title SetSpriteSource [RCBasic Doc] +#header Sub SetSpriteSource(sprite, img) + +Changes the image source for a sprite frame sheet + +Note: This needs to be the same size as the current image source or you will have rendering issues + +#ref GetSpriteSource diff --git a/doc/files/setspritetype.txt b/doc/files/setspritetype.txt new file mode 100644 index 0000000..785e484 --- /dev/null +++ b/doc/files/setspritetype.txt @@ -0,0 +1,12 @@ +#title SetSpriteType [RCBasic Doc] +#header Sub SetSpriteType(sprite, sprite_type) + +Sets the type of collision body a sprite has + +#list ul +#li SPRITE_TYPE_STATIC +#li SPRITE_TYPE_KINEMATIC +#li SPRITE_TYPE_DYNAMIC +#/list + +#ref GetSpriteType diff --git a/doc/files/setspritevisible.txt b/doc/files/setspritevisible.txt new file mode 100644 index 0000000..1c6b8b5 --- /dev/null +++ b/doc/files/setspritevisible.txt @@ -0,0 +1,6 @@ +#title SetSpriteVisible [RCBasic Doc] +#header Sub SetSpriteVisible(sprite, flag) + +Sets whether the sprite is visible + +#ref SpriteIsVisible diff --git a/doc/files/setspritez.txt b/doc/files/setspritez.txt new file mode 100644 index 0000000..89c35e5 --- /dev/null +++ b/doc/files/setspritez.txt @@ -0,0 +1,9 @@ +#title SetSpriteZ [RCBasic Doc] +#header Sub SetSpriteZ(sprite, z) + +Sets the drawing priority for sprites. + +Note: Sprites with a higher Z order are drawn first and those with lower values will be drawn on top + +#ref SpriteZ + diff --git a/doc/files/spriteheight.txt b/doc/files/spriteheight.txt new file mode 100644 index 0000000..38dd2bf --- /dev/null +++ b/doc/files/spriteheight.txt @@ -0,0 +1,7 @@ +#title SpriteHeight [RCBasic Doc] +#header Function SpriteHeight(sprite) + +Returns the frame height of a sprite + +#ref SpriteWidth GetSpriteSize + diff --git a/doc/files/spriteissolid.txt b/doc/files/spriteissolid.txt new file mode 100644 index 0000000..842785f --- /dev/null +++ b/doc/files/spriteissolid.txt @@ -0,0 +1,6 @@ +#title SpriteIsSolid [RCBasic Doc] +#header Function SpriteIsSolid(sprite) + +Returns true if a sprite is has physics and collision response enabled + +#ref SetSpriteSolid diff --git a/doc/files/spriteisvisible.txt b/doc/files/spriteisvisible.txt new file mode 100644 index 0000000..202c2c4 --- /dev/null +++ b/doc/files/spriteisvisible.txt @@ -0,0 +1,6 @@ +#title SpriteIsVisible [RCBasic Doc] +#header Function SpriteIsVisible(sprite) + +Returns whether the sprite is visible + +#ref SetSpriteVisible diff --git a/doc/files/spritewidth.txt b/doc/files/spritewidth.txt new file mode 100644 index 0000000..1971359 --- /dev/null +++ b/doc/files/spritewidth.txt @@ -0,0 +1,6 @@ +#title SpriteWidth [RCBasic Doc] +#header Function SpriteWidth(sprite) + +Returns the frame width of a sprite + +#ref SpriteHeight GetSpriteSize diff --git a/doc/files/spritex.txt b/doc/files/spritex.txt new file mode 100644 index 0000000..15d8cfa --- /dev/null +++ b/doc/files/spritex.txt @@ -0,0 +1,7 @@ +#title SpriteX [RCBasic Doc] +#header Function SpriteX(sprite) + +Returns the X position of a sprite on a canvas + +#ref SpriteY SetSpritePosition GetSpritePosition + diff --git a/doc/files/spritey.txt b/doc/files/spritey.txt new file mode 100644 index 0000000..eec9065 --- /dev/null +++ b/doc/files/spritey.txt @@ -0,0 +1,6 @@ +#title SpriteY [RCBasic Doc] +#header Function SpriteY(sprite) + +Returns the Y position of a sprite on a canvas + +#ref SpriteX SetSpritePosition GetSpritePosition diff --git a/doc/files/spritez.txt b/doc/files/spritez.txt new file mode 100644 index 0000000..b07e400 --- /dev/null +++ b/doc/files/spritez.txt @@ -0,0 +1,8 @@ +#title SpriteZ [RCBasic Doc] +#header Function SpriteZ(sprite) + +Returns the drawing priority for sprites. + +Note: Sprites with a higher Z order are drawn first and those with lower values will be drawn on top + +#ref SetSpriteZ diff --git a/doc/files/textheight.txt b/doc/files/textheight.txt new file mode 100644 index 0000000..1741a1f --- /dev/null +++ b/doc/files/textheight.txt @@ -0,0 +1,7 @@ +#title TextHeight [RCBasic Doc] +#header function TextHeight(txt$) + +The height of text rendered with the active font + +#ref TextWidth GetTextSize + diff --git a/doc/files/textwidth.txt b/doc/files/textwidth.txt new file mode 100644 index 0000000..9865276 --- /dev/null +++ b/doc/files/textwidth.txt @@ -0,0 +1,6 @@ +#title TextWidth [RCBasic Doc] +#header function TextWidth(txt$) + +The width of text rendered with the active font + +#ref TextHeight GetTextSize diff --git a/doc/files/translatesprite.txt b/doc/files/translatesprite.txt new file mode 100644 index 0000000..21b05b6 --- /dev/null +++ b/doc/files/translatesprite.txt @@ -0,0 +1,8 @@ +#title TranslateSprite [RCBasic Doc] +#header Sub TranslateSprite(sprite, x, y) + +Move a sprite relative to its current position + +Note: This function sets the position of a sprite without regards to physics properties so it will not trigger collision detection or collision response. + +#ref SetSpritePosition GetSpritePosition diff --git a/rcbasic_build/rcbasic4_changes.ods b/rcbasic_build/rcbasic4_changes.ods index 9cf6179..5847fcb 100644 Binary files a/rcbasic_build/rcbasic4_changes.ods and b/rcbasic_build/rcbasic4_changes.ods differ diff --git a/rcbasic_build/tokenizer.h b/rcbasic_build/tokenizer.h index 57a2ef0..38ac1e4 100755 --- a/rcbasic_build/tokenizer.h +++ b/rcbasic_build/tokenizer.h @@ -1238,6 +1238,10 @@ string rc_keywordToken(string sline) return "19"; else if(sline.compare("MD2_ANIMATION_BOOM")==0) return "20"; + else if(sline.compare("PROJECTION_TYPE_ORTHOGRAPHIC")==0) + return "0"; + else if(sline.compare("PROJECTION_TYPE_PERSPECTIVE")==0) + return "1"; else if(sline.compare("SPRITE_TYPE_STATIC")==0) return "0"; else if(sline.compare("SPRITE_TYPE_KINEMATIC")==0) diff --git a/rcbasic_runtime/rc_gfx.h b/rcbasic_runtime/rc_gfx.h index 7756822..8b31990 100644 --- a/rcbasic_runtime/rc_gfx.h +++ b/rcbasic_runtime/rc_gfx.h @@ -1312,13 +1312,33 @@ int rc_cloneCanvas(int origin_canvas_id, int mode) return canvas_id; } +void rc_getWorldToViewportPosition(double x, double y, double z, double* vx, double* vy) +{ + if(!VideoDriver) + return; + + if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size()) + return; + + if(!rc_canvas[rc_active_canvas].texture) + return; + + if(!rc_canvas[rc_active_canvas].camera.camera) + return; + + irr::scene::ISceneCollisionManager* collman = SceneManager->getSceneCollisionManager(); + + irr::core::vector2di vpos = collman->getScreenCoordinatesFrom3DPosition(irr::core::vector3df(x, y, z), rc_canvas[rc_active_canvas].camera.camera); + *vx = vpos.X; + *vy = vpos.Y; +} + + void rc_setClearColor(Uint32 color) { rc_clear_color.set(color); } - - Uint32 rc_rgba(Uint32 r, Uint32 g, Uint32 b, Uint32 a) { irr::video::SColor color(a, r, g, b); diff --git a/rcbasic_runtime/rc_gfx3D.h b/rcbasic_runtime/rc_gfx3D.h index a6ca9f5..3c675b0 100644 --- a/rcbasic_runtime/rc_gfx3D.h +++ b/rcbasic_runtime/rc_gfx3D.h @@ -6717,6 +6717,37 @@ double rc_getCameraNearValue() return rc_canvas[rc_active_canvas].camera.camera->getNearValue(); } +void rc_setCameraProjectionMatrix(int proj_matrix, int proj_type) +{ + if(!(rc_active_canvas > 0 && rc_active_canvas < rc_canvas.size())) + return; + + if(proj_matrix < 0 || proj_matrix >= rc_matrix.size()) + return; + + if(!rc_matrix[proj_matrix].active) + return; + + irr::core::matrix4 irr_mat = rc_convertToIrrMatrix(proj_matrix); + bool isOrtho = (proj_type == RC_PROJECTION_TYPE_ORTHOGRAPHIC); + rc_canvas[rc_active_canvas].camera.camera->setProjectionMatrix(irr_mat, isOrtho); +} + +void rc_getCameraProjectionMatrix(int proj_matrix) +{ + if(!(rc_active_canvas > 0 && rc_active_canvas < rc_canvas.size())) + return; + + if(proj_matrix < 0 || proj_matrix >= rc_matrix.size()) + return; + + if(!rc_matrix[proj_matrix].active) + return; + + irr::core::matrix4 pmat = rc_canvas[rc_active_canvas].camera.camera->getProjectionMatrix(); + rc_convertFromIrrMatrix(pmat, proj_matrix); +} + void rc_addSceneSkyBox(int img_top, int img_bottom, int img_left, int img_right, int img_front, int img_back) { diff --git a/rcbasic_runtime/rc_gfx_core.h b/rcbasic_runtime/rc_gfx_core.h index c9316ce..f88c8b0 100644 --- a/rcbasic_runtime/rc_gfx_core.h +++ b/rcbasic_runtime/rc_gfx_core.h @@ -316,6 +316,9 @@ struct rc_physicsWorld2D_obj #define RC_CANVAS_TYPE_3D 1 #define RC_CANVAS_TYPE_SPRITE 2 +#define RC_PROJECTION_TYPE_ORTHOGRAPHIC 0 +#define RC_PROJECTION_TYPE_PERSPECTIVE 1 + struct rc_canvas_obj { irr::video::ITexture* texture; diff --git a/rcbasic_runtime/rc_spritelib.h b/rcbasic_runtime/rc_spritelib.h index eb71df5..cad66c6 100644 --- a/rcbasic_runtime/rc_spritelib.h +++ b/rcbasic_runtime/rc_spritelib.h @@ -204,7 +204,7 @@ int rc_getSpriteAnimation(int spr_id) return rc_sprite[spr_id].current_animation; } -int rc_getSpriteActiveAnimationFrame(int spr_id) +int rc_getSpriteCurrentAnimationFrame(int spr_id) { if(spr_id < 0 || spr_id >= rc_sprite.size()) return -1; @@ -216,7 +216,7 @@ int rc_getSpriteActiveAnimationFrame(int spr_id) return rc_sprite[spr_id].animation[current_animation].current_frame; } -void rc_loopSpriteAnimation(int spr_id, int num_loops) +void rc_setSpriteAnimationLoops(int spr_id, int num_loops) { if(spr_id < 0 || spr_id >= rc_sprite.size()) return; @@ -391,6 +391,41 @@ void rc_deleteSprite(int spr_id) } } +void rc_setSpriteSource(int spr_id, int img_id) +{ + if(spr_id < 0 || spr_id >= rc_sprite.size()) + return; + + if(!rc_sprite[spr_id].active) + return; + + if(img_id < 0) + { + rc_sprite[spr_id].image_id = -1; + return; + } + + if(img_id >= rc_image.size()) + return; + + if(!rc_image[img_id].image) + return; + + rc_sprite[spr_id].image_id = img_id; +} + +int rc_getSpriteSource(int spr_id) +{ + if(spr_id < 0 || spr_id >= rc_sprite.size()) + return -1; + + if(!rc_sprite[spr_id].active) + return -1; + + return rc_sprite[spr_id].image_id; +} + + void rc_setSpriteType(int spr_id, int body_type) { if(spr_id < 0 || spr_id >= rc_sprite.size()) @@ -402,6 +437,17 @@ void rc_setSpriteType(int spr_id, int body_type) rc_sprite[spr_id].physics.body->SetType((b2BodyType) body_type); } +int rc_getSpriteType(int spr_id) +{ + if(spr_id < 0 || spr_id >= rc_sprite.size()) + return -1; + + if(!rc_sprite[spr_id].active) + return -1; + + return (int)rc_sprite[spr_id].physics.body->GetType(); +} + void rc_setSpriteSolid(int spr_id, bool flag) { if(spr_id < 0 || spr_id >= rc_sprite.size())