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
e6b9eb04
Verified
Commit
e6b9eb04
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: issues related with height
parent
d233d07e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/sdl/src/main.rs
+1
-0
1 addition, 0 deletions
examples/sdl/src/main.rs
src/ppu.rs
+4
-3
4 additions, 3 deletions
src/ppu.rs
with
5 additions
and
3 deletions
examples/sdl/src/main.rs
+
1
−
0
View file @
e6b9eb04
...
@@ -112,6 +112,7 @@ fn main() {
...
@@ -112,6 +112,7 @@ fn main() {
// information presented to the user
// information presented to the user
canvas
.present
();
canvas
.present
();
// @todo this must be improved with proper timestamps
graphics
.timer_subsystem
.delay
(
17
);
graphics
.timer_subsystem
.delay
(
17
);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/ppu.rs
+
4
−
3
View file @
e6b9eb04
...
@@ -11,7 +11,7 @@ pub const TILE_COUNT: usize = 384;
...
@@ -11,7 +11,7 @@ pub const TILE_COUNT: usize = 384;
pub
const
DISPLAY_WIDTH
:
usize
=
160
;
pub
const
DISPLAY_WIDTH
:
usize
=
160
;
/// The height of the Game Boy screen in pixels.
/// The height of the Game Boy screen in pixels.
pub
const
DISPLAY_HEIGHT
:
usize
=
1
5
4
;
pub
const
DISPLAY_HEIGHT
:
usize
=
1
4
4
;
// The size of the RGB frame buffer in bytes.
// The size of the RGB frame buffer in bytes.
pub
const
FRAME_BUFFER_SIZE
:
usize
=
DISPLAY_WIDTH
*
DISPLAY_HEIGHT
*
RGB_SIZE
;
pub
const
FRAME_BUFFER_SIZE
:
usize
=
DISPLAY_WIDTH
*
DISPLAY_HEIGHT
*
RGB_SIZE
;
...
@@ -124,7 +124,7 @@ impl Ppu {
...
@@ -124,7 +124,7 @@ impl Ppu {
// in case we've reached the end of the
// in case we've reached the end of the
// screen we're now entering the v-blank
// screen we're now entering the v-blank
if
self
.line
==
14
3
{
if
self
.line
==
14
4
{
self
.mode
=
PpuMode
::
VBlank
;
self
.mode
=
PpuMode
::
VBlank
;
// self.drawData
// self.drawData
// @todo implement this one
// @todo implement this one
...
@@ -142,7 +142,7 @@ impl Ppu {
...
@@ -142,7 +142,7 @@ impl Ppu {
// in case the end of v-blank has been reached then
// in case the end of v-blank has been reached then
// we must jump again to the OAM read mode and reset
// we must jump again to the OAM read mode and reset
// the scan line counter to the zero value
// the scan line counter to the zero value
if
self
.line
==
15
3
{
if
self
.line
==
15
4
{
self
.mode
=
PpuMode
::
OamRead
;
self
.mode
=
PpuMode
::
OamRead
;
self
.line
=
0
;
self
.line
=
0
;
}
}
...
@@ -246,6 +246,7 @@ impl Ppu {
...
@@ -246,6 +246,7 @@ impl Ppu {
// Game Boy screen width and RGB pixel (3 bytes) size
// Game Boy screen width and RGB pixel (3 bytes) size
let
mut
frame_offset
=
self
.line
as
usize
*
DISPLAY_WIDTH
*
RGB_SIZE
;
let
mut
frame_offset
=
self
.line
as
usize
*
DISPLAY_WIDTH
*
RGB_SIZE
;
for
_index
in
0
..
DISPLAY_WIDTH
{
for
_index
in
0
..
DISPLAY_WIDTH
{
// obtains the current pixel data from the tile and
// obtains the current pixel data from the tile and
// re-maps it according to the current palette
// re-maps it according to the current palette
...
...
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