Documentation for Wein2DAndroid
Utility class for basic 2D box collision.
static boolean rectTouchingRect(double rect1PosX, double rect1PosY, double rect1SizeX, double rect1SizeY, double rect2PosX, double rect2PosY, double rect2SizeX, double rect2SizeY)
Returns if a rectangle collides with a rectangle.
static boolean pointInsideRect(double pointX, double pointY, double rectPosX, double rectPosY, double rectSizeX, double rectSizeY)
Returns if a point is inside a rectangle.
static boolean rectInsideRect(double rect1PosX, double rect1PosY, double rect1SizeX, double rect1SizeY, double rect2PosX, double rect2PosY, double rect2SizeX, double rect2SizeY)
Returns if a rectangle is insde of a rectangle.
Utility class for storing objects into files and retrieving them.
static void serializeObject(Object object, String filePath)
Serializes an object and saves it to a file.
/!\ The given object, all of it's fields and it's superclasses need to implement 'java.io.Serializable'.
static Object deserializeObject(String filePath)
Loads an object saved to a file, deserializes it and returns it.
Interface for the rendering methods of Wein2D.
android.graphics.Canvas getGraphics()
Tells the RenderCalls-Class which Graphics2D-Object to use.
int getWidth()
Tells the RenderCalls-Class how wide of a surface to draw on.
int getHeight()
Tells the RenderCalls-Class how high of a surface to draw on.
boolean drawingAllowed()
Tells the RenderCalls-Class if drawing is currently allowed.
default RectangleRenderCall drawRectangle()
Returns a RectangleRenderCall that can be used to draw a rectangle.
default OvalRenderCall drawOval()
Returns a OvalRenderCall that can be used to draw an oval.
default SpriteRenderCall drawSprite()
Returns a SpriteRenderCall that can be used to draw a sprite.
default TextRenderCall drawText()
Returns a TextRenderCall that can be used to draw text.
default LineRenderCall drawLine()
Returns a LineRenderCall that can be used to draw a line.
default ClearRectangleRenderCall clearRectangle()
Returns a ClearRectangleRenderCall that can be used to draw a clearing rectangle (Sets all pixels inside the rectangle to (RGBA) -> [0,0,0,0].
default void fill(int red, int green, int blue)
default void fill(int red, int green, int blue, int alpha)
Fills the screen in the given color.
Interface for representing a rendering call.
void draw()
Tells the render call to do it's drawing.
Class for simplification of rendering a rectangle.
RectangleRenderCall setPosition(double x, double y)
Sets the position of the rectangle.
RectangleRenderCall setSize(double width, double height)
Sets the size of the rectangle.
RectangleRenderCall setColor(int red, int green, int blue)
Sets the color of the rectangle (optional).
RectangleRenderCall setColor(int red, int green, int blue, int alpha)
Sets the color of the rectangle (optional).
RectangleRenderCall setAlpha(int alpha)
Sets the alpha of the rectangle (optional).
RectangleRenderCall rotateDegrees(double degreesAngle)
RectangleRenderCall rotateDegrees(double degreesAngle, double rotationCenterX, double rotationCenterY)
Rotates the rectangle (optional).
RectangleRenderCall rotateRadians(double radiansAngle)
RectangleRenderCall rotateRadians(double radiansAngle, double rotationCenterX, double rotationCenterY)
Rotates the rectangle (optional).
Class for simplification of rendering an oval.
OvalRenderCall setPosition(double x, double y)
Sets the position of the oval.
OvalRenderCall setSize(double width, double height)
Sets the size of the oval.
OvalRenderCall setColor(int red, int green, int blue)
Sets the color of the oval (optional).
OvalRenderCall setColor(int red, int green, int blue, int alpha)
Sets the color of the oval (optional).
OvalRenderCall setAlpha(int alpha)
Sets the alpha of the oval (optional).
Class for simplification of rendering a Sprite.
SpriteRenderCall setSprite(Sprite sprite)
Sets the sprite to be rendered.
SpriteRenderCall setPosition(double x, double y)
Sets the position of the sprite.
SpriteRenderCall setSize(double width, double height)
Sets the size of the sprite.
SpriteRenderCall setAlpha(int alpha)
Sets the alpha of the sprite (optional).
SpriteRenderCall setSpriteCutoutDimensions(int x, int y, int width, int height)
Defines what part of the sprite should be rendered (optional).
SpriteRenderCall rotateDegrees(double degreesAngle)
SpriteRenderCall rotateDegrees(double degreesAngle, double rotationCenterX, double rotationCenterY)
Rotates the sprite (optional).
SpriteRenderCall rotateRadians(double radiansAngle)
SpriteRenderCall rotateRadians(double radiansAngle, double rotationCenterX, double rotationCenterY)
Rotates the sprite (optional).
Class for simplification of rendering text.
public TextRenderCall setContent(String content)
Sets the content to be rendered.
TextRenderCall setPosition(double x, double y)
Sets the position of the text.
TextRenderCall setSize(double size)
Sets the size of the text.
TextRenderCall setPositioning(int textPositioning)
Sets the orientation of the text relative to the position of the text.
TextRenderCall setFontFamily(String fontFamily)
Sets the font family used for rendering (optional).
TextRenderCall setColor(int red, int green, int blue)
Sets the color of the text (optional).
TextRenderCall setColor(int red, int green, int blue, int alpha)
Sets the color of the text (optional).
TextRenderCall setAlpha(int alpha)
Sets the alpha of the text (optional).
Class for simplification of rendering a line.
LineRenderCall setStart(double x, double y)
Sets the starting position of the line.
LineRenderCall setEnd(double x, double y)
Sets the ending position of the line.
LineRenderCall setWidth(double width)
Sets the width of the line.
LineRenderCall setColor(int red, int green, int blue)
Sets the color of the rectangle (optional).
LineRenderCall setColor(int red, int green, int blue, int alpha)
Sets the color of the rectangle (optional).
LineRenderCall setAlpha(int alpha)
Sets the alpha of the rectangle (optional).
Class for simplification of clearing pixels (setting to (RGBA) -> [0,0,0,0]) in shape of a rectangle.
ClearRectangleRenderCall setPosition(double x, double y)
Sets the position of the rectangle.
ClearRectangleRenderCall setSize(double width, double height)
Sets the size of the rectangle.
ClearRectangleRenderCall rotateDegrees(double degreesAngle)
ClearRectangleRenderCall rotateDegrees(double degreesAngle, double rotationCenterX, double rotationCenterY)
Rotates the rectangle (optional).
ClearRectangleRenderCall rotateRadians(double radiansAngle)
ClearRectangleRenderCall rotateRadians(double radiansAngle, double rotationCenterX, double rotationCenterY)
Rotates the rectangle (optional).
Class for storing sound files and playing them.
Sound(int resource)
Creates a Sound from the specified resource.
void setVolume(double volume)
Sets the Sound-object's volume. Also applies to sound already in playback. 'volume' should be a value between 0 and 1.
void play()
Plays the sound. Starts from the beginning if already playing.
void loop(boolean looping)
Specifies if the sound should be looped infinitely.
void stop()
Stops playback of the sound.
boolean isPlaying()
Returns if the sound is currently played back.
Class for storing image files.
Sprite(int resource)
Creates a Sprite from the specified resource.
Sprite(int width, int height)
Creates a new empty Sprite with the specified dimensions.
int getWidth()
Returns the Sprite's width.
int getHeight()
Returns the Sprite's height.
android.graphics.Bitmap getBitmap()
Returns the Sprite as a android.graphics.Bitmap.
Describes the orientation of rendered Text.
static final int LEFT
Positions the text left of it's rendering coordinates.
static final int CENTER
Positions the text centered around it's rendering coordinates.
static final int RIGHT
Positions the text right of it's rendering coordinates.
Describes an application using Wein2DAndroid.
int width
Stores the current width of the window. Gets overwritten at the beginning of every frame.
int height
Stores the current height of the window. Gets overwritten at the beginning of every frame.
double deltaTime
Stores the time in seconds since the last frame call. Gets overwritten at the beginning of every frame.
abstract void onFrame()
Method for handling the current frame.
final void setTargetedFPS(int fps)
Sets the maximum amount of frames that are allowed.
/!\ Be careful when setting this value too high, as it may cause problems with deltaTime.
final void showKeyboard(boolean showKeyboard)
Shows the onscreen-keyboard (soft-keyboard).
final String getTypedText()
Returns the last 1000 characters that have been typed since the start of the application.
final void setTypedText(String text)
Sets the string that 'getTypedText()' returns.
final int getMouseX()
Returns the position of the mouse inside of the window on the x-axis.
final int getMouseY()
Returns the position of the mouse inside of the window on the y-axis.
final boolean getMouseL()
Returns if the left mouse button is currently pressed down.
final int getFPS()
Returns the amount of frames counted in the last second. Updates once per second.
final float[][] getFingerPositions()
Returns an array of all fingers currently touching the screen. The inner arrays store the x- (index 0) and y- (index 1) positions of the fingers.
© Copyright 2022 DevTaube