Skip to content
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

Merged
merged 10 commits into from
Jan 26, 2024
Merged

Conversation

cdsupina
Copy link
Contributor

@cdsupina cdsupina commented Jan 10, 2024

  • 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

@cdsupina cdsupina marked this pull request as ready for review January 14, 2024 17:16
@cdsupina cdsupina changed the title Options Menu using Database Bloom Options using Database Jan 14, 2024
.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", [])?;
Copy link
Contributor

@varoonp123 varoonp123 Jan 15, 2024

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])

Copy link
Contributor Author

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.

) {
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."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What.

Why.

How.

Maybe

if let ((mut camera_2d, mut tonemapping_2d), (mut camera_3d, tonemapping_3d)) = (camera_2d_query.get_single_mut(), camera_3d_query.get_single_mut()) {

}
else {
    error!("Failed to get singleton 2d and 3d cameras to apply game opts");
}

Copy link
Contributor

@varoonp123 varoonp123 left a 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

@varoonp123 varoonp123 merged commit 849ddbc into thetawavegame:main Jan 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants