Crate comfy

Source

Re-exports§

pub use comfy_core;
pub use comfy_wgpu;

Modules§

anyhow
githubcrates-iodocs-rs
backtrace
A library for acquiring a backtrace at runtime
bytemuck
This crate gives small utilities for casting between plain data types.
chrono
Chrono: Date and Time for Rust
color_backtrace
Colorful and clean backtraces on panic.
crossbeam
Tools for concurrent programming.
egui
egui: an easy-to-use GUI in pure Rust!
egui_plot
Simple plotting library for egui.
egui_winit
egui bindings for winit.
env_logger
A simple logger that can be configured via environment variables, for use with the logging facade exposed by the log crate.
epaint
A simple 2D graphics library for turning simple 2D shapes and text into textured triangles.
etagere
Dynamic texture atlas allocation using the shelf packing algorithm.
fmt
Utilities for formatting and printing Strings.
fontdue
Fontdue is a font parser, rasterizer, and layout tool.
fxhash
Fx Hash
hecs
A handy ECS
image
Overview
include_dir
An extension to the include_str!() and include_bytes!() macro for embedding an entire directory tree into your binary.
inline_tweak
Tweak any literal directly from your code, changes to the source appear while running the program. It works by parsing the file when a change occurs.
kira
Kira
log
A lightweight logging facade.
notify
Cross-platform file system notification library
num_traits
Numeric traits for generic mathematics
once_cell
Overview
pollster
Pollster
random
rayon
Data-parallelism library that makes it easy to convert sequential computations into parallel
smallvec
Small vectors in various sizes. These store a certain number of elements inline, and fall back to the heap for larger allocations. This can be a useful optimization for improving cache locality and reducing allocator traffic for workloads that fit within the inline buffer.
spatial_hash
spin_sleep
Accurate sleeping. Only use native sleep as far as it can be trusted, then spin.
wgpu
A cross-platform graphics and compute library based on WebGPU.
wgpu_types
This library describes the API surface of WebGPU that is agnostic of the backend. This API is used for targeting both Web and Native.
winit
Winit is a cross-platform window creation and event loop management library.

Macros§

bail
Return early with an error.
bitflags
Generate a flags type.
cfg_if
The main macro provided by this crate. See crate documentation for more information.
comfy_game
create_engine_post_processing_shader
debug
Logs a message at the debug level.
define_asset_dir
define_main
define_versions
engine_shader_source
error
Logs a message at the error level.
hash
hashmap
Create a HashMap from a list of key-value pairs
info
Logs a message at the info level.
lazy_static
reloadable_shader_source
simple_game
span
span_with_timing
trace
Logs a message at the trace level.
tweak
warn
Logs a message at the warn level.

Structs§

AABB
Affine2
A 2D affine transform, which can represent translation, rotation, scaling and shear.
AnimatedSprite
AnimatedSpriteBuilder
Animation
AnimationState
Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
Arena
Container that can have elements inserted into it and removed from it.
AssetLoader
AssetSource
Assets
AtomicCell
A thread-safe mutable memory location.
AtomicRef
A wrapper type for an immutably borrowed value from an AtomicRefCell<T>.
AtomicRefCell
A threadsafe analogue to RefCell.
AtomicRefMut
A wrapper type for a mutably borrowed value from an AtomicRefCell<T>.
AtomicTimingGuard
AtomicU64
An integer type which can be safely shared between threads.
AudioManager
Controls audio from gameplay code.
AudioManagerSettings
Settings for an AudioManager.
AudioSystem
AudioSystemImpl
Backtrace
Representation of an owned and self-contained backtrace.
BiHashMap
A bimap backed by two HashMaps.
BindableTexture
BloodCanvas
Bloom
BloomPrefilterSettings
Applies a threshold filter to the input image to extract the brightest regions before blurring them and compositing back onto the original image. These settings are useful when emulating the 1990s-2000s game look.
BloomSettings
Applies a bloom effect to an HDR-enabled 2d or 3d camera.
BurstTimer
CachedImageLoader
CameraUniform
CanvasBlock
ChangeTracker
Color
ColorCurve
CombatText
CommandBuffer
Records operations for future application to a World
Complex
A complex number in Cartesian form.
Cooldowns
Counter
Curve
DampedSpring
DebugDraw
DebugMark
DebugMeta
DefaultHasher
The default Hasher used by RandomState.
DespawnAfter
DevConfig
Draw
DrawParams
DrawText
DrawTextureParams
DrawTextureProParams
Drawable
Duration
A Duration type to represent a span of time, typically used for system timeouts.
EguiRenderRoutine
EngineContext
EngineState
Entity
Lightweight unique ID, or handle, of an entity
Errors
Events
ExponentialMovingAverage
FilterBuilder
Configures a filter effect.
FilterHandle
Controls a filter effect.
FisherYates
Implementation of Fisher-Yates algorithm. This is modified version of https://github.com/adambudziak/shuffle/blob/master/src/fy.rs
FlashingColor
FollowPlayer
FontHandle
Opaque handle to a user font.
FrameDataUniform
FrameParams
GameConfig
GlobalLightingParams
GlobalParams
GlobalState
Glyph
GraphicsContext
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
HashSet
A hash set implemented as a HashMap where the value is ().
HotReload
IRect
IVec2
A 2-dimensional vector.
ImageButtonParams
Index
Index type for Arena that has a generation attached to it.
Instance
InstanceRaw
Instant
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
Lazy
A value which is initialized on the first access.
Light
LightUniform
LightingState
LoadedImage
MainCamera
Mat3
A 3x3 column major matrix.
Mat4
A 4x4 column major matrix.
Mesh
MeshDrawData
MeshGroupKey
MipmapGenerator
MovingAverage
MovingStats
Name
Notification
Notifications
OnceCell
A thread-safe cell which can be written to only once.
OrderedFloat
A wrapper around floats providing implementations of Eq, Ord, and Hash.
Particle
ParticleDraw
ParticleDrawData
ParticleSystem
Path
A slice of a path (akin to str).
PerfCounters
Pin
A pointer which pins its pointee in place.
PlaySoundCommand
PlaySoundParams
PlayerTag
PointLight
PostProcessingEffect
QuadDraw
QuadUniform
QueuedLine
QueuedTexture
Range
A (half-open) range bounded inclusively below and exclusively above (start..end).
RawDrawParams
RbdSyncSettings
Rc
A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference Counted’.
Rect
RefCell
A mutable memory location with dynamically checked borrow rules
ReloadableShaderSource
Stores both a static source code for a shader as well as path to its file in development. This is used for automatic shader hot reloading.
RenderTargetId
RenderTargetParams
ReverbBuilder
Configures a reverb effect.
RichText
ScreenshotItem
ScreenshotParams
SemanticVer
Shader
ShaderId
Opaque handle to a shader. The ID is exposed for debugging purposes. If you set it manually, you’re on your own :)
ShaderInstance
ShaderInstanceId
Represents a set of shader uniform parameters.
ShaderMap
ShaderUniformTable
SimpleAnimation
SimpleGame
Size
SizedBuffer
SmallVec
A Vec-like container that can store a small number of elements inline.
Sound
SoundAssetData
Sprite
SpriteDraw
SpriteVertex
Spritesheet
StaticSoundData
A piece of audio loaded into memory all at once.
StaticSoundHandle
Controls a static sound.
StaticSoundSettings
Settings for a static sound.
Stats
Stopwatch
A Stopwatch is a struct that track elapsed time when started.
StyledGlyph
TaskGuard
TaskTimer
TextParams
TextRasterizer
Texture
TextureAssetData
TextureCreationParams
Timer
Tracks elapsed time. Enters the finished state once duration is reached.
TimingEntry
TimingGuard
Timings
TrackBuilder
Configures a mixer track.
TrackHandle
Controls a mixer track.
Trail
Transform
Tween
UVec2
A 2-dimensional vector.
UniformBindGroup
UserRenderPipeline
UserRenderTarget
ValueRange
ValueTracker
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector.
VecChooseIter
VecDeque
A double-ended queue implemented with a growable ring buffer.
Velocity
WeightedIndex
A distribution using weighted sampling of discrete items
WgpuRenderer
WgpuTextureCreator
Window
Represents a window.
World
An unordered collection of entities, each having any number of distinctly typed components

Enums§

AnimationSource
AssetData
AudioTrack
Axis
BlendMode
BloomCompositeMode
BufferType
BurstState
Cow
A clone-on-write smart pointer.
DrawItem
DynamicImage
A Dynamic Image
ElementState
Describes the input state of a key.
Entry
A view into a single entry in a map, which may either be vacant or occupied.
Event
Describes a generic event.
FadeInDuration
FadeType
ImageSizeResult
KeyCode
MouseButton
MouseScrollDelta
Describes a difference in the mouse scroll wheel state.
Ordering
Atomic memory orderings
Poll
Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.
Position
PowerPreference
RecordingMode
RenderPipeline
ResolutionConfig
ScreenVal
SpriteAlign
TextAlign
TextureHandle
TrailRef
Uniform
UniformDef
Value
Volume
A change in volume of a sound.
WindowEvent
Describes an event from a [Window].

Constants§

ALICE_BLUE
ANTIQUE_WHITE
AQUAMARINE
AUDIO_SYSTEM
AZURE
BEIGE
BISQUE
BLACK
BLANK
BLOOM_MIP_LEVEL_COUNT
BLUE
BROWN
CAMERA_BIND_GROUP_PREFIX
CANVAS_BLOCK_SIZE
COMBAT_TEXT_LIFETIME
COMFY_BLUE
COMFY_DARK_BLUE
COMFY_GREEN
COMFY_PINK
COPY_SHADER_SRC
CRIMSON
CYAN
DARKBLUE
DARKBROWN
DARKGRAY
DARKGREEN
DARKPURPLE
DARKRED
DARK_GRAY
DARK_GREEN
EXIT_GAME_FLAG
FHD_RATIO
FRAG_SHADER_PREFIX
FUCHSIA
GOLD
GRAY
GREEN
INDIGO
LIGHTGRAY
LIME
LIME_GREEN
LINE_W
MAGENTA
MAROON
MAX_LIGHTS
MIDNIGHT_BLUE
NAVY
NEW_GAME_FLAG
OLIVE
ORANGE
ORANGE_RED
PAUSE_DESPAWN
PAUSE_PHYSICS
PI
Archimedes’ constant (π)
PINK
PURPLE
QUAD_VERTICES
RED
SALMON
SEA_GREEN
SHADER_POST_PROCESSING_VERTEX
SILVER
SKYBLUE
TEAL
TOMATO
TRANSPARENT
TURQUOISE
USER_SHADER_PREFIX
VIOLET
WHITE
YELLOW
YELLOW_GREEN
Z_DEBUG

Statics§

ASSETS
BLOOD_CANVAS
CAMERA_BOUNDS
COMMANDS
ERRORS
GLOBAL_PARAMS
GLOBAL_STATE
MAIN_CAMERA
SINGLE_PARTICLES
TO_DESPAWN_QUEUE
WORLD

Traits§

Any
A trait to emulate dynamic typing.
ChooseRandom
CommandEncoderExtensions
ComplexExt
DerefMut
Used for mutable dereferencing operations, like in *v = 1;.
DeviceExt
Utility methods not meant to be in the main API.
DeviceExtensions
Distribution
Types (distributions) that can be used to create a random instance of T.
DynamicBundle
A dynamically typed collection of components
EntityExtensions
ErrorHandlingExtensions
EtagereRectExtensions
F32Extensions
FromParallelIterator
FromParallelIterator implements the creation of a collection from a ParallelIterator. By implementing FromParallelIterator for a given type, you define how it will be created from an iterator.
Future
A future represents an asynchronous computation obtained by use of async.
GameLoop
Hash
A hashable type.
Hasher
A trait for hashing an arbitrary stream of bytes.
IndexedParallelIterator
An iterator that supports “random access” to its data, meaning that you can split it at arbitrary indices and draw data from those points.
IntoParallelIterator
IntoParallelIterator implements the conversion to a ParallelIterator.
IntoParallelRefIterator
IntoParallelRefIterator implements the conversion to a ParallelIterator, providing shared references to the data.
IntoParallelRefMutIterator
IntoParallelRefMutIterator implements the conversion to a ParallelIterator, providing mutable references to the data.
IteratorRandom
Extension trait on iterators, providing random sampling methods.
Itertools
An Iterator blanket implementation that provides extra adaptors and methods.
MathExtensions
Mul
The multiplication operator *.
OptionExtensions
ParallelBridge
Conversion trait to convert an Iterator to a ParallelIterator.
ParallelDrainFull
ParallelDrainFull creates a parallel iterator that moves all items from a collection while retaining the original capacity.
ParallelDrainRange
ParallelDrainRange creates a parallel iterator that moves a range of items from a collection while retaining the original capacity.
ParallelExtend
ParallelExtend extends an existing collection with items from a ParallelIterator.
ParallelIterator
Parallel version of the standard iterator trait.
ParallelSlice
Parallel extensions for slices.
ParallelSliceMut
Parallel extensions for mutable slices.
ParallelString
Parallel extensions for strings.
RandomRange
RangeExtensions
ResultExtensions
Rng
An automatically-implemented extension trait on RngCore providing high-level generic methods for sampling values and other convenience methods.
RngCore
The core of a random number generator.
SampleUniform
Helper trait for creating objects using the correct implementation of UniformSampler for the sampling type.
SliceRandom
Extension trait on slices, providing random mutation and sampling methods.
TextureCreator
ToQuadDraw
UVec2Extensions
Vec2EngineExtensions
Vec2Extensions
Vec2Swizzles
VecExtensions
Vertex
WgpuColorExtensions

Functions§

aspect_ratio
assets_loaded
Returns the total number of assets loaded by the parallel asset loader.
assets_queued_total
Returns the total number of assets queued for loading by the parallel asset loader.
back_in
https://easings.net/#easeInBack
back_in_out
https://easings.net/#easeInOutBack
back_out
https://easings.net/#easeOutBack
blood_block_world_size
blood_canvas_blit_at
blood_canvas_blit_at_pro
blood_canvas_blit_at_sized
blood_canvas_blit_quad_draw
blood_canvas_reset
blood_canvas_update_and_draw
blood_circle_at
blood_pixel_at
bounce_in
https://easings.net/#easeInBounce
bounce_in_out
https://easings.net/#easeInOutBounce
bounce_out
https://easings.net/#easeOutBounce
build_shader_source
cached_loader
cached_loader_mut
change_master_volume
changes
check_shader_with_naga
checked_update_shader
Update the shader source for the given shader ID. This can be used by users who with to implement their own shader hot reloading.
circ_in
https://easings.net/#easeInCirc
circ_in_out
https://easings.net/#easeInOutCirc
circ_out
https://easings.net/#easeOutCirc
clear_background
clear_error
Clears a previously set error. Use the same ID as when calling report_error.
clear_shader_uniform_table
coin_toss
color_to_clear_op
combat_text_system
commands
constant
consume_render_queues
consume_text_queue
cooldowns
count_to_color
create_graphics_context
create_line_strip
create_post_processing_pipeline
create_reloadable_sprite_shader
Similar to create_shader but automatically hot reloads the shader on change. Note that create_reloadable_sprite_shader will automatically call sprite_shader_from_fragment, meaning your source should only contain the fragment part.
create_render_pipeline
create_render_pipeline_with_layout
create_render_target
Creates a new render target with given dimensions. Among other parameters a label is required so that graphic debuggers like RenderDoc can display its name properly.
create_shader
Creates a new shader and returns its ID. The source parameter should only contain the fragment function, as the rest of the shader is automatically generated.
create_user_pipeline
create_user_shader_module
cubic_in
https://easings.net/#easeInCubic
cubic_in_out
https://easings.net/#easeInOutCubic
cubic_out
https://easings.net/#easeOutCubic
default_hash
delta
depth_stencil_attachment
despawn
Queue up an entity into a global despawn queue.
draw_arc
draw_arc_outline
draw_arc_wedge
draw_arrow
draw_arrow_pro
draw_circle
draw_circle_outline
draw_circle_z
draw_comfy
draw_ellipse
draw_labeled_rect_corners
draw_light
draw_line
draw_line_tex
draw_line_tex_y_uv
draw_line_tex_y_uv_flex
draw_mesh
draw_mesh_ex
draw_mut
draw_poly2_z
draw_poly_z
draw_post_processing_output
draw_quad
draw_ray
draw_rect
draw_rect_corners
draw_rect_outline
draw_rect_outline_rot
draw_rect_rot
draw_rectangle_z_tex
draw_revs
draw_sprite
Draws a sprite on the screen.
draw_sprite_ex
draw_sprite_pro
draw_sprite_rot
draw_text
draw_text_ex
draw_text_internal
draw_text_pro_experimental
This is a first iteration of Comfy’s rich text rendering.
draw_wedge
egui
egui_scale_factor
elastic_in
https://easings.net/#easeInElastic
elastic_in_out
https://easings.net/#easeInOutElastic
elastic_out
https://easings.net/#easeOutElastic
ensure_pipeline_exists
expo_in
https://easings.net/#easeInExpo
expo_in_out
https://easings.net/#easeInOutExpo
expo_out
https://easings.net/#easeOutExpo
fhd_ratio
fhd_resize_ratio
flip_coin
font_family
frame_time
game_config
game_config_mut
gen_range
gen_shader_id
Generates a new ShaderId. This is intended for internal use only.
get_current_render_target
get_current_shader
Returns the current ShaderInstance if any. Currently intended only for internal use.
get_duration
get_fps
get_frame
get_perf_counter
get_shader_instance
get_sprite_culling
Returns the current setting of sprite culling.
get_time
get_unpaused_time
get_y_sort
image_button
image_button_ex
image_button_without_c
inc_assets_loaded
inc_assets_queued
inc_frame_num
init_asset_source
init_game_config
initialize_logger
insert_post_processing_effect
is_key_down
is_key_pressed
is_key_released
is_mouse_button_down
is_mouse_button_pressed
is_mouse_button_released
is_point_in_rotated_rect
is_texture_loaded
isplat
ivec2
Creates a 2-dimensional vector.
labeled_aabb
labeled_hover_aabb
lerp
light_count
lighting_parameters_window
lighting_ui
linear
load_font_from_bytes
load_multiple_sounds
load_multiple_textures
load_sound_from_bytes
load_texture_from_engine_bytes
load_texture_with_image
Loads a pre-created Texture with an associated DynamicImage into the asset store.
main_camera
main_camera_mut
master_volume
maybe_reload_shaders
Internal use only, checks for shader hot reloads and reloads them if needed.
mouse_input_this_frame
Returns true if there was any mouse input during the current frame.
mouse_moved_this_frame
Returns true if the mouse was moved during the current frame.
mouse_screen
mouse_wheel
mouse_world
nine_patch_rect
nine_patch_rect_ex
notifications
perf_counter
perf_counter_inc
perf_counters_new_frame
play_music
play_music_id_ex
play_random_sound
play_random_sound_ex
play_sound
play_sound_ex
play_sound_id
play_sound_id_ex
play_voice
post_process_shader_from_fragment
power_preference_to_wgpu
px
quad_in
https://easings.net/#easeInQuad
quad_in_out
https://easings.net/#easeInOutQuad
quad_out
https://easings.net/#easeOutQuad
quart_in
https://easings.net/#easeInQuart
quart_in_out
https://easings.net/#easeInOutQuart
quart_out
https://easings.net/#easeOutQuart
queue_mesh_draw
quint_in
https://easings.net/#easeInQuint
quint_in_out
https://easings.net/#easeInOutQuint
quint_out
https://easings.net/#easeOutQuint
rand
returns a pseudo-random number in the range of 0 to u32::MAX.
random
random_angle
random_around
random_box
random_circle
random_dir
random_entity_idx
random_i32
random_offset
random_range
random_timed_frame
random_usize
random_vec
record_screenshot_history
rect_contains
render_debug
render_meshes
render_particles
report_error
Stores an error message with the given ID. This is useful for immediate mode error reporting when you don’t want to pollute the log on every frame.
rescale
reset_perf_counters
reset_world
reverse
A linear easing that goes from 1.0 to 0.0.
rotated_rectangle
roundtrip
A linear easing that goes from 0.0 to 1.0 and back to 0.0. That might be used in combination with other easing functions.
run_batched_render_passes
run_comfy_main_async
save_screenshots_to_folder
screen_height
screen_to_world
screen_width
screenshake
set_cursor_hidden
set_delta
set_frame_time
set_main_camera_zoom
set_master_volume
set_mouse_locked
set_px
set_sprite_culling
When set to true (default) sprites that are outside of the camera’s viewport will not be drawn. This only affects sprites that are drawn using draw_sprite_pro, or using the Sprite/AnimatedSprite components.
set_time
set_time_scale
set_uniform
set_uniform_f32
Sets a f32 uniform value by name. The uniform must exist in the shader.
set_unpaused_time
set_y_sort
shader_to_wgpu
simple_hash
simple_rect
simple_rotated_rect
simple_styled_text
Parses a simple subset of markdown-like syntax.
simple_window
sin_range
sine_in
https://easings.net/#easeInSine
sine_in_out
https://easings.net/#easeInOutSine
sine_out
https://easings.net/#easeOutSine
sound_id
spawn_combat_text
spawn_particle
spawn_particle_fan
spawn_particle_fan_ex
splat
sprite_shader_from_fragment
srand
Seeds the pseudo-random number generator used by rand() with the value seed.
start_task
stop_sound
stop_sound_id
take_to_despawn
Returns a list of entities to despawn.
texture_id
texture_id_safe
texture_id_unchecked
texture_path
thread_rng
Retrieve the lazily-initialized thread-local random number generator, seeded by the system. Intended to be used in method chaining style, e.g. thread_rng().gen::<i32>(), or cached locally, e.g. let mut rng = thread_rng();. Invoked by the Default trait, making ThreadRng::default() equivalent.
time_scale
timed_frame
timed_frame_from
timed_two_frames
timing_start
timings
timings_add_value
Add a timing value to a given timer, measured in f32 seconds.
toss_coin
triangle_time
triangle_wave
triangle_wave_period
uniform_defs_to_bindings
use_default_render_target
use_default_shader
Switches back to the default shader.
use_render_target
use_shader
Switches to the shader with the given ID. The shader must already exist. To revert back to the default shader simply call use_default_shader().
usplat
uvec2
Creates a 2-dimensional vector.
vec2
Creates a 2-dimensional vector.
vec3
Creates a 3-dimensional vector.
vec4
Creates a 4-dimensional vector.
watch_shader_path
world
world_mut
world_to_gl_screen
world_to_screen

Type Aliases§

AnyMap
The most common type of Map: just using Any.
CameraMatrixFn
ContextFn
GameLoopBuilder
Mutex
A mutual exclusion primitive useful for protecting shared data
NonZeroU32
A u32 that is known not to equal zero.
PipelineMap
RenderQueue
RenderTargetMap
Result
Result<T, Error>
StateBuilder
TextureLoadQueue
TextureMap
UniformDefs
UserPipelineMap

Derive Macros§

Hash
Derive macro generating an impl of the trait Hash.