Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
chip-ahoyto
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
chip-ahoyto
Commits
b526f77b
Verified
Commit
b526f77b
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: support for icons
parent
fe5dae3b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/sdl/Cargo.toml
+6
-1
6 additions, 1 deletion
examples/sdl/Cargo.toml
examples/sdl/README.md
+5
-2
5 additions, 2 deletions
examples/sdl/README.md
examples/sdl/src/main.rs
+4
-5
4 additions, 5 deletions
examples/sdl/src/main.rs
with
15 additions
and
8 deletions
examples/sdl/Cargo.toml
+
6
−
1
View file @
b526f77b
...
...
@@ -12,7 +12,12 @@ path = "../.."
[dependencies.sdl2]
version
=
"0.34"
features
=
[
"bundled"
,
"static-link"
]
features
=
[
"bundled"
,
"static-link"
,
"image"
]
[package.metadata.vcpkg]
dependencies
=
[
"sdl2"
,
"sdl2-image[libjpeg-turbo,tiff,libwebp]"
,
"sdl2-ttf"
,
"sdl2-gfx"
,
"sdl2-mixer"
]
git
=
"https://github.com/microsoft/vcpkg"
rev
=
"72fa4d4630c0971eadea7d0a70045351ab13be9d"
[profile.release]
debug
=
false
...
...
This diff is collapsed.
Click to expand it.
examples/sdl/README.md
+
5
−
2
View file @
b526f77b
# Desktop CHIP-8 Emulator
Utilizes the
[
`
jc-
chip
8
`
](
../../
jc-chip8/
)
crate and the
[
SDL crate
](
https://github.com/Rust-SDL2/rust-sdl2
)
to build a desktop application.
Utilizes the
[
`chip
-ahoyto
`
](
../../
)
crate and the
[
SDL crate
](
https://github.com/Rust-SDL2/rust-sdl2
)
to build a desktop application.
## Running
```
bash
$
cargo run
--release
cargo
install
cargo-vcpkg
cargo vcpkg build
--release
cargo build
--release
cargo run
--release
```
Drag and drop your ROM to play.
...
...
This diff is collapsed.
Click to expand it.
examples/sdl/src/main.rs
+
4
−
5
View file @
b526f77b
use
chip_ahoyto
::
chip8
::{
Chip8
,
SCREEN_PIXEL_HEIGHT
,
SCREEN_PIXEL_WIDTH
};
use
sdl2
::{
event
::
Event
,
keyboard
::
Keycode
,
pixels
::
PixelFormatEnum
,
surface
::
Surface
};
use
std
::{
fs
::
File
,
io
::
Read
,
path
::
Path
};
use
sdl2
::{
event
::
Event
,
keyboard
::
Keycode
,
pixels
::
PixelFormatEnum
,
surface
::
Surface
,
image
::
LoadSurface
};
use
std
::{
fs
::
File
,
io
::
Read
};
const
PIXEL_SET
:
[
u8
;
3
]
=
[
80
,
203
,
147
];
const
SYSTEM_HZ
:
u32
=
240
;
...
...
@@ -14,7 +14,7 @@ fn main() {
// creates the system window that is going to be used to
// show the emulator and sets it to the central are o screen
let
window
=
video_subsystem
let
mut
window
=
video_subsystem
.window
(
TITLE
,
SCREEN_SCALE
as
u32
*
SCREEN_PIXEL_WIDTH
as
u32
,
...
...
@@ -27,8 +27,7 @@ fn main() {
// updates the icon of the window to reflect the image
// and style of the emulator
let
path
=
Path
::
new
(
"./resources/icon.png"
);
let
surface_ref
=
Surface
::
from_file
(
path
);
let
surface_ref
=
Surface
::
from_file
(
"./resources/icon.png"
)
.unwrap
();
window
.set_icon
(
surface_ref
);
let
mut
canvas
=
window
.into_canvas
()
.build
()
.unwrap
();
...
...
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