x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Card Game input in C++?

Simply put, my project doesn't have a need for anything besides a table, some cards, and a non-movable top-down camera view. That being said, how would I set up player input in this scenario? What should receive it? From what I can tell in C++, a player controller subclass still requires a separate pawn class in order to assign/bind and possess input, so where's a good place to start if I don't need more than a table full of cards? Is it really that necessary to place a bunch of empty blueprints (with C++ parents) into the scene?

I guess in reality, I'm looking for a way to bind a mouse click or keypress to a function, without the need of a pawn class (and possibly w/o a player controller?)...

I've looked at the card demos from the Learn tab in the Epic Launcher, but they didn't come with any code. It was all Blueprints, whereas my project aims to be (nearly) all C++ code. Any links or suggestions are welcomed and much appreciated, thanks!

Product Version: UE 4.10
Tags:
more ▼

asked Nov 23 '15 at 11:36 AM in C++ Programming

avatar image

MichaelWion
250 27 40 50

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I think you are going to spend more time to break the UE4 system than just adapt to their style. You can set the Default Pawn of your game mode to None, and bind inputs in the PlayerController. Note that you can bind inputs in C++ with the function :

 void AMyPlayerController::SetupInputComponent()
 {
  Super::SetupInputComponent();
  EnableInput(this);
 
  InputComponent->BindAction(FName("NameOfInput"), EInputEvent::IE_Released, this, &AMyPlayerController::ActionToDoAccordingToTheInput);
 
  ...
 }

Hope it helps.

more ▼

answered Nov 23 '15 at 03:09 PM

avatar image

Begounet
933 34 27 50

avatar image MichaelWion Nov 23 '15 at 03:36 PM

Didn't know I could simply set the default pawn to "None". This did the trick, thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question