Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cpad w/ keyboard input into runtime #760

Merged
merged 25 commits into from
Aug 17, 2021

Conversation

ManDude
Copy link
Member

@ManDude ManDude commented Aug 14, 2021

No description provided.

@ManDude ManDude marked this pull request as ready for review August 16, 2021 15:00
@ManDude
Copy link
Member Author

ManDude commented Aug 17, 2021

This is a very basic implementation of the input system for the pc port. It maps buttons on the keyboard to cpad buttons used by the game. It requires running with a display on, and inputs are recognized in the display window. By default, the following keymapping is used:

  • X to Z key
  • Square to X key
  • Triangle to S key
  • Circle to A key
  • D-pad to the arrow keys
    The rest are unmapped.

There's some functions for debugging and testing this implementation. If you want to run the pc pad util functions, you need to (ml "goal_src/pc_debug/pc-pad-utils.gc") first.
You can run a placeholder button mapping util for cpad 0 on the runtime by running (pc-pad-input-start) and following the onscreen instructions. You simply press the keys you want to attach to each button. When the mapping is complete, it is saved to memory and to the config. This is implemented with an actual GOAL process! Pretty neat.
If you wish to cancel out of the button mapping util, just press Escape or run (pc-pad-input-stop). This also means you can't map any buttons to Escape.
You can check the current button mappings by running (pc-pad-show-start). This prints the button mapping to *stdout* on your left (it's too much text however and cpad 1 is cut off). (pc-pad-show-stop) will kill that process.

Graphics (& button mapping) settings are saved to a game_config folder in the project root whenever you finish the button mapping util.

Copy link
Collaborator

@water111 water111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

if (settings.debug) {
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
} else {
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_FALSE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea to make this an option

(analog 5)
(dualshock 7)
(negcon 2)
(namco-gun 6)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add support for the namco gun :)

@@ -0,0 +1,245 @@
;;-*-Lisp-*-
(in-package goal)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is awesome, it's great to see that we can write our own GOAL code with states and rendering and have it actually work!

(let ((procp
(make-function-process *nk-dead-pool* *active-pool* pc-pad-proc :name 'pc-pad-show
(lambda :behavior pc-pad-proc ()
(stack-size-set! (-> self main-thread) 512)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm kind of surprised we needed more than the default stack size here. I'm guessing you hit the limit when this was smaller?

@water111 water111 merged commit 8396281 into open-goal:master Aug 17, 2021
@ManDude ManDude deleted the d/cpad-test branch September 7, 2021 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants