Crate shura

Crate shura 

Source

Modules§

animation
Access to animations inspired by bevy_tweening
audio
Access to rodio
bytmuck
gamepad
Access to gilrs
gui
Access to egui
image
Access to image
log
Access to the logging abstraction over env_logger and modified version of wasm_logger
mint
Access to mint to convert between the diffrent math types
na
Access to nalgebra, the math library used by shura
physics
Access to the to rapier2d
rand
Access to some easy randomizer functions
text
Text rendering inspired by wgpu_text
wgpu
Access to wgpu for creating custom graphics.
winit
Access to winit.

Macros§

register
Register multiple components at once
sets
Wrapper for getting multiple ComponentSets
sets_mut
Wrapper around unsafeties of getting multiple ComponentSets
sets_mut_of
Wrapper around unsafeties of getting multiple ComponentSets
sets_of
Wrapper for getting multiple ComponentSets from the specified groups

Structs§

AABB
Simple Axis-aligned minimum bounding box collision detection
BlendComponent
Describes a blend component of a BlendState.
BlendState
Describe the blend state of a render pipeline, within ColorTargetState.
Camera
2D Camera for rendering
CameraBuffer
Holds the Uniform with the matrix of a Camera and the Model of the fov.
CameraMatrix
Color
RGBA color represented by 4 floats between 0 and 1.
ColorWrites
Color write mask. Disabled color channels will not be written to.
ComponentConfig
The configuration of a component type. This configuration is used to statically define behaviour of a component type for perfomance and utility reason.
ComponentHandle
Handle for a component. Through these handles components can be easily be fetched every frame with a specific type through the component or component_mut method or without a specific type through the boxed_component or boxed_component_mut method from the context
ComponentManager
Access to the component system
ComponentSet
Set of components from the same type only from the specified (groups)crate::Group
ComponentSetMut
Set of mutable components from the same type only from the specified (groups)crate::Group
ComponentTypeId
TypeId of a struct that derives from the component macro. The diffrence to the std::any::TypeId is, that this TypeId is const and is the same on every system.
Context
Context to communicate with the game engine to access components, scenes, camera, physics and much more.
DeserializeWrapper
Wrapper to deserialize structs deriving from component or state
Duration
A Duration type to represent a span of time, typically used for system timeouts.
EmptyComponent
Dummy component that should not be rendered to the screen
FrameManager
Acces to various frame information.
Gpu
Holds the connection to the GPU using wgpu. Also has some default buffers, layouts etc.
GpuConfig
Configuration of the wgpu limits, features and backend graphics api
GpuDefaults
Holds default buffers, shaders, sprites and layouts needed by shura.
Group
Groups can be used like a chunk system to make huge 2D worlds possible or to just order your components. The Engine has a default Group with the default handle. After every update and before rendering, the set of active groups gets computed.
GroupHandle
Unique identifier of a group
Index
Represents the order in which Vertices are drawn in a triangle.
Input
Manage input from touch devices, keyboards, mice and gamepads.
InputEvent
Event of a InputTrigger that holds the trigger and the time of the event.
InstanceBuffer
Buffer holding multiple Positions in form of Matrices.
InstanceData
Single vertex of a model. Which hold the coordniate of the vertex and the texture coordinates.
InstanceIndex
Index of a Position in a InstanceBuffer represented by a Matrix
InstanceIndices
Range of InstanceIndex
Model
2D Model represented by its Vertices and Indices.
ModelBuilder
Builder to easily create a Model.
Modifier
Represents the current state of the keyboard modifiers
NewScene
Create a new Scene from scratch
PositionBuilder
Easily create a PositionComponent with a position and scale.
PositionComponent
Component that is rendered to the screen by its given position and scale.
RawSet
RecycleScene
Add a Scene that previously has been removed.
RenderConfig
Configuration passed to Renderer
RenderEncoder
Encoder of Renderers and utilities to copy, clear and render text onto RenderTargets
RenderTarget
Texture to render onto with a RenderEncoder
Renderer
Render grpahics to the screen or a sprite. The renderer can be extended with custom graphcis throught the RenderPass or the provided methods for shura’s shader system.
Scene
Scene owning its own Components, Configurations, callbacks(resized, switched, started), states and camera identified by an Id
SceneDeserializer
Helper to deserialize Components and States of a serialized Scene
SceneManager
Access to the scenes.
SceneSerializer
Helper to serialize Components and States of a Scene
ScreenConfig
Configurations of handling the Screen. This can be configured per Scene
ScreenTouch
Indicates if the screen is touched anywhere.
SerializedScene
Reload a Scene from its serialized state
Shader
Shader following the shura shader system. The vertex shader is the same along every shader and is provided by shura.
ShaderConfig
Properties of a Shader
Shura
Core of the game engine.
ShuraConfig
Configuration for the base of the game engine
Sprite
2D Sprite used for rendering
SpriteSheet
Collection of Sprites that will be loaded from the same image where all sprites have the same size.
StateManager
Manager of States
StateTypeId
TypeId of a struct that derives from the state macro. The diffrence to the std::any::TypeId is, that this TypeId is const and is the same on every system.
Uniform
Uniform abstraction used to send data to the GPU. You can use the uniform in the shader by binding it via the Renderer. You should look that every Uniform is 16 byte aligned since not all gpu.devices / browser support other aligned values.
Vertex
Single vertex of a model. Which hold the coordniate of the vertex and the texture coordinates.
WgpuBase
Base Wgpu objects needed to create any further graphics object.
WorldCamera
Limits a Camera to always maintain the aspect ratio of the window. This behaviour can be controlled through the WorldCameraScale. This camera is also in charge of deciding which Groups is active based on if the Groups intersects with the camera.

Enums§

BlendFactor
Alpha blend factor.
BlendOperation
Alpha blend operation.
BufferOperation
Describes when the Matrix of the components should be bufferd.
CameraUse
Defines which camera should be used for rendering
ComponentFilter
Filter components by groups
ComponentStorage
Defines how to component gets stored. It is either a signle, multiple of it can be stored or it has multiple groups
EndReason
GroupActivation
Decides when a group is active.
InputTrigger
Trigger of a key-like event
Key
Symbolic name for a keyboard key.
ModelIndexBuffer
Indexbuffer of a Model. This is either a ‘custom’ one for the Model or a shared one. For example all rectangles have the same IndexBuffer, so we don’t need to have a seperate one for every Rectangle.
MouseButton
Describes a button of a mouse controller.
RenderConfigCamera
Camera used for rendering. Allow to easily select a default camera from shura or to use a custom camera. All default cameras are living inside the GpuDefaults.
RenderConfigInstances
Instances used for rendering
RenderConfigTarget
Target to render onto
ShaderField
Field that is present in the shader.
UpdateOperation
Defines the update of a component
WorldCameraScale
Defines how the WorldCamera gets scaled. This ensures that your game is responsive on various screens.

Constants§

VERSION
Shura version

Traits§

BaseComponent
Base of every component. Provides a method to generate a 2D Matrix, so the component can be rendered to the screen.
ComponentController
A controller is used to define the behaviour of a component, by the given config and callbacks.
ComponentDerive
All components need to implement from this trait. This is not done manually, but with the derive macro Component.
ComponentIdentifier
Trait to identify a struct that derives from the Component macro using a ComponentTypeId
FieldNames
Fields names of a struct used for deserialization and serialization
SceneCreator
Origin of a Scene
StateDerive
StateIdentifier
Trait to identify a struct that derives from the State macro using a StateTypeId

Functions§

vector
Create a 2D vector

Type Aliases§

BoxedComponent
Boxed component, that can be downcasted to any Component using downcast_ref or downcast_mut.
FxHashMap
Type alias for a hashmap using the fx hash algorithm.
FxHashSet
Type alias for a hashmap using the fx hash algorithm.
Instant
Isometry
A 2-dimensional direct isometry using a unit complex number for its rotational part.
Matrix
A stack-allocated, column-major, 2x2 square matrix.
Point
A statically sized 2-dimensional column point.
Rotation
A 2D rotation represented as a complex number with magnitude 1.
Translation
A 2-dimensional translation.
UnitVector
A stack-allocated, 2-dimensional unit vector.
Vector
A stack-allocated, 2-dimensional column vector.
Vector3
A stack-allocated, 3-dimensional column vector.
Vector4
A stack-allocated, 4-dimensional column vector.

Attribute Macros§

main
This macro helps setup a cross plattform main method

Derive Macros§

Component
All components need to derive from a BaseComponent. This macro is used to make this more easily
State
All scene- and globalstates must derive from this macro.