Skip to content

Implement alternate colorscheme option for accessibility (resolves #10)#25

Merged
ByteHamster merged 4 commits intoFlowit-Game:masterfrom
ywnico:alt_colors2
Oct 23, 2022
Merged

Implement alternate colorscheme option for accessibility (resolves #10)#25
ByteHamster merged 4 commits intoFlowit-Game:masterfrom
ywnico:alt_colors2

Conversation

@ywnico
Copy link
Copy Markdown
Contributor

@ywnico ywnico commented Oct 11, 2022

  • Add a new setting, which allows the user to switch between two colorschemes
  • Colorscheme preference is an int (0 = default, 1 = accessible), so that if it were desired to add colorschemes later (e.g., for dark theme), it would be easy to do so.
  • Update texture.xcf to include a second set of colors
  • Expand texture images from 2048x2048 to 2048x2172 to accommodate the additional settings entry
  • Each drawable-nodpi dir now has 2 texture files: texture_colorscheme_0.png (the original) and texture_colorscheme_1.png.

I hope this is an acceptable solution which is not too complicated. I don't have much experience with Java and Android development, but since I mostly followed ByteHamster's existing code (e.g., copying settings buttons) I hope it is ok. I can make any suggested changes, of course.

I did fear I might possibly be breaking ByteHamster's style of keeping everything very clean and separated in SettingsState.java lines 31 & 45-46, where I saved the glRenderer variable so that glRenderer.setColorscheme could be called from onTouchEvent. But I did not think of an alternative.

- Add a new setting, which allows the user to switch between two
  colorschemes
- Colorscheme preference is an int (0 = default, 1 = alternate), so that
  if it were desired to add colorschemes later (e.g., for dark theme),
  it would be easy to do so.
- Update texture.xcf to include a second set of colors
- Expand texture images from 2048x2048 to 2048x2172 to accommodate the
  additional settings entry
- Each drawable-nodpi dir now has 2 texture files:
  texture_colorscheme_0.png (the original) and texture_colorscheme_1.png
@ByteHamster
Copy link
Copy Markdown
Member

Thanks! Is there a way to re-order the items instead of resizing? I'm not entirely sure which version of OpenGL we are using, but I think we are using 1.0.
OpenGL 1.0 does not support textures of arbitrary size, so I think making the texture slightly larger like your change actually makes it 4 times larger internally.

@ywnico
Copy link
Copy Markdown
Contributor Author

ywnico commented Oct 12, 2022

Oh, I didn't realize that. Indeed, there's enough blank space to rearrange the textures and keep it within 2048x2048 (I did also need to move the volume icons and header background).

@ByteHamster
Copy link
Copy Markdown
Member

Thanks for updating! Would it somehow be possible to re-load the texture when changing the setting instead of always keeping both textures in memory? I don't know too much about OpenGL, but it feels like that should be somehow possible

@ywnico
Copy link
Copy Markdown
Contributor Author

ywnico commented Oct 14, 2022

That does make sense.... I will look into how to do that.

As opposed to loading every texture at the start.
@ywnico
Copy link
Copy Markdown
Contributor Author

ywnico commented Oct 16, 2022

This update should solve the problem of loading textures when changing colors instead of preloading them.

@ByteHamster ByteHamster merged commit cce9361 into Flowit-Game:master Oct 23, 2022
@ByteHamster
Copy link
Copy Markdown
Member

Awesome, thanks!

@ywnico ywnico deleted the alt_colors2 branch October 24, 2022 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants