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

Author Topic: Card game graphic help  (Read 1338 times)

0 Members and 1 Guest are viewing this topic.

bogdyby

  • Newbie
  • *
  • Posts: 1
    • View Profile
Card game graphic help
« on: July 31, 2017, 11:19:04 am »
Hi guys, i want to do a card game in c++, and it didn t work very well at graphic part.

Can you tell me how i can do a clickcable picture and how i can chose a action for that button when he's pressed? I using sfml 2.4

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Card game graphic help
« Reply #1 on: July 31, 2017, 12:35:11 pm »
When you click on a window, the operating system sends an event to that window. When you check the events in the event loop, you check for the "mouseButtonPressed" event and, if one exists, you check if the current mouse position is inside the image/sprite/button. The mouse button pressed event contains the mouse position. To do that check, get the global bounds of the image's object and then use its "contains" method to see if the mouse position is within its bounds.

More information:
Events
Rect's Contains method
Making sure the mouse position is in the same co-ordinates system if you are using a view
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything