Skip to content
Snippets Groups Projects
Verified Commit 0646bbf2 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: keyboard as feature

parent fd80bd32
No related branches found
No related tags found
No related merge requests found
...@@ -346,7 +346,13 @@ export class GameboyEmulator extends EmulatorBase implements Emulator { ...@@ -346,7 +346,13 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
} }
get features(): Feature[] { get features(): Feature[] {
return [Feature.Debug, Feature.Palettes, Feature.Benchmark]; return [
Feature.Debug,
Feature.Palettes,
Feature.Benchmark,
Feature.Keyboard,
Feature.KeyboardGB
];
} }
get romExts(): string[] { get romExts(): string[] {
......
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
DrawHandler, DrawHandler,
Footer, Footer,
Info, Info,
KeyboardChip8,
KeyboardGB, KeyboardGB,
Link, Link,
Modal, Modal,
...@@ -80,7 +81,10 @@ export type BenchmarkResult = { ...@@ -80,7 +81,10 @@ export type BenchmarkResult = {
export enum Feature { export enum Feature {
Debug = 1, Debug = 1,
Palettes, Palettes,
Benchmark Benchmark,
Keyboard,
KeyboardChip8,
KeyboardGB
} }
export interface ObservableI { export interface ObservableI {
...@@ -591,11 +595,19 @@ export const App: FC<AppProps> = ({ ...@@ -591,11 +595,19 @@ export const App: FC<AppProps> = ({
} }
> >
<Section visible={keyboardVisible} separatorBottom={true}> <Section visible={keyboardVisible} separatorBottom={true}>
<KeyboardGB {hasFeature(Feature.KeyboardChip8) && (
fullscreen={fullscreenState} <KeyboardChip8
onKeyDown={onKeyDown} onKeyDown={onKeyDown}
onKeyUp={onKeyUp} onKeyUp={onKeyUp}
/> />
)}
{hasFeature(Feature.KeyboardGB) && (
<KeyboardGB
fullscreen={fullscreenState}
onKeyDown={onKeyDown}
onKeyUp={onKeyUp}
/>
)}
</Section> </Section>
<Title <Title
text={emulator.name} text={emulator.name}
...@@ -774,14 +786,16 @@ export const App: FC<AppProps> = ({ ...@@ -774,14 +786,16 @@ export const App: FC<AppProps> = ({
style={["simple", "border", "padded"]} style={["simple", "border", "padded"]}
onClick={onFullscreenClick} onClick={onFullscreenClick}
/> />
<Button {hasFeature(Feature.Keyboard) && (
text={"Keyboard"} <Button
image={require("../res/dialpad.svg")} text={"Keyboard"}
imageAlt="keyboard" image={require("../res/dialpad.svg")}
enabled={keyboardVisible} imageAlt="keyboard"
style={["simple", "border", "padded"]} enabled={keyboardVisible}
onClick={onKeyboardClick} style={["simple", "border", "padded"]}
/> onClick={onKeyboardClick}
/>
)}
<Button <Button
text={"Information"} text={"Information"}
image={require("../res/info.svg")} image={require("../res/info.svg")}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment