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
eaf6e9b2
Verified
Commit
eaf6e9b2
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: better graphics
parent
5c0d48e7
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/sdl/src/main.rs
+12
-7
12 additions, 7 deletions
examples/sdl/src/main.rs
src/cpu.rs
+412
-384
412 additions, 384 deletions
src/cpu.rs
src/ppu.rs
+2
-1
2 additions, 1 deletion
src/ppu.rs
with
426 additions
and
392 deletions
examples/sdl/src/main.rs
+
12
−
7
View file @
eaf6e9b2
use
boytacean
::{
gb
::
GameBoy
,
ppu
::{
DISPLAY_WIDTH
,
DISPLAY_HEIGHT
}};
use
boytacean
::{
use
sdl2
::{
video
::
Window
,
pixels
::
PixelFormatEnum
,
VideoSubsystem
,
TimerSubsystem
,
EventPump
};
gb
::
GameBoy
,
ppu
::{
DISPLAY_HEIGHT
,
DISPLAY_WIDTH
},
};
use
sdl2
::{
pixels
::
PixelFormatEnum
,
video
::
Window
,
AudioSubsystem
,
EventPump
,
TimerSubsystem
,
VideoSubsystem
,
};
/// The base title to be used in the window.
/// The base title to be used in the window.
static
TITLE
:
&
'static
str
=
"Boytacean"
;
static
TITLE
:
&
'static
str
=
"Boytacean"
;
...
@@ -8,6 +14,7 @@ pub struct Graphics {
...
@@ -8,6 +14,7 @@ pub struct Graphics {
window
:
Window
,
window
:
Window
,
video_subsystem
:
VideoSubsystem
,
video_subsystem
:
VideoSubsystem
,
timer_subsystem
:
TimerSubsystem
,
timer_subsystem
:
TimerSubsystem
,
audio_subsystem
:
AudioSubsystem
,
event_pump
:
EventPump
,
event_pump
:
EventPump
,
}
}
...
@@ -42,7 +49,8 @@ fn start_sdl() -> Graphics {
...
@@ -42,7 +49,8 @@ fn start_sdl() -> Graphics {
window
:
window
,
window
:
window
,
video_subsystem
:
video_subsystem
,
video_subsystem
:
video_subsystem
,
timer_subsystem
:
timer_subsystem
,
timer_subsystem
:
timer_subsystem
,
event_pump
:
event_pump
audio_subsystem
:
audio_subsystem
,
event_pump
:
event_pump
,
}
}
}
}
...
@@ -75,8 +83,7 @@ fn main() {
...
@@ -75,8 +83,7 @@ fn main() {
break
;
break
;
}
}
while
let
Some
(
event
)
=
graphics
.event_pump
.poll_event
()
{
while
let
Some
(
event
)
=
graphics
.event_pump
.poll_event
()
{}
}
let
mut
counter_ticks
=
0u32
;
let
mut
counter_ticks
=
0u32
;
...
@@ -106,6 +113,4 @@ fn main() {
...
@@ -106,6 +113,4 @@ fn main() {
graphics
.timer_subsystem
.delay
(
17
);
graphics
.timer_subsystem
.delay
(
17
);
}
}
//println!("{:?}", game_boy.frame_buffer().as_ref());
}
}
This diff is collapsed.
Click to expand it.
src/cpu.rs
+
412
−
384
View file @
eaf6e9b2
This diff is collapsed.
Click to expand it.
src/ppu.rs
+
2
−
1
View file @
eaf6e9b2
...
@@ -113,7 +113,8 @@ impl Ppu {
...
@@ -113,7 +113,8 @@ impl Ppu {
// screen we're now entering the v-blank
// screen we're now entering the v-blank
if
self
.line
==
143
{
if
self
.line
==
143
{
self
.mode
=
PpuMode
::
VBlank
;
self
.mode
=
PpuMode
::
VBlank
;
// self.drawData @todo implement this one
// self.drawData
// @todo implement this one
}
else
{
}
else
{
self
.mode
=
PpuMode
::
OamRead
;
self
.mode
=
PpuMode
::
OamRead
;
}
}
...
...
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