Crate comfy_core

Source

Re-exports§

pub use egui;
pub use egui;
pub use smallvec;
pub use anyhow;
pub use fxhash;
pub use num_traits;
pub use notify;
pub use inline_tweak;
pub use hecs;
pub use backtrace;
pub use bytemuck;
pub use chrono;
pub use egui;
pub use egui_plot;
pub use egui_winit;
pub use env_logger;
pub use epaint;
pub use image;
pub use log;
pub use once_cell;
pub use etagere;
pub use fontdue;
pub use winit;
pub use crossbeam;
pub use comfy_color_backtrace as color_backtrace;
pub use comfy_include_dir as include_dir;
pub use kira;
pub use rayon;
pub use pollster;
pub use spin_sleep;
pub use crate::random::*;

Modules§

random
spatial_hash

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.
debug
Logs a message at the debug level.
define_asset_dir
define_versions
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
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.
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
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.
BloodCanvas
CanvasBlock
Color
CommandBuffer
Records operations for future application to a World
Complex
A complex number in Cartesian form.
Counter
DampedSpring
DefaultHasher
The default Hasher used by RandomState.
DevConfig
DrawParams
DrawText
DrawTextureParams
DrawTextureProParams
Duration
A Duration type to represent a span of time, typically used for system timeouts.
Entity
Lightweight unique ID, or handle, of an entity
Errors
Events
ExponentialMovingAverage
FilterBuilder
Configures a filter effect.
FilterHandle
Controls a filter effect.
FlashingColor
FollowPlayer
FontHandle
Opaque handle to a user font.
FrameDataUniform
FrameParams
GameConfig
GlobalLightingParams
GlobalParams
GlobalState
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
HashSet
A hash set implemented as a HashMap where the value is ().
IRect
IVec2
A 2-dimensional vector.
Index
Index type for Arena that has a generation attached to it.
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
MeshGroupKey
MovingAverage
MovingStats
Name
OnceCell
A thread-safe cell which can be written to only once.
OrderedFloat
A wrapper around floats providing implementations of Eq, Ord, and Hash.
ParticleDraw
Path
A slice of a path (akin to str).
PerfCounters
Pin
A pointer which pins its pointee in place.
PlaySoundCommand
PlaySoundParams
PlayerTag
PointLight
Range
A (half-open) range bounded inclusively below and exclusively above (start..end).
RawDrawParams
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
ReverbBuilder
Configures a reverb effect.
RichText
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
Size
SmallVec
A Vec-like container that can store a small number of elements inline.
Sound
SoundAssetData
SpriteDraw
SpriteVertex
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
TextureAssetData
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.
Transform
Tween
UVec2
A 2-dimensional vector.
ValueRange
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector.
VecDeque
A double-ended queue implemented with a growable ring buffer.
Velocity
WeightedIndex
A distribution using weighted sampling of discrete items
Window
Represents a window.
World
An unordered collection of entities, each having any number of distinctly typed components

Enums§

AssetData
AudioTrack
Axis
BlendMode
Cow
A clone-on-write smart pointer.
DynamicImage
A Dynamic Image
ElementState
Describes the input state of a key.
Event
Describes a generic event.
ImageSizeResult
KeyCode
MouseButton
MouseScrollDelta
Describes a difference in the mouse scroll wheel state.
Poll
Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.
Position
PowerPreference
RecordingMode
ResolutionConfig
ScreenVal
SpriteAlign
TextAlign
TextureHandle
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
BLUE
BROWN
CANVAS_BLOCK_SIZE
COMBAT_TEXT_LIFETIME
COMFY_BLUE
COMFY_DARK_BLUE
COMFY_GREEN
COMFY_PINK
CRIMSON
CYAN
DARKBLUE
DARKBROWN
DARKGRAY
DARKGREEN
DARKPURPLE
DARKRED
DARK_GRAY
DARK_GREEN
FHD_RATIO
FUCHSIA
GOLD
GRAY
GREEN
INDIGO
LIGHTGRAY
LIME
LIME_GREEN
LINE_W
MAGENTA
MAROON
MAX_LIGHTS
MIDNIGHT_BLUE
NAVY
OLIVE
ORANGE
ORANGE_RED
PI
Archimedes’ constant (π)
PINK
PURPLE
QUAD_VERTICES
RED
SALMON
SEA_GREEN
SILVER
SKYBLUE
TEAL
TOMATO
TRANSPARENT
TURQUOISE
VIOLET
WHITE
YELLOW
YELLOW_GREEN

Statics§

ASSETS
CAMERA_BOUNDS
ERRORS
GLOBAL_PARAMS
GLOBAL_STATE
MAIN_CAMERA

Traits§

Any
A trait to emulate dynamic typing.
ComplexExt
DerefMut
Used for mutable dereferencing operations, like in *v = 1;.
Distribution
Types (distributions) that can be used to create a random instance of T.
DynamicBundle
A dynamically typed collection of components
EntityExtensions
ErrorHandlingExtensions
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.
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.
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
UVec2Extensions
Vec2EngineExtensions
Vec2Extensions
Vec2Swizzles
VecExtensions

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
bounce_in
https://easings.net/#easeInBounce
bounce_in_out
https://easings.net/#easeInOutBounce
bounce_out
https://easings.net/#easeOutBounce
build_shader_source
change_master_volume
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
constant
consume_render_queues
consume_text_queue
create_line_strip
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.
cubic_in
https://easings.net/#easeInCubic
cubic_in_out
https://easings.net/#easeInOutCubic
cubic_out
https://easings.net/#easeOutCubic
default_hash
delta
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_poly2_z
draw_poly_z
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
expo_in
https://easings.net/#easeInExpo
expo_in_out
https://easings.net/#easeInOutExpo
expo_out
https://easings.net/#easeOutExpo
font_family
frame_time
game_config
game_config_mut
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
inc_assets_loaded
inc_assets_queued
inc_frame_num
init_asset_source
init_game_config
initialize_logger
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_ui
linear
load_font_from_bytes
load_multiple_sounds
load_multiple_textures
main_camera
main_camera_mut
master_volume
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
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
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
random_entity_idx
random_timed_frame
rect_contains
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
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.
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
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
splat
start_task
stop_sound
stop_sound_id
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
timing_start
timings
timings_add_value
Add a timing value to a given timer, measured in f32 seconds.
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.
world_to_gl_screen
world_to_screen

Type Aliases§

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

Derive Macros§

Hash
Derive macro generating an impl of the trait Hash.