Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
boytacean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
João Magalhães
boytacean
Commits
fee621d1
Verified
Commit
fee621d1
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: initial implementation of palette for SDL
We still need to add more palettes from the Web frontend.
parent
e36648d3
No related branches found
No related tags found
No related merge requests found
Pipeline
#2181
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontends/sdl/src/main.rs
+17
-0
17 additions, 0 deletions
frontends/sdl/src/main.rs
with
17 additions
and
0 deletions
frontends/sdl/src/main.rs
+
17
−
0
View file @
fee621d1
...
@@ -85,6 +85,17 @@ impl Emulator {
...
@@ -85,6 +85,17 @@ impl Emulator {
);
);
}
}
pub
fn
toggle_palette
(
&
mut
self
)
{
//colors: ["b6a571", "8b7e56", "554d35", "201d13"]
// @todo add more palettes here
self
.system
.ppu
()
.set_palette_colors
(
&
[
[
0xb6
,
0xa5
,
0x71
],
[
139
,
126
,
86
],
[
85
,
77
,
83
],
[
32
,
29
,
19
],
])
}
pub
fn
run
(
&
mut
self
)
{
pub
fn
run
(
&
mut
self
)
{
// updates the icon of the window to reflect the image
// updates the icon of the window to reflect the image
// and style of the emulator
// and style of the emulator
...
@@ -131,6 +142,12 @@ impl Emulator {
...
@@ -131,6 +142,12 @@ impl Emulator {
}
=>
{
}
=>
{
self
.benchmark
();
self
.benchmark
();
}
}
Event
::
KeyDown
{
keycode
:
Some
(
Keycode
::
P
),
..
}
=>
{
self
.toggle_palette
();
}
Event
::
KeyDown
{
Event
::
KeyDown
{
keycode
:
Some
(
keycode
),
keycode
:
Some
(
keycode
),
..
..
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment