Skip to main content

Crate v_shield

Crate v_shield 

Source
Expand description

🛡️ V-Shield - Platform Layer + Sync Primitives for Ry-Dit

V-Shield provee:

  • 🎨 Colores constantes para RyDit (con o sin raylib)
  • đź”’ Sync Primitives multiplataforma (Mutex, RwLock, Barrier, Condvar)
  • 🖥️ Platform Detection (Linux, Windows, macOS, Android, iOS, WASM)
  • 🔄 Platform Sync para sincronizaciĂłn de renderizado

§Features

FeatureDescripciĂłnDependencias
native (default)Sync nativo (std::sync)Ninguna extra
wasmSync para WASMNinguna extra
graphics (default)Colores raylib + window initraylib
async-tokioWrappers asynctokio (solo sync)
rt-linuxLinux real-timertsc

§Ejemplo rápido

use v_shield::sync::{Mutex, RwLock};
use v_shield::platform::{current_platform, PlatformConfig};
use v_shield::platform_sync::PlatformSync;

// Platform detection
let p = current_platform();
println!("Running on: {}", p.name());

// Config defaults
let config = PlatformConfig::for_current();

// Sync primitives
let data = Mutex::new(vec![1, 2, 3]);
let cache = RwLock::new(String::new());

// Platform sync para renderizado
let mut sync = PlatformSync::new();
// sync.sync(); // al final de cada frame

§Para Termux/Android

Funciona sin cambios en Termux. Solo necesitas:

pkg install clang libx11-dev libxcb-dev

Re-exports§

pub use platform::current_platform;
pub use platform::Platform;
pub use platform::PlatformConfig;
pub use platform_sync::PlatformSync;
pub use platform_sync::PlatformSyncMode;
pub use raylib;
pub use raylib::consts::KeyboardKey::*;

Modules§

audio
Contains code related to audio. RaylibAudio plays sounds and music.
automation
callbacks
camera
Utility code for using Raylib Camera3D and Camera2D
collision
Common collision handling code
color
Color manipulation helpers
consts
Various constant enums to use with raylib
core
data
Data manipulation functions. Compress and Decompress with DEFLATE
drawing
Contains code related to drawing. Types that can be set as a surface to draw will implement the RaylibDraw trait
ease
Easing and interpolation helpers.
error
Definitions for error types used throught the crate
ffi
The raw, unsafe FFI binding, in case you need that escape hatch or the safe layer doesn’t provide something you need.
file
File manipulation functions. Should be parity with std::fs except on emscripten
input
Keyboard, Controller, and Mouse related functions
logging
math
misc
Useful functions that don’t fit anywhere else
models
3D Model, Mesh, and Animation
platform
🛡️ V-Shield Platform Detection
platform_sync
🛡️ V-Shield Platform Sync
rgui
shaders
Code for the safe manipulation of shaders
sync
🛡️ V-Shield Sync Primitives
text
Text and Font related functions Text manipulation functions are super unsafe so use rust String functions
texture
Image and texture related functions
vr
Vr related functions
window
Window manipulation functions

Macros§

rstr

Structs§

AudioStream
AudioStreamProcessorCallback
This struct encapsulates a rust callback and guarantees the lifetime to be long enough (’a) (once get_as_user_data is called, it the struct should not be moved again! -> use Pin<..>)
AutomationEvent
AutomationEventList
BoneInfo
BoundingBox
Camera2D
Camera3D
Color
DroppedFilePathList
FilePathList
Font
GlyphInfo
Image
ImageColors
ImagePalette
Material
MaterialMap
Matrix
Mesh
Model
ModelAnimation
MonitorInfo
Music
Mutex
A mutual exclusion primitive useful for protecting shared data
NPatchInfo
RSliceGlyphInfo
RSliceVec4
RandSeqIterator
RandomSequence
Struct for holding the result of RaylibHandle::load_random_sequence. This is a thin wrapper for an array of i32. The reason it exists is because Raylib expects you to unload the sequence it creates manually, and this struct does it for you.
Ray
RayCollision
RaylibAudio
This token is used to indicate audio is initialized. It’s also used to create Wave, Sound, Music, AudioStream, and SoundAlias. All of those have a lifetime that is bound to RaylibAudio. The compiler will disallow you from using them without ensuring that the RaylibAudio is present while doing so.
RaylibAudioInitError
RaylibBlendMode
RaylibBuilder
A builder that allows more customization of the game window shown to the user before the RaylibHandle is created.
RaylibDrawHandle
RaylibHandle
The main interface into the Raylib API.
RaylibMode2D
RaylibMode3D
RaylibScissorMode
RaylibShaderMode
RaylibTextureMode
RaylibThread
This token is used to ensure certain functions are only running on the same thread raylib was initialized from. This is useful for architectures like macos where cocoa can only be called from one thread.
RaylibVRMode
Rectangle
RenderTexture2D
RwLock
A reader-writer lock
SetLogError
Shader
Sound
SoundAlias
Texture2D
Transform
Vector2
Vector3
Vector4
VrDeviceInfo
VrStereoConfig
Wave
WaveSamples
WeakFont
WeakMaterial
WeakMesh
WeakModel
WeakModelAnimation
WeakRenderTexture2D
WeakShader
WeakTexture2D
WindowState

Enums§

BlendMode
CameraMode
CameraProjection
ColorRyDit
Colores básicos para RyDit
ConfigFlags
CubemapLayout
GamepadAxis
GamepadButton
Gesture
GuiCheckBoxProperty
GuiColorPickerProperty
GuiComboBoxProperty
GuiControl
GuiControlProperty
GuiDefaultProperty
GuiDropdownBoxProperty
GuiIconName
GuiListViewProperty
GuiProgressBarProperty
GuiScrollBarProperty
GuiSliderProperty
GuiSpinnerProperty
GuiState
GuiTextAlignment
GuiTextAlignmentVertical
GuiTextBoxProperty
GuiTextWrapMode
GuiToggleProperty
KeyboardKey
MaterialMapIndex
MouseButton
MouseCursor
NPatchLayout
PixelFormat
ShaderLocationIndex
ShaderUniformDataType
TextureFilter
TextureWrap
TraceLogLevel

Constants§

BLACK
BLUE
BROWN
CYAN
DEG2RAD
GRAY
GREEN
LIME
MAGENTA
MAROON
MAX_MATERIAL_MAPS
MAX_SHADER_LOCATIONS
NAVY
OLIVE
ORANGE
PI
PINK
PURPLE
RAD2DEG
RED
TEAL
VERSION
VersiĂłn del crate
WHITE
YELLOW

Traits§

AsF32
AudioSample
A marker trait specifying an audio sample (u8, i16, or f32).
GuiProperty
RaylibBlendModeExt
RaylibDraw
RaylibDraw3D
RaylibDrawGui
RaylibFont
RaylibMaterial
RaylibMesh
RaylibMode2DExt
RaylibMode3DExt
RaylibModel
RaylibModelAnimation
RaylibRenderTexture2D
RaylibScissorModeExt
RaylibShader
RaylibShaderModeExt
RaylibTexture2D
RaylibTextureModeExt
RaylibVRModeExt
ShaderV

Functions§

attach_audio_stream_processor_to_music
check_collision_circles
Checks collision between two circles.
check_collision_lines
Check the collision between two lines defined by two points each, returns collision point by reference
check_collision_point_circle
Checks if point is inside circle.
check_collision_point_line
Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
check_collision_point_poly
Check if point is within a polygon described by array of vertices
check_collision_point_triangle
Checks if point is inside a triangle.
check_collision_spheres
Detects collision between two spheres.
compress_data
Compress data (DEFLATE algorythm)
custom_trace_log_callbackâš 
decode_data_base64
decompress_data
Decompress data (DEFLATE algorythm)
encode_data_base64
Encode data to Base64 string
export_data_as_code
Export data to code (.h), returns true on success
gen_image_font_atlas
Generates image font atlas using chars info. Sets a pointer to an array of rectangles raylib allocated that MUST manually be freed. Good luck freeing it safely though ;)
get_camera_matrix
Returns camera transform matrix (view matrix)
get_camera_matrix2D
Returns camera 2D transform matrix (view matrix)
get_current_monitor
get_current_monitor_index
get_monitor_count
Get number of connected monitors
get_monitor_height
Get height of monitor Only checks that monitor index is in range in debug mode
get_monitor_info
Gets the attributes of the monitor as well as the name fails if monitor name is not a utf8 string
get_monitor_name
Get name of monitor Only checks that monitor index is in range in debug mode
get_monitor_physical_height
Get physical height of monitor Only checks that monitor index is in range in debug mode
get_monitor_physical_width
Get physical width of monitor Only checks that monitor index is in range in debug mode
get_monitor_position
Get position of monitor Only checks that monitor index is in range in debug mode
get_monitor_refresh_rate
Get specified monitor refresh rate
get_monitor_width
Get width of monitor Only checks that monitor index is in range in debug mode
get_pixel_data_size
Gets pixel data size in bytes (image or texture).
get_ray_collision_model
Gets collision info between ray and model.
get_ray_collision_quad
Gets collision info between ray and model.
get_ray_collision_sphere
Detects collision between ray and sphere.
get_ray_collision_triangle
Gets collision info between ray and triangle.
init
Creates a RaylibBuilder for choosing window options before initialization.
init_window
Inicializar ventana
key_from_i32
lerp
A convenience function for linearly interpolating an f32.
open_url
Open URL with default system browser (if available)
rcolor
rquat
A convenience function for making a new Quaternion.
rrect
A convenience function for making a new Rectangle.
rvec2
A convenience function for making a new Vector2.
rvec3
A convenience function for making a new Vector3.
set_audio_stream_callback
Audio thread callback to request new data
set_load_file_data_callback
Set custom file binary data loader
set_load_file_text_callback
Set custom file text data loader
set_save_file_data_callback
Set custom file binary data saver
set_save_file_text_callback
Set custom file text data saver
set_trace_log_callback
Set custom trace log

Type Aliases§

Camera
Quaternion