-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bloom Options using Database #154
Conversation
cdsupina
commented
Jan 10, 2024
•
edited
Loading
edited
- Added options table to db save file
- Added GameOptions resource
- Defaults to options for best performance
- With storage feature, loads options from db
- Used bloom_intensity game option to control bloom throughout the game
crates/thetawave_storage/src/core.rs
Outdated
.query_row("SELECT 1 FROM Options LIMIT 1", [], |row| row.get(0)) | ||
.optional()?; | ||
if default_options_row_exists.is_none() { | ||
conn.execute("INSERT INTO Options DEFAULT VALUES", [])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To just make sure a row is always in the table:
// Ensure that the default options profile is _always_ usable.
let upsert_default_gameopts_sql = format!("INSERT OR REPLACE INTO {} (optionsProfileId, bloomEnabled, bloomIntensity) VALUES (?1, TRUE, 1.0) ON CONFLICT REPLACE", OPTIONS_TABLE_NAME);
conn.execute(upsert_default_gameopts_sql. [DEFAULT_OPTIONS_PROFILE_ID])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like having "INSERT OR REPLACE" and "ON CONFLICT REPLACE" doesn't work. Looks like having just "INSERT OR REPLACE" is the way to go, let me know if I'm missing something.
src/options/mod.rs
Outdated
) { | ||
let (mut camera_2d, mut tonemapping_2d) = match camera_2d_query.get_single_mut() { | ||
Ok(camera) => camera, | ||
Err(_) => panic!("Didn't find exactly one 2D camera to apply bloom settings to."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought i already approved this