Types
Animation
Animations are created from an Animation Script
. Each animation tracks
the current frame for one animation sequence. You update this animation
and draw with it. This allows you to have the one script being used to
create lots of individual animations, where each animation is potentially
at a different frame.
Animation Script
Animations in SplashKit are controlled by an animation script. This script tells SplashKit how long to play each frame, which cell in the bitmap the frame relates to, and which is the next frame. You load these scripts from file and can then use them to create animations that are used with the drawing options when you draw a bitmap.
Bitmap
Bitmaps represent image resources in SplashKit. You can load these from file, download them from the internet, or create and draw them yourself. Once created or loaded, you can draw the bitmap and you can draw onto the bitmap.
Circle
Circles have a center point and a radius. This means that, unlike shapes
like the Rectangle
, the circle extends out both left and right, and up
and down from the point you position it at.
- Fields
-
Name Type Description Center The center point of the circle
Radius Double
The radius of the circle
Color
Colors can be used when drawing shapes and clearing surfaces. Color in splashkit does include a alpha value used for opacity, which allows you to have partially transparent colors.
- Fields
-
Name Type Description R Float
The red component of the color (between 0 and 1.0)
G Float
The green component of the color (between 0 and 1.0)
B Float
The blue component of the color (between 0 and 1.0)
A Float
The alpha component of the color (between 0 and 1.0)
Display
Each display value represents a physical display attached to the computer. You can use this to query the displays position and size.
Drawing Dest
Determines the effect of the camera on a drawing operation.
- Constants
-
Name Description Draw To Screen means camera has no affect.
Draw To World means camera has an affect.
Draw Default means camera has an affect only if drawn to a window.
Drawing Options
Drawing options allow you to customise drawing options. These should be initialised using the drawing option functions.
- Fields
-
Name Type Description Dest Void
The destination of the drawing: a window or bitmap.
Scale X Float
How much x values are scaled.
Scale Y Float
How much y values are scaled.
Angle Float
A rotation angle for bitmap drawing.
Anchor Offset X Float
The x location of the anchor point around which bitmap drawing will rotate.
Anchor Offset Y Float
The y location of the anchor point around which bitmap drawing will rotate.
Flip X Boolean
Should bitmaps be flipped horizontally
Flip Y Boolean
Should bitmaps be flipped vertically
Is Part Boolean
Indicates that part of a bitmap should be drawn
Part The area of the bitmap to draw
Draw Cell Integer
Which cell of a bitmap to draw, or -1 for all. Overrides parts and animation settings.
Camera How the current window camera affects the drawing
Line Width Integer
How wide are lines (only lines at this stage)
Anim The animation to use, which overrides the part option
Font
Fonts are used to draw text in SplashKit. These can be loaded from file or downloaded from the internet. Once you have a font you can use the draw text procedures to use that font when drawing.
Font Style
Use font styles to set the style of a font. Setting the style is time consuming, so create alternative font variables for each different style you want to work with. Note that these values can be logical ORed together to combine styles, e.g. BoldFont or ItalicFont = both bold and italic.
- Constants
-
Name Description Normal Font Normal font.
Bold Font Bold font.
Italic Font Italic font.
Underline Font Underlined font.
HTTP Status Code
Defines the HTTP status codes supported by SplashKit. Refer to this article for a detailed description of each code.
- Constants
-
Name Description HTTP Status Ok The server accepted the request.
HTTP Status Created The request has been fulfilled, resulting in the creation of a new resource.
HTTP Status No Content The server successfully processed the request and is not returning any content.
HTTP Status Bad Request The server cannot or will not process the request due to an apparent client error.
HTTP Status Unauthorized The server requires authentication or has failed to process provided authentication.
HTTP Status Forbidden The request was a valid request, but the server is refusing to respond to it.
HTTP Status Not Found The requested resource could not be found but may be available in the future.
HTTP Status Method Not Allowed The request method is not support for the requested resource.
HTTP Status Request Timeout The server timed out waiting for the request.
HTTP Status Internal Server Error The server encountered an unexpected condition.
HTTP Status Not Implemented The server does not recognize or implement the request method.
HTTP Status Service Unavailable The server is currently unavailable.
Line
A line goes from a start point to an end point.
Point 2D
A Point2D represents an location in Cartesian coordinates (x,y). The x value represents the distance from the left edge of the window or bitmap, increasing in value as you travel right. The y value represents the distance from the top edge of the window or bitmap, and increases as you travel down toward the bottom.
Point2D is a great way to keep track of the location of something in a 2D space like a Window or Bitmap.
- Fields
-
Name Type Description X Double
The distance from the left side of the bitmap or window ( increasing as you go to the right)
Y Double
The distance from the top of a bitmap or window (increasing as you go down).
Quad
Quads (quadrilaterals) are shapes with 4 sides, but unlike Rectangle
,
these shapes can have axis that do not line up with screen/bitmap axis.
Points should be constructed with the top left as the first point, top right as the second, bottom left as the third, and bottom right as the last point. Other orders may give unexpected outcomes.
- Fields
-
Name Type Description Points The array of points: top left, top right, bottom left, bottom right
Rectangle
Rectangles are simple rectangle shapes that exist at a point and have a
set width and height. This means that the rectangle always has edges that
follow the sides of the Window
or Bitmap
(so they are aligned with
the x and y axes). The rectangle's position is its top left corner - it
then extends to the right and down from this position.
- Fields
-
Name Type Description X Double
The distance to the left edge of the rectangle
Y Double
The distance to the top edge of the rectangle
Width Double
The width of the rectangle
Height Double
The height of the rectangle
Triangle
A triangle consists of three points, being the three points of the triangle.
- Fields
-
Name Type Description Points The points of the triangle
Vector 2D
Vectors represent a direction and distance, and can be visualised as an
arrow from one point to another in 2 dimensional space. Internally, the
Vector 2D
is stored as its x and y components.
Vector is a great way to represent movement or forces. You could use a
Vector 2D
to track how much a character moves each update (as the
vector stores the direction and distance). Similarly, you could use a
Vector 2D
to represent gravity or other forces. You can then
add a number of force vectors together to get a final force to be applied
to a character.
- Fields
-
Name Type Description X Double
The distance to move horizontally
Y Double
The distance to move vertically