-
Notifications
You must be signed in to change notification settings - Fork 0
Daze
A camera object
public class Daze.Camera
: GameObject, GameScriptFields
| Type | Name | Summary |
|---|---|---|
Sprite |
background | |
Boolean |
isFixed | It set the camera to being fixed. A fixed camera cannot move, and the GameObjects can't go out of his limits |
Limits |
limits | The bounds of the camera, you can use them to check if an object is out or in the camera. You shouldn't edit them, they are updated automatically as the Camera moves. NOTE: if you need to avoid GameObjects going out of camera and your camera doesn't move just set the camera to be fixed; |
Properties
| Type | Name | Summary |
|---|---|---|
Collider |
collider | The collider of the Camera. (Except for the fact that the camera can't have a collider :P) |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
move(Single xOffset, Single yOffset) |
This move the camera |
void |
pushPixelPosition() | |
void |
setBackGround(Bitmap background) |
This set the background of the Camera. |
A collider that use a circle as it's shape... wow, so unexpected.
public class Daze.CircleCollider
: ColliderFields
| Type | Name | Summary |
|---|---|---|
Circle |
circle | The circle that's used to perform collision checks |
Properties
| Type | Name | Summary |
|---|---|---|
Single |
ray | The radius of the circle |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
collide(Collider otherCollider) |
Check if this collider collides with another one |
Boolean |
inCollider(Point point) |
This method check if a point is inside the Collider |
void |
moveCollider(GameObject gameObject) |
This force the coordinates recalculation for this collider when the gameObject is moved |
void |
recreateCollider() | This force the coordinates recalculation for this collider |
void |
rotateCollider(GameObject gameObject) |
This force the coordinates recalculation for this collider when the gameObject is rotated (since this is a circle rotating it is totally pointless, don't use this please :( ) |
This class represent a collider
public abstract class Daze.ColliderFields
| Type | Name | Summary |
|---|---|---|
GameObject |
gameObject | The gameObject of this collider |
Properties
| Type | Name | Summary |
|---|---|---|
Single |
ray | The maximum distance from the center and a vertex of this collider |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
collide(Collider otherCollider) |
A method to check if a collider is colliding with this one |
Boolean |
inCollider(Point point) |
This method check if a point is inside the Collider |
Boolean |
inCollider(Single x, Single y) |
This method check if a point is inside the Collider |
void |
moveCollider() | This move the collider, it will be called automatically when his gameObject is moved |
void |
moveCollider(GameObject gameObject) |
This move the collider, it will be called automatically when his gameObject is moved |
void |
recreateCollider() | It forces the collider's coordinates recalculation |
void |
rotateCollider() | It forces the collider's coordinates recalculation after a gameObject rotation |
void |
rotateCollider(GameObject gameObject) |
It forces the collider's coordinates recalculation after a gameObject rotation |
A general collider that can have different shapes as long as it's shape is convex
public abstract class Daze.ConvexPolygonCollider
: ColliderFields
| Type | Name | Summary |
|---|---|---|
ConvexPolygon |
polygon | The polygon used to check collisions |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
collide(Collider collider2) |
This check if this collider is colliding with another one |
Boolean |
inCollider(Point point) |
This method check if a point is inside the Collider |
void |
moveCollider(GameObject gameObject) |
This update the collider's coordinates after that the gameObject moves |
void |
rotateCollider(GameObject gameObject) |
This forces the collider's coordinates recalculation after that the gameObject rotates |
This is the core class of Daze, call Engine.Start() to start your game
public static class Daze.EngineStatic Fields
| Type | Name | Summary |
|---|---|---|
Int32 |
_drawBufferHeight | |
Int32 |
_drawBufferWidth | |
Byte[] |
drawBuffer | |
Int32 |
drawBufferStride | |
DrawingMethod |
drawingMethod | |
Action |
gotFocus | You can hook up an action to the engine to know when the game is active again and make it resume |
Action |
lostFocus | You can hook up an action to the engine to know when the game is not active and make it stop |
MouseEventHandler |
mouseClick | |
MouseEventHandler |
mouseDoubleClick | |
MouseEventHandler |
mouseDown | |
MouseEventHandler |
mouseMove | |
MouseEventHandler |
mouseUp | |
List<Wav> |
playingWavs | |
Boolean |
printFpsFlag | Setting this flag to true will show the FPS count in the console and the difference between the game cycle and the draw time, you should use it only if you are experiencing heavy FPS drop and you have no idea what's going on |
Dictionary<String, Sprite> |
sprites | |
Boolean |
stopCycle | |
Dictionary<String, String> |
wavPaths |
Static Properties
| Type | Name | Summary |
|---|---|---|
Camera |
camera | This is the camera that is showing on the screen (Daze currently support only one camera) |
Boolean |
cursorHide | Setting this to true or false will show of hide the cursor |
Single |
deltaTime | Use this function to make your game frame rate independent, an example: by multiplying 2 in the Update for this you are basically saying 2 per second |
Int32 |
drawBufferHeight | The height of the screen |
Int32 |
drawBufferWidth | The width of the screen |
GameForm |
window | This is the window that is showing the game, theorically you shouldn't need it, but if you want to do something particular... go for it ;) |
Static Methods
| Type | Name | Summary |
|---|---|---|
void |
AddGameObject(GameObject gameObject) |
NOT RECOMMENDED: This method add forcefully a gameObject in the gameObjects list, when a gameObject is created it is automaticaly added to the list, don't use this method if you are not sure what you are doing |
void |
clean(GameObject gameObject, SpriteSet spriteSet = null) |
|
void |
DeleteGameObject(GameObject gameObject) |
Delete a gameObject from the gameObject list |
void |
drawSprite(Sprite sprite, Int32 xPosition, Int32 yPosition) |
|
GameObject[] |
findGameObjects() | Get all the gameObject currently in the Game |
List<GameObjectClass> |
findGameObjects() | Get all the gameObject currently in the Game |
Boolean |
gameObjectExists(GameObject gameObject) |
Check if a GameObject exists currently |
Boolean |
isGameObjectDestroyed(GameObject gameObject) |
Check if a GameObject is destroyed |
Sprite |
loadSprite(String resource_Name, Single scale = 1) |
This method load a Sprite from a resource. After that you loaded a sprite in this way the next load for the same sprite will not happen and you will just get a reference to the Sprite, so feel free to call it for every GameObject you need, you won't slow down the game due to I/O operations. |
Wav |
loadWavFromFile(String filePath, Int32 volume = 100, Boolean loop = False) |
This method load a wav from a file |
Wav |
loadWavFromResources(String resource_Name, Int32 volume = 100, Boolean loop = False, Assembly callerAssembly = null) |
This method load a Wav from a resource embedded in your project |
void |
playWavFromFile(String filePath) |
This method play a Wav from a file. Using this method you don't need to manage the Wav initialization and disposition when the sound ends |
void |
playWavFromResources(String resource_Name, Int32 volume = 100) |
This method play a Wav from the resources. Using this method you don't need to manage the Wav initialization and disposition when the sound ends |
void |
Start(Int32 FPSLimit = 60, RenderingSize renderingSize = SIZE_1280X720, DrawingMethod drawingMethod = REDRAW_GAMEOBJECTS) |
This function start the Engine |
void |
Stop() | This stop the Engine, Use this to close the game |
The form used by the Engine to show the game, you have no need to use this.
public class Daze.GameForm
: Form, IComponent, IDisposable, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate, ISupportOleDropSource, IDropTarget, ISynchronizeInvoke, IWin32Window, IArrangedElement, IBindableComponent, IContainerControlFields
| Type | Name | Summary |
|---|---|---|
Bitmap |
buffer | |
Boolean |
focus | |
Boolean |
loaded |
Methods
| Type | Name | Summary |
|---|---|---|
void |
cursorHide() | |
void |
cursorShow() | |
void |
updateImage() |
public class Daze.GameObject
: GameScriptFields
| Type | Name | Summary |
|---|---|---|
GameObject |
_lastCollision | This contain the GameObject that collided with this one in the last movement (NULL if there was no collision) |
Int32 |
drawLayer | The position of the GameObject on the Z axis (note: the Z axis is Only used for drawing's priority) |
Boolean |
executeStart | |
List<IgnoreLayer> |
ignoreLayers | The layers of colliders that this GameObjects should ignore while checking collisions |
IntVector |
lastPixelPosition | The position of the gameObject on the screen in the last Cycle |
Sprite |
lastSprite | |
Int32 |
lastTimerIndex | |
MouseEventHandler |
mouseClick | You can add handler here to manage the click on this gameObject |
MouseEventHandler |
mouseDoubleClick | You can add handler here to manage the double click on this gameObject |
MouseEventHandler |
mouseDown | You can add handler here to manage the mouse down event on this gameObject |
MouseEventHandler |
mouseMove | You can add handler here to manage the mouse movement inside this gameObject |
MouseEventHandler |
mouseUp | You can add handler here to manage the mouse up event on this gameObject |
List<Timer> |
newTimers | The timers of this gameObject created in this game cycle NOT RECOMMENDED: You should use the default functions related to timers for editing |
IntVector |
pixelPosition | The position of the gameObject on the screen |
Point |
position | The position of the gameObject |
List<Timer> |
timers | The timers of this gameObject excluding the new created ones NOT RECOMMENDED: You should use the default functions related to timers for editing |
List<Timer> |
toDeleteTimers | The timers of this gameObject to be deleted at the end of this game cycle NOT RECOMMENDED: You should use the default functions related to timers for editing |
Properties
| Type | Name | Summary |
|---|---|---|
Collider |
collider | The collider of this GameObject, colliders can have various shapes and they do adapt to the SpriteSet size |
GameObject |
lastCollision | Returns the object that collided with this Object in the last movement, can be NULL |
Single |
rotation | The rotation of the gameObjects |
SpriteSet |
spriteSet | The SpriteSet for this gameObject |
Methods
| Type | Name | Summary |
|---|---|---|
GameObject |
checkCollisions() | Check if this object collides with some other objects. |
Timer |
createTimer(Int32 timerID, Int32 msPerTick, Action tickAction, Int32 currentMS) |
|
Timer |
createTimer(Int32 timerID, Int32 msPerTick, Action tickAction, Boolean restartFlag = True, Int32 currentMS = 0) |
|
void |
delete() | Deletes this gameObject, is just a call to the Engine.DeleteGameObject function |
Timer |
getTimer(Int32 timerID) |
It retrives a Timer in this GameObject from its ID |
Boolean |
move(Vector offset) |
This function moves the gameObject of a certain offset |
Boolean |
move(Single xOffset, Single yOffset) |
This function moves the gameObject of a certain offset |
void |
OnCollisionEnter() | This method is called when this object is colliding with another Object, the collision data are in the lastCollision property |
void |
pushLastPixelPosition() | |
void |
pushPixelPosition() | |
Boolean |
removeTimer(Int32 timerID) |
It deletes a Timer in this GameObject from its ID |
void |
Start() | This method is called once after the Object is created and before the first Update. |
void |
Update() | This method is called every game cycle, here you should check your timers, input flags, process movements and so on. |
A GameScript is a script called by the Engine when it starts and then automatically every Game Cycle
public interface Daze.GameScriptMethods
| Type | Name | Summary |
|---|---|---|
void |
Start() | This method is called just once, just after the script initialization |
void |
Update() | A method that keep being called continuosly |
This is a layer for ignoring collisions, you can add Types or specific gameObjects to a layer. Adding a layer to a gameObject make that gameObject unable to collide with everything that is inside the layer
public class Daze.IgnoreLayerFields
| Type | Name | Summary |
|---|---|---|
List<GameObject> |
gameObjects | The list of gameObjects that should be ignored while checking collisions |
List<Type> |
types | The list of Types of gameObjects that should be ignored while checking collisions |
A collider with the shape of a rectangle.
public class Daze.RectangleCollider
: ConvexPolygonColliderProperties
| Type | Name | Summary |
|---|---|---|
Single |
ray | The distance from the center to a vertex of the rectangle (Pratically it's half of a diagonal) |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
collide(Collider collider2) |
This function check if a collider is colliding with this one |
void |
moveCollider(GameObject gameObject) |
This force the recalculation of the coordinates after the gameObject moves |
void |
recreateCollider() | This recalculate every coordinate of the collider |
A Sprite in daze is a array of bytes representing a Bitmap.
public class Daze.SpriteProperties
| Type | Name | Summary |
|---|---|---|
Int32 |
bytesPerPixel | How many bytes a pixel takes |
Int32 |
height | The height of the sprite |
Byte[] |
pixelArray | The array of pixels that represent this sprite |
Int32 |
stride | The length of a line of pixel of this sprite measured in bytes |
Int32 |
width | The width of the sprite |
A spriteSet is a list of sprites with a timer, it can be used to create an animation
public class Daze.SpriteSetFields
| Type | Name | Summary |
|---|---|---|
Size |
size | The size of an image of this spriteSet |
Properties
| Type | Name | Summary |
|---|---|---|
Int32 |
changeMS | The number of milliseconds that the SpriteSet will wait before going to the next Sprite |
Int32 |
index | The index of the spriteSet in the sprites array |
Int32 |
minX | The starting X of the first coloured pixel, this is used to draw just the coloured part of a sprite and not an alpha part (if present) |
Int32 |
minY | The starting Y of the first coloured pixel, this is used to draw just the coloured part of a sprite and not an alpha part (if present) |
Boolean |
repeat | Set to true to make this SpriteSet cycle Sprites automatically |
Sprite |
sprite | The sprite currently used from this SpriteSet |
Int32 |
spriteCount | |
Int32 |
timerID | The ID of the timer used by this SpriteSet, SpriteSets always use negative timer IDs. |
Methods
| Type | Name | Summary |
|---|---|---|
Boolean |
next() | This method forcefully change the SpriteSet's Sprite without waiting till the right time to change it This can be helpful in case you want to use the Sprite manually without using the default timer. True if there wasn't a next sprite and the animation restarted from the start |
Boolean |
prev() | This method forcefully change the SpriteSet's Sprite to the previous one without waiting till the right time to change it This can be helpful in case you want to use the Sprite manually without using the default timer. True if there wasn't a next sprite and the animation restarted from the start |
void |
reset() | This reset the SpriteSet, making it go back to the first Sprite and restart the Timer for changing images |
void |
rotate() | This method update the rotation of this SpriteSet |
A timer of a GameObject, gameObject can have several timers, you can edit them by using gameObject.createTimer and so on.
public class Daze.TimerFields
| Type | Name | Summary |
|---|---|---|
Single |
currentMS | The current milliseconds of this timer |
Boolean |
restartFlag | If this flag is set to true the timer will automatically restart after it ticks, otherwise you will have to start it again manually |
Action |
tickAction | The action that this timer execute every time it reach the msPerTick number of milliseconds |
Properties
| Type | Name | Summary |
|---|---|---|
Int32 |
ID | The ID of the timer |
Int32 |
msPerTick | The number of MS of the duration of this timer |
Methods
| Type | Name | Summary |
|---|---|---|
void |
restart() | This method restart the timer. |
void |
set(Int32 msPerTick, Int32 currentMS = 0) |
This method can be used to set the timer again in one line |
Boolean |
ticked() | Return true if the time ticked NOTE: this method will also restart the timer if the resetFlag is true |
A Wav is exactly what you would expect... a Wav. You can create it from resources using Engine.loadWavFromResources
public class Daze.WavProperties
| Type | Name | Summary |
|---|---|---|
Boolean |
disposeAtEnd | Set to true to make the Wav remove from the Engine managed Wavs at the end of the sound |
Boolean |
loop | Set to true to make the Wav restart after it finished playing. |
Int32 |
volume | The volume of this Wav, it goes from 0 to 100 |
Methods
| Type | Name | Summary |
|---|---|---|
void |
Pause() | You don't really need this comment, do you? (It pause the sound) |
void |
Play() | You don't really need this comment, right? (It start the sound) |
void |
Stop() | You don't really need this comment, do you? (It stop the sound) |