#[repr(C)]pub struct SkSettings {Show 23 fields
pub app_name: *const c_char,
pub assets_folder: *const c_char,
pub mode: AppMode,
pub blend_preference: DisplayBlend,
pub no_flatscreen_fallback: Bool32T,
pub depth_mode: DepthMode,
pub log_filter: LogLevel,
pub color_format: TexFormat,
pub overlay_app: Bool32T,
pub overlay_priority: u32,
pub flatscreen_pos_x: i32,
pub flatscreen_pos_y: i32,
pub flatscreen_width: i32,
pub flatscreen_height: i32,
pub disable_desktop_input_window: Bool32T,
pub disable_unfocused_sleep: Bool32T,
pub render_scaling: f32,
pub render_multisample: i32,
pub origin: OriginMode,
pub omit_empty_frames: Bool32T,
pub standby_mode: StandbyMode,
pub android_java_vm: *mut c_void,
pub android_activity: *mut c_void,
}
Expand description
StereoKit initialization settings! Setup SkSettings with your data before calling SkSetting.Init(). https://stereokit.net/Pages/StereoKit/SKSettings.html
see also Sk::init
Sk::get_settings
SkInfo::settings_from
sk_init
§Examples
use stereokit_rust::sk::{Sk, SkSettings, AppMode, DisplayBlend, DepthMode, OriginMode, StandbyMode};
use stereokit_rust::{system::LogLevel, tex::TexFormat};
let mut settings = SkSettings::default();
settings.app_name("Test").mode(AppMode::Offscreen);
let sk = Sk::init(&settings).expect("StereoKit should initialize");
let settings = sk.get_settings();
assert_eq!(settings.mode, AppMode::Offscreen);
assert_eq!(settings.blend_preference, DisplayBlend::None);
assert_eq!(settings.no_flatscreen_fallback, 0);
assert_eq!(settings.depth_mode, DepthMode::Default);
assert_eq!(settings.color_format, TexFormat::None);
assert_eq!(settings.log_filter, LogLevel::None);
assert_eq!(settings.overlay_app, 0);
assert_eq!(settings.overlay_priority, 0);
assert_eq!(settings.flatscreen_pos_x, 0);
assert_eq!(settings.flatscreen_pos_y, 0);
assert_eq!(settings.flatscreen_width, 1280);
assert_eq!(settings.flatscreen_height, 720);
assert_eq!(settings.disable_desktop_input_window,0);
assert_eq!(settings.disable_unfocused_sleep, 0);
assert_eq!(settings.render_scaling, 1.0);
assert_eq!(settings.render_multisample, 1);
assert_eq!(settings.origin, OriginMode::Local);
assert_eq!(settings.omit_empty_frames, 0);
assert_eq!(settings.standby_mode, StandbyMode::Pause);
Sk::shutdown();
Fields§
§app_name: *const c_char
§assets_folder: *const c_char
§mode: AppMode
§blend_preference: DisplayBlend
§no_flatscreen_fallback: Bool32T
§depth_mode: DepthMode
§log_filter: LogLevel
§color_format: TexFormat
§overlay_app: Bool32T
§overlay_priority: u32
§flatscreen_pos_x: i32
§flatscreen_pos_y: i32
§flatscreen_width: i32
§flatscreen_height: i32
§disable_desktop_input_window: Bool32T
§disable_unfocused_sleep: Bool32T
§render_scaling: f32
§render_multisample: i32
§origin: OriginMode
§omit_empty_frames: Bool32T
§standby_mode: StandbyMode
§android_java_vm: *mut c_void
§android_activity: *mut c_void
Implementations§
Source§impl SkSettings
impl SkSettings
Sourcepub fn app_name(&mut self, app_name: impl AsRef<str>) -> &mut Self
pub fn app_name(&mut self, app_name: impl AsRef<str>) -> &mut Self
Name of the application, this shows up an the top of the Win32 window, and is submitted to OpenXR. OpenXR caps this at 128 characters. Default is “StereoKitApp” https://stereokit.net/Pages/StereoKit/SKSettings/appName.html
Sourcepub fn mode(&mut self, app_mode: AppMode) -> &mut Self
pub fn mode(&mut self, app_mode: AppMode) -> &mut Self
Which operation mode should we use for this app? Default is XR, and by default the app will fall back to Simulator if XR fails or is unavailable. https://stereokit.net/Pages/StereoKit/SKSettings/appMode.html
Sourcepub fn no_flatscreen_fallback(
&mut self,
no_flatscreen_fallback: bool,
) -> &mut Self
pub fn no_flatscreen_fallback( &mut self, no_flatscreen_fallback: bool, ) -> &mut Self
If the preferred display fails, should we avoid falling back to flatscreen and just crash out? Default is false. https://stereokit.net/Pages/StereoKit/SKSettings/noFlatscreenFallback.html
Sourcepub fn blend_preference(&mut self, blend_preference: DisplayBlend) -> &mut Self
pub fn blend_preference(&mut self, blend_preference: DisplayBlend) -> &mut Self
What kind of depth buffer should StereoKit use? A fast one, a detailed one, one that uses stencils? By default StereoKit will let the XR runtime choose, which typically results in fast, 16bit depth buffers for battery powered devices, and detailed 32bit depth buffers on PCs. If the requested mode is not available, StereoKit will fall back to the XR runtime’s preference. https://stereokit.net/Pages/StereoKit/SKSettings/blendPreference.html
Sourcepub fn depth_mode(&mut self, depth_mode: DepthMode) -> &mut Self
pub fn depth_mode(&mut self, depth_mode: DepthMode) -> &mut Self
What kind of depth buffer should StereoKit use? A fast one, a detailed one, one that uses stencils? By default, StereoKit uses a balanced mix depending on platform, prioritizing speed but opening up when there’s headroom. https://stereokit.net/Pages/StereoKit/SKSettings/depthMode.html
Sourcepub fn color_format(&mut self, color_format: TexFormat) -> &mut Self
pub fn color_format(&mut self, color_format: TexFormat) -> &mut Self
What kind of color buffer should StereoKit use for the primary display surface? By default StereoKit will let the XR runtime choose from a list that StereoKit likes. This is generally the best choice, as the runtime can pick surface formats that can improve performance. If a requested format is not available, StereoKit will fall back to the XR runtime’s preference. https://stereokit.net/Pages/StereoKit/SKSettings/colorFormat.html
Sourcepub fn log_filter(&mut self, log_filter: LogLevel) -> &mut Self
pub fn log_filter(&mut self, log_filter: LogLevel) -> &mut Self
before Initialization occurs, so you can choose to get information from that. Default is LogLevel.Diagnostic. https://stereokit.net/Pages/StereoKit/SKSettings/logFilter.html
Sourcepub fn overlay_app(&mut self, overlay_app: bool) -> &mut Self
pub fn overlay_app(&mut self, overlay_app: bool) -> &mut Self
If the runtime supports it, should this application run as an overlay above existing applications? Check SK.System.overlayApp after initialization to see if the runtime could comply with this flag. This will always force StereoKit to work in a blend compositing mode. https://stereokit.net/Pages/StereoKit/SKSettings/overlayApp.html
Sourcepub fn overlay_priority(&mut self, overlay_priority: u32) -> &mut Self
pub fn overlay_priority(&mut self, overlay_priority: u32) -> &mut Self
For overlay applications, this is the order in which apps should be composited together. 0 means first, bottom of the stack, and uint.MaxValue is last, on top of the stack. https://stereokit.net/Pages/StereoKit/SKSettings/overlayPriority.html
Sourcepub fn flatscreen_pos_x(&mut self, flatscreen_pos_x: i32) -> &mut Self
pub fn flatscreen_pos_x(&mut self, flatscreen_pos_x: i32) -> &mut Self
If using DisplayMode::Flatscreen, the pixel position of the window on the screen. https://stereokit.net/Pages/StereoKit/SKSettings/flatscreenPosX.html
Sourcepub fn flatscreen_pos_y(&mut self, flatscreen_pos_y: i32) -> &mut Self
pub fn flatscreen_pos_y(&mut self, flatscreen_pos_y: i32) -> &mut Self
If using DisplayMode::Flatscreen, the pixel position of the window on the screen. https://stereokit.net/Pages/StereoKit/SKSettings/flatscreenPosY.html
Sourcepub fn flatscreen_pos(
&mut self,
flatscreen_pos_x: i32,
flatscreen_pos_y: i32,
) -> &mut Self
pub fn flatscreen_pos( &mut self, flatscreen_pos_x: i32, flatscreen_pos_y: i32, ) -> &mut Self
If using DisplayMode::Flatscreen, the pixel position of the window on the screen. https://stereokit.net/Pages/StereoKit/SKSettings.html
Sourcepub fn flatscreen_width(&mut self, flatscreen_width: i32) -> &mut Self
pub fn flatscreen_width(&mut self, flatscreen_width: i32) -> &mut Self
If using DisplayMode::Flatscreen, the pixel size of the window on the screen. https://stereokit.net/Pages/StereoKit/SKSettings/flatscreenWidth.html
Sourcepub fn flatscreen_height(&mut self, flatscreen_height: i32) -> &mut Self
pub fn flatscreen_height(&mut self, flatscreen_height: i32) -> &mut Self
If using DisplayMode::Flatscreen, the pixel size of the window on the screen. https://stereokit.net/Pages/StereoKit/SKSettings/flatscreenHeight.html
Sourcepub fn flatscreen_size(
&mut self,
flatscreen_width: i32,
flatscreen_height: i32,
) -> &mut Self
pub fn flatscreen_size( &mut self, flatscreen_width: i32, flatscreen_height: i32, ) -> &mut Self
If using DisplayMode::Flatscreen, the pixel size of the window on the screen. https://stereokit.net/Pages/StereoKit/SKSettings.html
Sourcepub fn disable_desktop_input_window(
&mut self,
disabled_desktop_input_window: bool,
) -> &mut Self
pub fn disable_desktop_input_window( &mut self, disabled_desktop_input_window: bool, ) -> &mut Self
By default, StereoKit will open a desktop window for keyboard input due to lack of XR-native keyboard APIs on many platforms. If you don’t want this, you can disable it with this setting! https://stereokit.net/Pages/StereoKit/SKSettings/disableDesktopInputWindow.html
Sourcepub fn disable_unfocused_sleep(
&mut self,
disable_unfocused_sleep: bool,
) -> &mut Self
👎Deprecated since 0.40.0: please use standby_mode = StandbyMode::None
instead
pub fn disable_unfocused_sleep( &mut self, disable_unfocused_sleep: bool, ) -> &mut Self
standby_mode = StandbyMode::None
insteadBy default, StereoKit will slow down when the application is out of focus. This is useful for saving processing power while the app is out-of-focus, but may not always be desired. In particular, running multiple copies of a SK app for testing networking code may benefit from this setting. https://stereokit.net/Pages/StereoKit/SKSettings/disableUnfocusedSleep.html
Sourcepub fn render_scaling(&mut self, render_scaling: f32) -> &mut Self
pub fn render_scaling(&mut self, render_scaling: f32) -> &mut Self
If you know in advance that you need this feature, this setting allows you to set Renderer::scaling before initialization. This avoids creating and discarding a large and unnecessary swapchain object. Default value is 1. https://stereokit.net/Pages/StereoKit/SKSettings/renderScaling.html
Sourcepub fn render_multisample(&mut self, render_multisample: i32) -> &mut Self
pub fn render_multisample(&mut self, render_multisample: i32) -> &mut Self
If you know in advance that you need this feature, this setting allows you to set Renderer::multisample before initialization. This avoids creating and discarding a large and unnecessary swapchain object. Default value is 1. https://stereokit.net/Pages/StereoKit/SKSettings/renderMultisample.html
Sourcepub fn origin(&mut self, origin_mode: OriginMode) -> &mut Self
pub fn origin(&mut self, origin_mode: OriginMode) -> &mut Self
Set the behavior of StereoKit’s initial origin. Default behavior is OriginMode.Local, which is the most universally supported origin mode. Different origin modes have varying levels of support on different XR runtimes, and StereoKit will provide reasonable fallbacks for each. NOTE that when falling back, StereoKit will use a different root origin mode plus an offset. You can check World.OriginMode and World.OriginOffset to inspect what StereoKit actually landed on. https://stereokit.net/Pages/StereoKit/SKSettings/origin.html
Sourcepub fn omit_empty_frames(&mut self, origin_mode: bool) -> &mut Self
pub fn omit_empty_frames(&mut self, origin_mode: bool) -> &mut Self
If StereoKit has nothing to render for this frame, it skips submitting a projection layer to OpenXR entirely. https://stereokit.net/Pages/StereoKit/SKSettings/omitEmptyFrames.html
Sourcepub fn standby_mode(&mut self, mode: StandbyMode) -> &mut Self
pub fn standby_mode(&mut self, mode: StandbyMode) -> &mut Self
Configures StereoKit’s behavior during device standby. By default in v0.4, SK will completely pause the main thread and disable audio. In v0.3, SK will continue to execute at a throttled pace, and audio will remain on. https://stereokit.net/Pages/StereoKit/SKSettings/omitEmptyFrames.html
Source§impl SkSettings
impl SkSettings
Sourcepub fn init_with_event_loop(
&mut self,
) -> Result<(Sk, EventLoop<StepperAction>), StereoKitError>
pub fn init_with_event_loop( &mut self, ) -> Result<(Sk, EventLoop<StepperAction>), StereoKitError>
Initialise Sk with the given settings parameter (here for non Android platform) https://stereokit.net/Pages/StereoKit/SK/Initialize.html
see also Sk::init_with_event_loop
§Examples
use stereokit_rust::{prelude::*, system::{LogLevel,Renderer}, framework::SkClosures,
maths::{Vec3, Matrix, Pose} ,tools::title::Title, util::named_colors};
use stereokit_rust::sk::{Sk, SkSettings, AppMode, DisplayBlend, DepthMode,
OriginMode, StandbyMode, QuitReason};
let mut settings = SkSettings::default();
settings
.app_name("Test")
.mode(AppMode::Offscreen)
.origin(OriginMode::Floor)
.render_multisample(4)
.render_scaling(0.8)
.depth_mode(DepthMode::D32)
.omit_empty_frames(true)
.log_filter(LogLevel::Diagnostic)
.no_flatscreen_fallback(true);
let (mut sk, event_loop) = settings.init_with_event_loop()
.expect("StereoKit should initialize");
let mut title = Title::new("Sk basic example", Some(named_colors::BLUE), None, None);
title.transform = Matrix::t_r([0.5, 0.5, -1.9], [0.0, 200.0, 0.0]);
sk.send_event(StepperAction::add("Title_blue_ID1", title));
let mut iter = 0;
let number_of_steps = 3;
let filename_scr = "screenshots/sk_basic_example.jpeg";
SkClosures::new(sk, |sk, token| {
// Main loop where we draw stuff and do things!!
if iter > number_of_steps {sk.quit(None)}
if iter == number_of_steps {
// render screenshot
Renderer::screenshot(token, filename_scr, 90, Pose::look_at(Vec3::Z, Vec3::ZERO),
200, 200, Some(99.0) );
}
iter+=1;
})
.shutdown(|sk| {
// This is called when the app is shutting down
assert_eq!(sk.get_quit_reason(), QuitReason::User);
Log::info(format!("QuitReason is {:?}", sk.get_quit_reason()));
})
.run(event_loop);
Sk::shutdown();

Trait Implementations§
Source§impl Clone for SkSettings
impl Clone for SkSettings
Source§fn clone(&self) -> SkSettings
fn clone(&self) -> SkSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SkSettings
impl Debug for SkSettings
Source§impl Default for SkSettings
impl Default for SkSettings
Auto Trait Implementations§
impl Freeze for SkSettings
impl RefUnwindSafe for SkSettings
impl !Send for SkSettings
impl !Sync for SkSettings
impl Unpin for SkSettings
impl UnwindSafe for SkSettings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.