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
7510dac1
Verified
Commit
7510dac1
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: more engine info fps set to zero
parent
ebe421c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#680
passed
2 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/web/index.html
+2
-2
2 additions, 2 deletions
examples/web/index.html
examples/web/index.ts
+13
-6
13 additions, 6 deletions
examples/web/index.ts
with
15 additions
and
8 deletions
examples/web/index.html
+
2
−
2
View file @
7510dac1
...
...
@@ -21,7 +21,7 @@
<div
id=
"section-diag"
class=
"section"
>
<dl
class=
"diag"
>
<dt>
Engine
</dt>
<dd
>
NEO
</dd>
<dd
id=
"engine"
>
-
</dd>
<dt>
ROM
</dt>
<dd
id=
"rom-name"
>
-
</dd>
<dt>
ROM Size
</dt>
...
...
@@ -32,7 +32,7 @@
<span
id=
"logic-frequency"
>
-
</span>
Hz
<span
id=
"logic-frequency-plus"
class=
"tiny-button tiny-button-right"
>
+
</span></dd>
<dt>
Framerate
</dt>
<dd><span
id=
"fps-count"
>
60
</span>
fps
</dd>
<dd><span
id=
"fps-count"
>
-
</span>
fps
</dd>
</dl>
</div>
<div
id=
"separator-diag"
class=
"separator"
></div>
...
...
This diff is collapsed.
Click to expand it.
examples/web/index.ts
+
13
−
6
View file @
7510dac1
...
...
@@ -82,7 +82,7 @@ const state: State = {
paused
:
false
,
background_index
:
0
,
nextTickTime
:
0
,
fps
:
VISUAL_HZ
,
fps
:
0
,
frameStart
:
new
Date
().
getTime
(),
frameCount
:
0
,
romName
:
null
,
...
...
@@ -187,11 +187,6 @@ const start = async ({ romPath = ROM_PATH, engine = "neo" } = {} ) => {
const
arrayBuffer
=
await
blob
.
arrayBuffer
();
const
data
=
new
Uint8Array
(
arrayBuffer
);
// updates the ROM information on display
setRom
(
romName
,
data
.
length
);
setLogicFrequency
(
state
.
logicFrequency
);
setFps
(
state
.
fps
);
// selects the proper engine for execution
// and builds a new instance of it
switch
(
engine
)
{
...
...
@@ -208,6 +203,13 @@ const start = async ({ romPath = ROM_PATH, engine = "neo" } = {} ) => {
// a valid state ready to be used
state
.
chip8
.
reset_hard_ws
();
state
.
chip8
.
load_rom_ws
(
data
);
// updates the complete set of global information that
// is going to be displayed
setEngine
(
engine
);
setRom
(
romName
,
data
.
length
);
setLogicFrequency
(
state
.
logicFrequency
);
setFps
(
state
.
fps
);
}
const
register
=
async
()
=>
{
...
...
@@ -413,6 +415,11 @@ const showToast = async (message: string, error = false, timeout = 3500) => {
},
timeout
);
}
const
setEngine
=
(
name
:
string
,
upper
=
true
)
=>
{
name
=
upper
?
name
.
toUpperCase
()
:
name
;
document
.
getElementById
(
"
engine
"
).
textContent
=
name
;
};
const
setRom
=
(
name
:
string
,
size
:
number
)
=>
{
state
.
romName
=
name
;
state
.
romSize
=
size
;
...
...
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