Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML Book/How to use the Mouse to control an entity  (Read 1012 times)

0 Members and 1 Guest are viewing this topic.

madcat

  • Newbie
  • *
  • Posts: 21
  • Creator of TacWars
    • View Profile
    • TacWars
SFML Book/How to use the Mouse to control an entity
« on: August 19, 2014, 10:35:44 am »
Hi,
I was playing with the example and I thought, hey! Is there any elegant way to modify the existing Command structure to control the plane with the mouse as well as the keyboard.

The problem of course is that the mouse x,y or the delta movement has to be sent with the command action every Command.
That's where I got stuck.

 

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Book/How to use the Mouse to control an entity
« Reply #1 on: August 23, 2014, 09:59:43 pm »
The modification would not have to be part of Command -- which is only a class to deliver messages/events to the entities -- but rather Player, where the input is generated. Instead of reacting to the arrow keys, you could evaluate the mouse movement.

By the way, please post in the Help section if you need help, not in General Discussions.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything