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
6d6fc061
Verified
Commit
6d6fc061
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: canvas clear issue
parent
49740038
No related branches found
No related tags found
1 merge request
!9
Version 0.4.0 🍾
Pipeline
#1416
passed
2 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/sdl/src/main.rs
+7
-0
7 additions, 0 deletions
examples/sdl/src/main.rs
with
7 additions
and
0 deletions
examples/sdl/src/main.rs
+
7
−
0
View file @
6d6fc061
...
...
@@ -142,6 +142,11 @@ impl Emulator {
if
self
.system
.ppu_mode
()
==
PpuMode
::
VBlank
&&
self
.system
.ppu_frame
()
!=
last_frame
{
// clears the graphics canvas, making sure that no garbage
// pixel data remaining in the pixel buffer, not doing this would
// create visual glitches in OSs like Mac OS X
self
.graphics.canvas
.clear
();
// obtains the frame buffer of the Game Boy PPU and uses it
// to update the stream texture, copying it then to the canvas
let
frame_buffer
=
self
.system
.frame_buffer
()
.as_ref
();
...
...
@@ -154,6 +159,8 @@ impl Emulator {
// information presented to the user
self
.graphics.canvas
.present
();
// obtains the index of the current PPU frame, this value
// is going to be used to detect for new frame presence
last_frame
=
self
.system
.ppu_frame
();
}
}
...
...
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