1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-10-25 09:27:01 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Thomas Harte
dfcc502a88 Merge pull request #360 from TomHarte/SDLJoystick
Introduces keyboard-as-joystick fallback for the SDL target.
2018-03-04 17:28:05 -05:00
Thomas Harte
1c6faaae88 Introduces keyboard-as-joystick fallback for the SDL target. 2018-03-04 17:26:32 -05:00
Thomas Harte
35c8a0dd8c Merge pull request #359 from TomHarte/MentionColecoVision
Adds the ColecoVision to the declared list of machines.
2018-03-03 19:05:05 -05:00
Thomas Harte
38feedaf6a Adds the ColecoVision. 2018-03-03 19:03:54 -05:00
4 changed files with 31 additions and 6 deletions

View File

@@ -460,12 +460,35 @@ int main(int argc, char *argv[]) {
// deliberate fallthrough...
case SDL_KEYUP: {
KeyboardMachine::Machine *keyboard_machine = machine->keyboard_machine();
if(!keyboard_machine) break;
const bool is_pressed = event.type == SDL_KEYDOWN;
Inputs::Keyboard::Key key = Inputs::Keyboard::Key::Space;
if(!KeyboardKeyForSDLScancode(event.key.keysym.scancode, key)) break;
keyboard_machine->get_keyboard().set_key_pressed(key, event.type == SDL_KEYDOWN);
KeyboardMachine::Machine *const keyboard_machine = machine->keyboard_machine();
if(keyboard_machine) {
Inputs::Keyboard::Key key = Inputs::Keyboard::Key::Space;
if(!KeyboardKeyForSDLScancode(event.key.keysym.scancode, key)) break;
keyboard_machine->get_keyboard().set_key_pressed(key, is_pressed);
break;
}
JoystickMachine::Machine *const joystick_machine = machine->joystick_machine();
if(joystick_machine) {
std::vector<std::unique_ptr<Inputs::Joystick>> &joysticks = joystick_machine->get_joysticks();
if(!joysticks.empty()) {
switch(event.key.keysym.scancode) {
case SDL_SCANCODE_LEFT: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput::Left, is_pressed); break;
case SDL_SCANCODE_RIGHT: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput::Right, is_pressed); break;
case SDL_SCANCODE_UP: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput::Up, is_pressed); break;
case SDL_SCANCODE_DOWN: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput::Down, is_pressed); break;
case SDL_SCANCODE_SPACE: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput::Fire, is_pressed); break;
case SDL_SCANCODE_A: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput(Inputs::Joystick::DigitalInput::Fire, 0), is_pressed); break;
case SDL_SCANCODE_S: joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput(Inputs::Joystick::DigitalInput::Fire, 1), is_pressed); break;
default: {
const char *key_name = SDL_GetKeyName(event.key.keysym.sym);
joysticks[0]->set_digital_input(Inputs::Joystick::DigitalInput(key_name[0]), is_pressed);
} break;
}
}
}
} break;
default: break;

View File

@@ -13,6 +13,7 @@ It currently contains emulations of the:
* Acorn Electron;
* Amstrad CPC;
* Atari 2600;
* ColecoVision;
* Commodore Vic-20 (and Commodore 1540/1);
* MSX 1;
* Oric 1/Atmos; and
@@ -43,6 +44,7 @@ If your machine has a 4k monitor and a 96Khz audio output? Then you'll get a 4k
|![Repton 3 in game, with a classic 1:1 pixel emulation](READMEImages/NaiveRepton3.png)|![Repton 3 in game, decoded from an interlaced composite feed](READMEImages/CompositeRepton3.png)|
|![Stormlord with a classic 1:1 pixel emulation](READMEImages/NaiveStormlord.png)|![Stormlord decoded from a composite feed](READMEImages/CompositeStormlord.png)|
|![Road Fighter with a classic 1:1 pixel emulation](READMEImages/NaiveRoadFighter.png)|![Road Fighter decoded from a composite feed](READMEImages/CompositeRoadFighter.png)|
|![A segment of the ColecoVision Donkey Kong title screen with a classic 1:1 pixel emulation](READMEImages/NaivePresentsDonkeyKong.png)|![A segment of the ColecoVision Donkey Kong title screen decoded from a composite feed](READMEImages/CompositePresentsDonkeyKong.png)|
| 1:1 Pixel Copying | Correct Aspect Ratio, Filtered |
|---|---|
@@ -65,7 +67,7 @@ Cycle-accurate emulation for the supported target machines is fairly trite; this
Self-ratings:
* the Electron, Oric and Vic-20 are pretty much perfect;
* the ZX80, ZX81 and MSX 1 are very strong;
* the ZX80, ZX81, ColecoVision and MSX 1 are very strong;
* the Amstrad CPC has known accuracy deficiencies in its 8272 and 6845;
* the Atari 2600 has some known accuracy deficiencies in its TIA;
* the C-1540(/1) is locked in reading mode and doesn't yet support writing.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B