Skip to main content

sge/
modules.rs

1pub use crate::{init, init_custom, next_frame, run_async};
2pub use sge_api::{Drawable, draw, draw_world};
3pub use sge_include_assets::sge_include_assets;
4pub use sge_macros::main;
5
6pub use anyhow;
7pub use anyhow::Result as AResult;
8
9pub mod persistence {
10    pub use sge_persistence::{Error as PersistenceError, Persistent, persistent, rkyv};
11}
12
13pub mod post_processing {
14    pub use sge_rendering::post_processing::{
15        PostProcessingEffect, PostProcessingError, RenderFullscreenQuadError,
16        add_post_processing_effect, bloom_screen, blur_screen, brighten_screen,
17        chromatic_abberation_screen, contrast_screen, film_grain_screen, greyscale_screen,
18        hue_rotate_screen, invert_screen, pixelate_screen, saturate_screen, sharpen_screen,
19        vignette_screen,
20    };
21}
22
23pub mod storage {
24    pub use crate::api::{
25        storage_exists, storage_get_state, storage_get_state_mut, storage_init_state,
26        storage_store_state, storage_try_get_state, storage_try_get_state_mut,
27    };
28}
29
30pub mod image {
31    pub use ::image as image_rs;
32    pub use image_rs::ImageFormat;
33    pub use sge_image::{Image, ImageRef, LoadImageError, load_image_sync};
34}
35
36pub mod physics {
37    pub use sge_physics::{
38        Bounds, ColliderConfig, CollisionPoints, ObjectRef, PhysicsWorld, WorldRef,
39        player::PlayerBindBuilder, player::PlayerController,
40    };
41}
42
43pub mod particles {
44    pub use sge_particles::*;
45}
46
47pub mod config {
48    pub use sge_config::{
49        EngineConfig, EngineCreationOptions, Opts, OptsBuilder, dont_wait_for_events, get_config,
50        get_polygon_mode, get_wait_for_events, get_wait_for_events_mut, set_magnify_filter,
51        set_minify_filter, set_polygon_mode, set_wait_for_events, toggle_wait_for_events,
52        toggle_wireframe, use_default_filtering, use_linear_filtering, use_mipmaps,
53        use_nearest_filtering, use_positive_y_down, use_positive_y_up, wait_for_events,
54    };
55}
56
57pub mod color {
58    pub use sge_color::schemes::ColorScheme;
59    pub use sge_color::u8::ColorU8;
60    pub use sge_color::{COLOR_MAP, Color, Palette, str_to_color};
61}
62
63pub mod programs {
64    pub use sge_programs::include_program;
65    pub use sge_programs::load_program_sync;
66}
67
68pub mod camera {
69    pub use sge_camera::{
70        camera2d_zoom_at, cameras_for_resolution, d2::Camera2D, d3::Camera3D, get_camera_2d,
71        get_camera_2d_mut, get_camera_3d, get_camera_3d_mut, get_flat_projection,
72        screen_distance_to_world, screen_to_world, world_distance_to_screen, world_to_screen,
73        world_to_screen_3d,
74    };
75    pub use sge_camera_controllers::first_person::FirstPersonCameraController;
76    pub use sge_camera_controllers::orbit::OrbitCameraController;
77    pub use sge_camera_controllers::pan::PanningCameraController;
78    pub use sge_camera_controllers::shake::CameraShakeController;
79}
80
81pub mod time {
82    pub use sge_time::{
83        delta_time, frame_count, frames_since_input, is_first_frame, is_physics_time_paused,
84        is_physics_time_paused_mut, once_per_n_seconds, once_per_second, oscillate, oscillate_t,
85        pause_physics_timer, physics_delta_time, physics_speed, physics_speed_mut, physics_time,
86        play_physics_timer, set_physics_speed, time, time_seconds, time_since,
87        toggle_every_n_seconds, toggle_physics_timer,
88    };
89}
90
91pub mod rng {
92    pub use sge_rng::{
93        const_random::const_random, get_next_counter, get_random, id, maybe_rand_choice, rand,
94        rand_bool, rand_choice, rand_color, rand_f32, rand_range, rand_ratio, rand_usize,
95        rand_vec2, rand_vec3, rand_vec4,
96    };
97}
98
99pub mod utils {
100    pub use sge_utils::{
101        CapacityReached, ConstantArray, FromF32, Lerpable, Lerped, PartialClamp, RotatingArray,
102        ToF32,
103    };
104}
105
106pub mod shapes {
107    pub use sge_api::shapes_2d::*;
108    pub use sge_shapes::d2::*;
109}
110
111pub mod sdf {
112    pub use sge_types::{Metaball, Metaballs};
113    pub use sge_types::{Sdf, SdfFill, SdfShape, SdfStroke};
114}
115
116pub mod d3 {
117    pub use sge_rendering::api::{
118        create_blinn_phong_material, create_flat_material, create_gouraud_material,
119        create_textured_material,
120    };
121    pub use sge_rendering::object_3d::{
122        Mesh, MeshRef, Object3D, Object3DRef, ObjectLoadingError, ObjectToDraw,
123    };
124    pub use sge_rendering::shapes_3d::*;
125    pub use sge_types::{MaterialVertex3D, Vertex3D};
126}
127
128pub mod textures {
129    pub use atlas::*;
130    pub mod atlas {
131        pub use sge_texture_atlas::{
132            Sprite, SpriteKey, TextureAtlas, TextureAtlasRef, create_spritesheet,
133        };
134    }
135
136    pub use sge_macros::include_texture;
137    pub use sge_rendering::api::{
138        draw_fullscreen_texture, draw_texture, draw_texture_ex, draw_texture_scaled,
139        draw_texture_scaled_world, draw_texture_world, draw_texture_world_ex,
140    };
141    pub use sge_textures::{
142        LoadTextureError, SgeTexture, TextureRef, load_texture_from_bytes_sync, load_texture_sync,
143        num_registered_textures,
144    };
145}
146
147pub mod render_textures {
148    pub use sge_rendering::api::{
149        create_empty_render_texture, end_rendering_to_texture, start_rendering_to_texture,
150    };
151    pub use sge_rendering::pipeline::RenderTextureRef;
152}
153
154pub mod logging {
155    pub use log::{self, Level, LevelFilter, debug, error, info, trace, warn};
156    pub use sge_logging::{
157        Logger, draw_logs, log_lines, log_to_file, set_logger_verbosity, set_max_drawn_log_lines,
158        set_min_log_level,
159    };
160    pub use sge_types::Verbosity;
161}
162
163pub mod rendering {
164    pub use sge_rendering::d2::{Renderer2D, Scene2D};
165    pub use sge_rendering::materials::{DEFAULT_MATERIAL, Material, MaterialRef, UniformData};
166
167    pub use glium::{
168        draw_parameters::PolygonMode,
169        glutin::{
170            config::{ColorBufferType, ConfigSurfaceTypes, ConfigTemplateBuilder},
171            context::{ContextAttributesBuilder, GlProfile, Priority, ReleaseBehavior, Robustness},
172            surface::{SurfaceAttributesBuilder, SwapInterval},
173        },
174        uniforms::{MagnifySamplerFilter, MinifySamplerFilter},
175    };
176    pub use sge_rendering::api::{
177        clear_screen, dont_clear_screen, draw_scene, draw_scene_to, draw_scene_world,
178    };
179    pub use sge_rendering::pipeline::new_draw_queues;
180    pub use sge_rendering::scissor::{
181        clear_scissor_stack, current_scissor, get_scissor_stack, pop_scissor, push_scissor,
182    };
183    pub use sge_rendering::{take_screenshot, take_screenshot_image, window_texture};
184    pub use sge_types::{BufferError, ColorVertex2D, Pattern, SpriteVertex, TexturedVertex2D};
185}
186
187pub mod animation {
188    pub use sge_animation::*;
189}
190
191pub mod math {
192    pub use sge_api::area::AreaExt;
193    pub use sge_math::Vec2Ext;
194    pub use sge_math::collision::{self, Aabb2d, IntersectsWith};
195    pub use sge_math::transform::{Transform2D, Transform3D};
196    pub use sge_math::usize_rect::USizeRect;
197    pub use sge_math::*;
198    pub use sge_types::Area;
199    pub use sge_vectors as extra_math_types;
200    pub use sge_vectors::{
201        IVec2, IVec3, IVec4, Mat2, Mat3, Mat4, Quat, USizeVec2, USizeVec3, USizeVec4, UVec2, UVec3,
202        UVec4, Vec2, Vec2Swizzles, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles, VectorSpace, ivec2,
203        ivec3, ivec4, mat2, mat3, mat4, ops::*, usizevec2, usizevec3, usizevec4, uvec2, uvec3,
204        uvec4, vec2, vec3, vec4,
205    };
206    pub use std::f32::consts::*;
207}
208
209pub mod window {
210    pub use glium::glutin::surface::WindowSurface;
211    pub use glium::winit::dpi::{LogicalSize, PhysicalSize, Position, Size};
212    pub use glium::winit::event::MouseButton;
213    pub use glium::winit::keyboard::{Key, KeyCode, NamedKey};
214    pub use glium::winit::monitor::MonitorHandle;
215    pub use glium::winit::window::{
216        Cursor, Fullscreen, Icon, Theme, WindowAttributes, WindowButtons, WindowLevel,
217    };
218    pub use sge_types::window_area;
219    pub use sge_window::{
220        IntoWindowSize, SgeDisplay, WindowCreationError, WindowOptions, WindowState,
221        availible_monitors, cancel_window_request_user_attention, current_monitor, dpi_scaling,
222        end_of_frame, fullscreen, get_display, get_display_mut, get_window_state, grab_cursor,
223        is_fullscreen, is_window_decorated, is_window_focused, is_window_maximized,
224        is_window_minimised, is_window_minimized, is_window_resizable, is_window_visible,
225        max_window_dimension, min_window_dimension, opengl_context, opengl_version,
226        primary_monitor, release_cursor, request_window_inner_size, resize_increments,
227        set_cursor_grab, set_cursor_position, set_cursor_visible, set_fullscreen,
228        set_max_window_inner_size, set_min_window_inner_size, set_window_blur,
229        set_window_content_protected, set_window_cursor_hittest, set_window_decorations,
230        set_window_icon, set_window_level, set_window_maximized, set_window_resizable,
231        set_window_theme, set_window_title, set_window_visible, window_aspect_ratio, window_center,
232        window_enabled_buttons, window_height, window_id, window_inner_position, window_inner_size,
233        window_outer_position, window_outer_size, window_request_user_attention, window_size,
234        window_size_u32, window_theme, window_title, window_width,
235    };
236}
237
238pub mod cursor_icons {
239    pub use sge_window::{
240        use_alias_cursor_icon, use_all_resize_cursor_icon, use_all_scroll_cursor_icon,
241        use_cell_cursor_icon, use_col_resize_cursor_icon, use_context_menu_cursor_icon,
242        use_copy_cursor_icon, use_crosshair_cursor_icon, use_cursor_icon, use_default_cursor_icon,
243        use_dnd_ask_cursor_icon, use_e_resize_cursor_icon, use_ew_resize_cursor_icon,
244        use_grab_cursor_icon, use_grabbing_cursor_icon, use_help_cursor_icon, use_move_cursor_icon,
245        use_n_resize_cursor_icon, use_ne_resize_cursor_icon, use_nesw_resize_cursor_icon,
246        use_no_drop_cursor_icon, use_not_allowed_cursor_icon, use_ns_resize_cursor_icon,
247        use_nw_resize_cursor_icon, use_nwse_resize_cursor_icon, use_pointer_cursor_icon,
248        use_progress_cursor_icon, use_row_resize_cursor_icon, use_s_resize_cursor_icon,
249        use_se_resize_cursor_icon, use_sw_resize_cursor_icon, use_text_cursor_icon,
250        use_vertical_text_cursor_icon, use_w_resize_cursor_icon, use_wait_cursor_icon,
251        use_zoom_in_cursor_icon, use_zoom_out_cursor_icon,
252    };
253}
254
255#[cfg(feature = "audio")]
256pub mod audio {
257    pub use sge_audio::{
258        Sound, SoundBuilder, SoundLoadError, SoundRef, include_sound, load_sound_from_bytes_sync,
259        load_sound_sync, play_sound, play_sound_ex, rodio,
260        rodio::BitDepth,
261        rodio::source::{
262            AutomaticGainControlSettings, LimitSettings, dither::Algorithm as DitherAlgorithm,
263        },
264    };
265    pub use std::time::Duration;
266}
267
268#[cfg(feature = "gamepad")]
269pub mod gamepad {
270    pub use sge_input::gamepad_input as input;
271    pub use sge_input::gilrs::*;
272}
273
274#[cfg(feature = "input")]
275pub mod input {
276    pub use crate::api::is_about_to_wait_for_input;
277    pub use sge_input::{
278        Action, Button, Input, action_held, action_pressed, action_pressed_os, action_released,
279        bind, button_held, button_pressed, button_released, close_requested, cursor, cursor_diff,
280        cursor_movements, cursor_prev, destroyed, dropped_file, gamepad::GamepadExt, get_all_binds,
281        held_alt, held_control, held_shift, hovered_file, input_text, key_held, key_held_logical,
282        key_pressed, key_pressed_logical, key_pressed_os, key_pressed_os_logical, key_released,
283        key_released_logical, keys::KeyToString, last_cursor_pos, mouse_diff, mouse_held,
284        mouse_pressed, mouse_released, pressed_movement_vector, resolution, scale_factor,
285        scale_factor_changed, scroll_diff, should_quit, window_resized,
286    };
287    pub use sge_macros::{actions, bind};
288}
289
290#[cfg(feature = "text")]
291pub mod text {
292    pub use sge_text::rich_text::*;
293    pub use sge_text::{
294        DEFAULT_FONT_SIZE, Font, FontRef, FontType, Glyph, LoadFontError, MONO, MONO_TYPEFACE,
295        TextDimensions, TextDrawParams, TextDrawParamsBuilder, TextMeasureCache, Typeface,
296        create_ttf_font, default_font, draw_colored_text, draw_colored_text_world,
297        draw_multiline_text, draw_multiline_text_ex, draw_multiline_text_size,
298        draw_multiline_text_size_world, draw_multiline_text_world, draw_multiline_text_world_ex,
299        draw_text, draw_text_custom, draw_text_ex, draw_text_size, draw_text_size_world,
300        draw_text_world, draw_text_world_custom, draw_text_world_ex, draw_wrapped_text_in_area,
301        get_space_width, icons, load_font_sync, measure_multiline_text, measure_multiline_text_ex,
302        measure_text, measure_text_ex, measure_wrapped_text, wrap_text_to_width, wrapped_text,
303    };
304}
305
306#[cfg(feature = "clipboard")]
307/// utilities for interacting with the clipboard
308pub mod clipboard {
309    pub use sge_input::{get_clipboard_text, set_clipboard_text};
310}
311
312#[cfg(feature = "egui")]
313pub mod egui_mod {
314    pub use sge_egui::egui_glium::egui_winit::egui;
315    pub use sge_egui::run_egui;
316}
317
318#[cfg(feature = "debugging")]
319pub mod debugging {
320    pub use sge_debugging::{
321        avg_fps, get_draw_calls, get_drawn_objects, get_engine_time, get_index_count,
322        get_max_draw_calls, get_max_drawn_objects, get_max_engine_time, get_max_index_count,
323        get_max_vertex_count, get_vertex_count, max_fps, min_fps,
324    };
325}
326
327#[cfg(feature = "extra_fonts")]
328pub mod extra_fonts {
329    pub use sge_text::{SANS, SANS_BOLD, SANS_BOLD_ITALIC, SANS_DISPLAY, SANS_TYPEFACE};
330}
331
332#[cfg(feature = "debug_visualisations")]
333pub mod debug_visualisations {
334    pub use sge_debug_visualisations::grid::{create_infinite_grid, draw_2d_grid_world};
335    pub use sge_debug_visualisations::*;
336}
337
338pub mod fs {
339    pub use sge_exec::fs::*;
340}
341
342pub mod exec {
343    pub use sge_exec::{FrameFuture, futures::join, start_coroutine, wait_for, wait_for_frames};
344}
345
346#[cfg(feature = "multiplayer")]
347pub mod multiplayer {
348    pub use sge_multiplayer::{
349        MultiplayerError, MultiplayerState, Notification, UserData,
350        backends::{Message, MultiplayerBackend, itty::IttyBackend},
351    };
352}
353
354#[cfg(feature = "network")]
355pub mod net {
356    pub use sge_exec::net::*;
357}