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

Author Topic: Drawing from class  (Read 1681 times)

0 Members and 1 Guest are viewing this topic.

Veristeron

  • Newbie
  • *
  • Posts: 1
    • View Profile
Drawing from class
« on: December 23, 2011, 03:04:27 pm »
Hi, first post on forum ;)

I've choosed SFML for maze project. I would like to make a GUI class, but i'm not sure if i can draw sprites on RenderWindows from other files than one with RenderWindow declaration.

For example, is it possible to make a function like GUI->Check(int x, int y), where x,y - mouse position, which would check mouseover effects, and draw the right Sprites on window?

Regards - Veri

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Drawing from class
« Reply #1 on: December 23, 2011, 03:40:45 pm »
No offense, but please learn C++ and read the SFML tutorials first. Your questions seem to be very basic.

phufhi

  • Newbie
  • *
  • Posts: 8
    • View Profile
Drawing from class
« Reply #2 on: December 26, 2011, 02:54:02 pm »
I believe drawing fron other classes is done by passing a renderwindow pointer to the function that draws the sprites. Then you simply do: Renderwindow->draw(sprite);
As for mouse events, you should check the sfml documentation. It depends on the version of sfml (even though they are fairly similar).

 

anything