|
|
JumpStart 3.19 LUA Interface API
Classes:
Class:
TImage
The TImage class is used to load images from the disk into the SDL engine. The images loaded can be of types PNG (reccommended), BMP, TGA, or TIFF. They must be in the power of 2 size (ex: 128x128, 96x64, 32x32, etc...).
Methods:
function
LoadFromFile(FileName)
Use LoadFromFile to load an existing image from the system. Images must be in a power of two size. Can load; PNG (Reccommended), BMP, TGA and TIFF.
function
Draw(X, Y[, PatternIndex])
Draw displays the image or image pattern at position x, y on the screen.
function
DrawTiled(X, Y, NumRepeatX, NumRepeatY[, PatternIndex])
Draw displays the image or image pattern at position x, y NumRepeatX times wide and NumRepeatY times high.
function
CreatePatternRects(PatternWidth, PatternHeight)
Call CreatePatternRects to automatically generate pattern rectangles for an image. This is useful when you have sprite sheets or other such images that have all of the cells of equal size.
function
PatternHeight(PatternIndex): Height
Returns the height of the pattern at PatternIndex.
function
PatternWidth(PatternIndex): Width
Returns the width of the pattern at PatternIndex.
function
PatternRect(PatternIndex): X, Y, Width, Height
Returns the X, Y, Width, and Height of the pattern at PatternIndex.
function
SetPatternRect(PatternIndex, X, Y, Width, Height)
Use SetPatternRect to set a pattern rectangle for a given pattern index.
Properties:
propperty
Name
File name or unique name for the image, you can pretty much ignore this property.
propperty
ImageSurface
This is the raw pointer to the SDL surface for the image. This can be used with the SDL methods that have been wrapped up in the engine.
propperty
Transparent
A boolean flag that is used to check if an image is transparent or set the image's transparent value.
propperty
Height
Full height of the image.
propperty
PatternCount
Used to get the number of patterns an image has or to set the number of patterns an image should have. Must be called before SetPatternRect.
Sample Code:
MyImage = TImage:new()
MyImage:LoadFromFile('Test.png')
function OnRender()
MyImage:Draw(0, 0)
end
Class:
TSprite
TSprite is the base class for all sprites within the main system. It surfaces basic things such as image and pattern handeling. It can be used for static sprites and images that require basic collision.
Methods:
function
Draw(FrameTime)
Draw the current sprite at its X and Y location using its current PatternIndex.
function
SetBoundsRect(Left, Top, Right, Bottom)
Set the Bounding Collision Rectangle (or Ellipse) for the sprite.
Properties:
propperty
Image
The TImage that the sprite should use for rendering.
propperty
PatternIndex
PatternIndex of the Image property that should be used when the sprite is drawn.
propperty
X
X location of the sprite.
propperty
Y
Y location of the sprite.
propperty
ZIndex
ZIndex is the sorting index for the sprite, the higher the number the later that it is rendered (meaning the more on top it is). Its also used for collision detection, sprites on different ZIndexes do not get collision tested against one another.
propperty
OnCollide
This property sets up the sprites collision handler event. Set this property to a function name to have that function called when the sprite collides with another sprite.
Class:
TAnimatedSprite
TAnimatedSprite surfaces a sprite with built in animation handeling. Take a look through the demos for a better idea of how to use this class.
Methods:
function
Draw(FrameTime)
function
Reset()
function
SetBoundsRect(Left, Top, Right, Bottom)
Properties:
propperty
Image
propperty
PatternIndex
propperty
X
propperty
Y
propperty
ZIndex
propperty
OnCollide
propperty
AnimSpeed
propperty
AnimStart
propperty
AnimEnd
propperty
AnimIndex
propperty
AnimReverse
propperty
OnAnimEnd
Class:
TTiledBackground
TTiledBackground surfaces the standard rectuangular tiled map class. Take a look at the SimpleSpriteDemo for a sample of how to use this component, you may also look at Tank Brigade for more information.
Methods:
function
Draw(FrameTime)
function
SetSize(TilesWide, TilesHigh)
function
TileImage( X, Y )
Properties:
propperty
Image
propperty
PatternIndex
propperty
X
propperty
Y
propperty
ZIndex
propperty
OnCollide
propperty
TileWidth
propperty
TileHeight
propperty
TilesWide
propperty
TilesHigh
propperty
Width
propperty
Height
Class:
TTileImage
TTileImage is a sub component of TTiledBackground, use it only as a reference, as creating one may cause the system to fail.
Methods:
Properties:
propperty
PatternIndex
propperty
Image
Class:
TSound
TSound is the base class for non-background music sounds. Use it to load WAV and OGG files for replaying at a later time.
Methods:
function
LoadFromFile(FileName)
function
Play()
function
PlayNewChannel(NewChannelNumber)
function
Stop()
Properties:
propperty
Name
propperty
Volume
propperty
Channel
propperty
Playing
Class:
TSoundEngine
The sound engine is used to manage all sound objects, you should seldom need to actually work with the sound engine.
Methods:
function
AddSoundFile(FileName)
function
AddSound(ExistingSound)
function
Delete(ItemIndex)
function
Remove(ExistingSound)
function
Next()
function
Previous()
function
First()
function
Last()
function
Reset()
function
Play()
function
Stop()
function
Sound(Index)
Properties:
propperty
Count
propperty
Playing
propperty
IsPlaying
propperty
Channel
Class:
TTTFFont
TTTFFont Surfaces a way to interact with standard Windows True Type Fonts within the game engine. It should be noted that the ttf file you are trying to load must be placed in your games path. ImageFonts tend to have a better render quality then true type fonts.
new(FontFile, FontSize)
Methods:
function
TextOut(X, Y, WhatText)
Properties:
propperty
FontColor
propperty
Height
Class:
TImageFont
TImageFont surfaces a way to interact with
"
Bitmap
"
fonts, these are image that contain all characters that the font represents. Take a look at just about any demo to see an example of this being used. ImageFonts tend to have a better render quality then true type fonts.
Methods:
function
TextOut(X, Y, WhatText)
function
CharPattern(Character)
function
SetCharPattern(Char, Pattern)
function
CharWidth(Char)
function
CharHeight(Char)
Properties:
propperty
Image
Class:
TGUIElement
TGUIElement is the base class for all extendable GUI elements. See the GUI demo application to learn more.
Events:
function
BeforeDraw()
function
Draw()
function
AfterDraw()
function
OnMouseDown(MouseX, MouseY, LeftDown, RightDown, MiddleDown)
function
OnMouseUp(MouseX, MouseY, LeftDown, RightDown, MiddleDown)
function
OnClick(MouseX, MouseY, LeftDown, RightDown, MiddleDown)
function
OnMouseWheel(MouseX, MouseY, WheelDelta)
function
OnKeyDown(KeyCode, ShiftState, Unicode)
function
OnKeyUp(KeyCode, ShiftState, Unicode)
Properties:
propperty
X
propperty
Y
propperty
Width
propperty
Height
propperty
Enabled
propperty
Visible
propperty
Focused
Globals:
Objects:
Object:
Screen
The global Screen object can be used to access common variables and actions associated with the SDL surface that JumpStart uses for its rendering context.
Properties:
propperty
FPS
propperty
Width
propperty
Height
propperty
Surface
propperty
AppPath
Methods:
function
Clear(Color)
function
Flip()
Object:
SpriteEngine
SpriteEngine is a global object for the management of all of the game sprites within the system. Most of the time all you will need to do is call SpriteEngine:Draw(FrameTime) within one of your render loops.
Properties:
propperty
Count
propperty
RenderCount
propperty
RenderLevels
propperty
X
propperty
Y
propperty
CollisionEngine
Methods:
function
Draw(FrameTime)
function
Sort(FullIndex)
function
Moved(ASpriteInstance)
function
Add(ASprite)
function
Remove(ASprite)
function
ImageCollide(ImageX, ImageY, Image, PatternIndex, CollisionWithSprite)
function
HitTest(X, Y)
function
Clear()
Object:
Mouse
Mouse is a global object used to surface common aspects of the system mouse. See the MouseSimpleExample demo for more information.
Properties:
propperty
X
propperty
Y
propperty
LeftButton
propperty
RightButton
propperty
MiddleButton
Object:
Music
Music is the background music handler. Unlike Sounds there can only be one Music handler for an SDL application. Common features such as load, play, next, and previous are surfaced through this object.
Properties:
propperty
Count
propperty
Playing
propperty
Current
propperty
Volume
Methods:
function
AddMusicFile(FileName)
function
Delete(Index)
function
Next()
function
Previous()
function
First()
function
Last()
function
Play()
function
PlaySong(Index)
function
Stop()
Methods:
function
SDL_putenv(EnvStatement)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_getenv(EnvVarName)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_PutPixel(DstSurface, x, y, pixel)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_AddPixel(DstSurface, x, y, pixel)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_SubPixel(DstSurface, x, y, pixel)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_DrawLine(DstSurface, x, y, x2, y2, Color[, DashLength, DashSpace])
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_AddLine(DstSurface, x1, y1, x2, y2, Color)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_SubLine(DstSurface, x1, y1, x2, y2, Color)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_AddSurface(SrcSurface, SrcRect, DestSurface, DestRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_SubSurface(SrcSurface, SrcRect, DestSurface, DestRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_MonoSurface(SrcSurface, SrcRect, DestSurface, DestRect, Color)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_TexturedSurface(SrcSurface, SrcRect, DestSurface, DestRect, Texture, TextureRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ZoomSurface(SrcSurface, SrcRect, DstSurface, DstRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_FlipRectH(DstSurface, Rect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_FlipRectV(DstSurface, Rect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ScrollY(DstSurface, DifY)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ScrollX(DstSurface, DifX)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_RotateDeg(DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, Angle)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_RotateRad(DstSurface, SrcSurface, SrcRect, DestX, DestY, OffsetX, OffsetY, Angle)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_FillRectAdd(DstSurface, dstrect, color)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_FillRectSub(DstSurface, dstrect, color)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_GradientFillRect(DstSurface, Rect, StartColor, EndColor, Style)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_2xBlit(Src, Dest)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_Scanline2xBlit(Src, Dest)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_50Scanline2xBlit(Src, Dest)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ORSurface(SrcSurface, SrcRect, DestSurface, DestRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ANDSurface(SrcSurface, SrcRect, DestSurface, DestRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_GTSurface(SrcSurface, SrcRect, DestSurface, DestRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_LTSurface(SrcSurface, SrcRect, DestSurface, DestRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_PixelTest(SrcSurface1, SrcRect1, SrcSurface2, SrcRect2, Left1, Top1, Left2, Top2)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_GetPixel(SrcSurface, x, y)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
PSDLRect(aLeft, aTop, aWidth, aHeight)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDLRect(aLeft, aTop, aWidth, aHeight)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ScaleSurfaceRect(SrcSurface, SrcX1, SrcY1, SrcW, SrcH, Width, Height)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
ValidateSurfaceRect(DstSurface, dstrect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_PixelTestSurfaceVsRect(SrcSurface1, SrcRect1, SrcRect2, Left1, Top1, Left2, Top2)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SDL_ClipLine(x1, y1, x2, y2, ClipRect)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
GetMouseState():X, Y, State
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
IsBitSet(Source, BitMask):Boolean
Use IsBitSet to tell if a bitmask is set within a source number.
function
JoystickUpdate()
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickClose(Joystick)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
NumJoysticks()
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickName(Index)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickOpen(Index)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickOpened(Index)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickIndex(Joystick)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickNumAxes(Joystick)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickNumBalls(Joystick)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickNumHats(Joystick)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickNumButtons(Joystick)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickEventState(state)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickGetAxis(joystick, axis)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickGetHat(joystick, hat)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickGetBall(joystick, ball, dx, dy)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
JoystickGetButton(joystick, Button)
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
SetCaption(NewCaption)
Sets the caption of the current game window.
function
IsKeyDown(KeyCode):Boolean
Tests to see if a key is down (See KEY_ in the global/values).
function
LogError(ErrorMessage[, Location])
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
LogWarning(WarningMessage[, Location])
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
LogStatus(StatusMessage[, Location])
This method is a wrapper around the standard SDL library method. See the standard SDL documentation around this method and its usage.
function
Close()
Closes the currently running game instance.
function
CreateThreadedProcess(ThreadTable, ThreadMethod[, ThreadName])
This method is extremely unstable and should not be used.
function
SetVideoMode(Width, Height, BitsPerPixel, [FullScreen = false])
Use SetVideoMode to setup the render window options.
function
HexToInt(HexString)
Use HexToInt to take a hex string and convert it to a number.
function
GetTickCount()
Returns the current system time in milliseconds, good for timing across all platforms.
function
RenderGUI()
Call this method to have all enabled TGUIElement's rendered to the game screen.
function
Handler(AnEventName[, NewHandler]):AnEventHandler
Handler is a dual purpose method. You can use it to set an event handler (Handler('OnClick', 'MyClickHandler')) or get back the current event handler (WhatHandler = Handler('OnClick')).
function
char(CharacterCode, ...):Character, ...
Converts a character code (numeric) or series of character codes to their corrisponding characters (ASCII).
function
ord(Character, ...):CharacterCode, ...
Converts a character (ASCII) or series of characters to their respective character codes (numerical).
Values:
Value:
SoundAvailable
Used to tell if SDL could initialize a sound engine when it started up.
Value:
JOY_AXIS_THRESHOLD
Working file: API3.19.xml |