Changes to sprite animation system
* Changed the names of some of the functions * Added functions for setting and returning the projection matrix of the active camera * Added a function for getting the 2D screen coordinates from a 3D vector * Added documentation for all the new functions
This commit is contained in:
8
doc/files/canvasz.txt
Normal file
8
doc/files/canvasz.txt
Normal file
@@ -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
|
||||
10
doc/files/createplanemesh.txt
Normal file
10
doc/files/createplanemesh.txt
Normal file
@@ -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
|
||||
|
||||
9
doc/files/createspriteanimation.txt
Normal file
9
doc/files/createspriteanimation.txt
Normal file
@@ -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
|
||||
4
doc/files/createwateractor.txt
Normal file
4
doc/files/createwateractor.txt
Normal file
@@ -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
|
||||
4
doc/files/getan8scenename.txt
Normal file
4
doc/files/getan8scenename.txt
Normal file
@@ -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
|
||||
6
doc/files/getnuman8scenes.txt
Normal file
6
doc/files/getnuman8scenes.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title GetNumAN8Scenes [RCBasic Doc]
|
||||
#header Function GetNumAN8Scenes(an8_project)
|
||||
|
||||
Returns the number of scenes in an an8 project
|
||||
|
||||
#ref LoadAN8
|
||||
12
doc/files/getprojectionmatrix.txt
Normal file
12
doc/files/getprojectionmatrix.txt
Normal file
@@ -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
|
||||
6
doc/files/getspriteanimation.txt
Normal file
6
doc/files/getspriteanimation.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title GetSpriteAnimation [RCBasic Doc]
|
||||
#header Function GetSpriteAnimation(sprite)
|
||||
|
||||
Returns the current animation set on a sprite
|
||||
|
||||
#ref SetSpriteAnimation
|
||||
4
doc/files/getspriteanimationframe.txt
Normal file
4
doc/files/getspriteanimationframe.txt
Normal file
@@ -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
|
||||
4
doc/files/getspriteanimationlength.txt
Normal file
4
doc/files/getspriteanimationlength.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
#title GetSpriteAnimationLength [RCBasic Doc]
|
||||
#header Function GetSpriteAnimationLength(sprite, animation)
|
||||
|
||||
Returns the number of frames in a sprite animation
|
||||
4
doc/files/getspriteanimationspeed.txt
Normal file
4
doc/files/getspriteanimationspeed.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
#title GetSpriteAnimationSpeed [RCBasic Doc]
|
||||
#header Function GetSpriteAnimationSpeed(sprite, animation)
|
||||
|
||||
Returns the frames per second of a sprite animation
|
||||
4
doc/files/getspritecurrentanimationframe.txt
Normal file
4
doc/files/getspritecurrentanimationframe.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
#title GetSpriteCurrentAnimationFrame [RCBasic Doc]
|
||||
#header Function GetSpriteCurrentAnimationFrame(sprite)
|
||||
|
||||
Returns the current frame of a sprite's animation
|
||||
4
doc/files/getspriteframe.txt
Normal file
4
doc/files/getspriteframe.txt
Normal file
@@ -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
|
||||
6
doc/files/getspriteposition.txt
Normal file
6
doc/files/getspriteposition.txt
Normal file
@@ -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
|
||||
6
doc/files/getspriterotation.txt
Normal file
6
doc/files/getspriterotation.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title GetSpriteRotation [RCBasic Doc]
|
||||
#header Function GetSpriteRotation(sprite)
|
||||
|
||||
Returns the angle the sprite is rotated by
|
||||
|
||||
#ref SetSpriteRotation RotateSprite
|
||||
6
doc/files/getspritescale.txt
Normal file
6
doc/files/getspritescale.txt
Normal file
@@ -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
|
||||
6
doc/files/getspritesize.txt
Normal file
6
doc/files/getspritesize.txt
Normal file
@@ -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
|
||||
6
doc/files/getspritesource.txt
Normal file
6
doc/files/getspritesource.txt
Normal file
@@ -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
|
||||
15
doc/files/getspritetype.txt
Normal file
15
doc/files/getspritetype.txt
Normal file
@@ -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
|
||||
4
doc/files/getworldtoviewportposition.txt
Normal file
4
doc/files/getworldtoviewportposition.txt
Normal file
@@ -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
|
||||
6
doc/files/loadan8.txt
Normal file
6
doc/files/loadan8.txt
Normal file
@@ -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
|
||||
8
doc/files/loadmeshfroman8.txt
Normal file
8
doc/files/loadmeshfroman8.txt
Normal file
@@ -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
|
||||
6
doc/files/numspriteanimationloops.txt
Normal file
6
doc/files/numspriteanimationloops.txt
Normal file
@@ -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
|
||||
8
doc/files/preupdate.txt
Normal file
8
doc/files/preupdate.txt
Normal file
@@ -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
|
||||
6
doc/files/rotatesprite.txt
Normal file
6
doc/files/rotatesprite.txt
Normal file
@@ -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
|
||||
6
doc/files/scalesprite.txt
Normal file
6
doc/files/scalesprite.txt
Normal file
@@ -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
|
||||
12
doc/files/setcameraprojectionmatrix.txt
Normal file
12
doc/files/setcameraprojectionmatrix.txt
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
12
doc/files/setprojectionmatrix.txt
Normal file
12
doc/files/setprojectionmatrix.txt
Normal file
@@ -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
|
||||
8
doc/files/setspriteanimation.txt
Normal file
8
doc/files/setspriteanimation.txt
Normal file
@@ -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
|
||||
6
doc/files/setspriteanimationframe.txt
Normal file
6
doc/files/setspriteanimationframe.txt
Normal file
@@ -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
|
||||
6
doc/files/setspriteanimationlength.txt
Normal file
6
doc/files/setspriteanimationlength.txt
Normal file
@@ -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
|
||||
6
doc/files/setspriteanimationloops.txt
Normal file
6
doc/files/setspriteanimationloops.txt
Normal file
@@ -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
|
||||
4
doc/files/setspriteanimationspeed.txt
Normal file
4
doc/files/setspriteanimationspeed.txt
Normal file
@@ -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
|
||||
4
doc/files/setspriteframe.txt
Normal file
4
doc/files/setspriteframe.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
#title SetSpriteFrame [RCBasic Doc]
|
||||
#header Sub SetSpriteFrame(sprite, frame)
|
||||
|
||||
Sets a sprite to a frame in its frame sheet
|
||||
7
doc/files/setspriterotation.txt
Normal file
7
doc/files/setspriterotation.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
#title SetSpriteRotation [RCBasic Doc]
|
||||
#header Sub SetSpriteRotation(sprite, angle)
|
||||
|
||||
Sets the angle the sprite is rotated by
|
||||
|
||||
#ref GetSpriteRotation RotateSprite
|
||||
|
||||
6
doc/files/setspritescale.txt
Normal file
6
doc/files/setspritescale.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title SetSpriteScale [RCBasic Doc]
|
||||
#header Sub SetSpriteScale(sprite, x, y)
|
||||
|
||||
Sets the scale of a sprite
|
||||
|
||||
#ref ScaleSprite GetSpriteScale
|
||||
7
doc/files/setspritesolid.txt
Normal file
7
doc/files/setspritesolid.txt
Normal file
@@ -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
|
||||
|
||||
8
doc/files/setspritesource.txt
Normal file
8
doc/files/setspritesource.txt
Normal file
@@ -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
|
||||
12
doc/files/setspritetype.txt
Normal file
12
doc/files/setspritetype.txt
Normal file
@@ -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
|
||||
6
doc/files/setspritevisible.txt
Normal file
6
doc/files/setspritevisible.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title SetSpriteVisible [RCBasic Doc]
|
||||
#header Sub SetSpriteVisible(sprite, flag)
|
||||
|
||||
Sets whether the sprite is visible
|
||||
|
||||
#ref SpriteIsVisible
|
||||
9
doc/files/setspritez.txt
Normal file
9
doc/files/setspritez.txt
Normal file
@@ -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
|
||||
|
||||
7
doc/files/spriteheight.txt
Normal file
7
doc/files/spriteheight.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
#title SpriteHeight [RCBasic Doc]
|
||||
#header Function SpriteHeight(sprite)
|
||||
|
||||
Returns the frame height of a sprite
|
||||
|
||||
#ref SpriteWidth GetSpriteSize
|
||||
|
||||
6
doc/files/spriteissolid.txt
Normal file
6
doc/files/spriteissolid.txt
Normal file
@@ -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
|
||||
6
doc/files/spriteisvisible.txt
Normal file
6
doc/files/spriteisvisible.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title SpriteIsVisible [RCBasic Doc]
|
||||
#header Function SpriteIsVisible(sprite)
|
||||
|
||||
Returns whether the sprite is visible
|
||||
|
||||
#ref SetSpriteVisible
|
||||
6
doc/files/spritewidth.txt
Normal file
6
doc/files/spritewidth.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title SpriteWidth [RCBasic Doc]
|
||||
#header Function SpriteWidth(sprite)
|
||||
|
||||
Returns the frame width of a sprite
|
||||
|
||||
#ref SpriteHeight GetSpriteSize
|
||||
7
doc/files/spritex.txt
Normal file
7
doc/files/spritex.txt
Normal file
@@ -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
|
||||
|
||||
6
doc/files/spritey.txt
Normal file
6
doc/files/spritey.txt
Normal file
@@ -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
|
||||
8
doc/files/spritez.txt
Normal file
8
doc/files/spritez.txt
Normal file
@@ -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
|
||||
7
doc/files/textheight.txt
Normal file
7
doc/files/textheight.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
#title TextHeight [RCBasic Doc]
|
||||
#header function TextHeight(txt$)
|
||||
|
||||
The height of text rendered with the active font
|
||||
|
||||
#ref TextWidth GetTextSize
|
||||
|
||||
6
doc/files/textwidth.txt
Normal file
6
doc/files/textwidth.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
#title TextWidth [RCBasic Doc]
|
||||
#header function TextWidth(txt$)
|
||||
|
||||
The width of text rendered with the active font
|
||||
|
||||
#ref TextHeight GetTextSize
|
||||
8
doc/files/translatesprite.txt
Normal file
8
doc/files/translatesprite.txt
Normal file
@@ -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
|
||||
Binary file not shown.
@@ -1238,6 +1238,10 @@ string rc_keywordToken(string sline)
|
||||
return "<num>19";
|
||||
else if(sline.compare("MD2_ANIMATION_BOOM")==0)
|
||||
return "<num>20";
|
||||
else if(sline.compare("PROJECTION_TYPE_ORTHOGRAPHIC")==0)
|
||||
return "<num>0";
|
||||
else if(sline.compare("PROJECTION_TYPE_PERSPECTIVE")==0)
|
||||
return "<num>1";
|
||||
else if(sline.compare("SPRITE_TYPE_STATIC")==0)
|
||||
return "<num>0";
|
||||
else if(sline.compare("SPRITE_TYPE_KINEMATIC")==0)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user