mirror of
https://github.com/italicsjenga/mini_gl_fb.git
synced 2024-11-25 08:51:31 +11:00
Implement builder pattern; fixes #10
This commit is contained in:
parent
02b3b62520
commit
a51872fb82
|
@ -15,3 +15,4 @@ readme = "README.md"
|
||||||
glutin = "0.26.0"
|
glutin = "0.26.0"
|
||||||
gl = "0.10.0"
|
gl = "0.10.0"
|
||||||
rustic_gl = "0.3.2"
|
rustic_gl = "0.3.2"
|
||||||
|
derive_builder = "0.10.0-alpha"
|
||||||
|
|
|
@ -20,9 +20,20 @@ use glutin::dpi::LogicalSize;
|
||||||
/// from a trait like [`Default`]. The [`config!`][config] macro makes it much less tedious to
|
/// from a trait like [`Default`]. The [`config!`][config] macro makes it much less tedious to
|
||||||
/// construct custom configs. See its documentation for more information.
|
/// construct custom configs. See its documentation for more information.
|
||||||
///
|
///
|
||||||
|
/// Alternatively, you can choose to use the builder pattern instead:
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use mini_gl_fb::ConfigBuilder;
|
||||||
|
///
|
||||||
|
/// let config = ConfigBuilder::default()
|
||||||
|
/// .invert_y(false)
|
||||||
|
/// .build().unwrap();
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
/// If there's a config option you want to see or think is missing, please open an issue!
|
/// If there's a config option you want to see or think is missing, please open an issue!
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[builder(default)]
|
||||||
|
#[derive(Clone, PartialEq, Debug, Builder)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// Sets the pixel dimensions of the buffer. The buffer will automatically stretch to fill the
|
/// Sets the pixel dimensions of the buffer. The buffer will automatically stretch to fill the
|
||||||
/// whole window. By default this will be the same as the window_size.
|
/// whole window. By default this will be the same as the window_size.
|
||||||
|
|
|
@ -105,6 +105,8 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub extern crate rustic_gl;
|
pub extern crate rustic_gl;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate derive_builder;
|
||||||
|
|
||||||
pub extern crate glutin;
|
pub extern crate glutin;
|
||||||
pub extern crate gl;
|
pub extern crate gl;
|
||||||
|
@ -114,7 +116,7 @@ pub mod core;
|
||||||
pub mod breakout;
|
pub mod breakout;
|
||||||
|
|
||||||
pub use breakout::{GlutinBreakout, BasicInput};
|
pub use breakout::{GlutinBreakout, BasicInput};
|
||||||
pub use config::Config;
|
pub use config::{Config, ConfigBuilder};
|
||||||
pub use core::{Internal, BufferFormat, Framebuffer};
|
pub use core::{Internal, BufferFormat, Framebuffer};
|
||||||
|
|
||||||
use core::ToGlType;
|
use core::ToGlType;
|
||||||
|
|
Loading…
Reference in a new issue