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

Author Topic: Where to place Window and Events using xCode?  (Read 2404 times)

0 Members and 1 Guest are viewing this topic.

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Where to place Window and Events using xCode?
« on: October 23, 2014, 09:27:26 pm »
were exactly do i place the events and window ? I'm using mac, xCode and was explicitly told to have both the event and the window together, but must they be together in the main.cpp function or can i place them in a class of its own in another .cpp file? Would that work, if i wanted to stay in 1 thread! !

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Where to place Window and Events using xCode?
« Reply #1 on: October 23, 2014, 10:20:34 pm »
Have you read the tutorials? If not, read them.

Are you experienced with C++ in general? If not, go grab a good book on the subject before trying to use SFML.
SFML / OS X developer

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: Where to place Window and Events using xCode?
« Reply #2 on: October 24, 2014, 09:25:30 am »
I'm experienced in C++, i'm at an intermediate level in C++. I read the tutorial, were it mentions that
"Yep, that's true. Mac OS X just won't agree if you try to create a window or handle events in a thread other than the main one."

So at first, i was creating it in a seperate h/cpp file but then i was left wondering, must i only have the window and event in the main function and everything else in a seperate class? Just a curiosity!

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Where to place Window and Events using xCode?
« Reply #3 on: October 24, 2014, 12:47:47 pm »
Just placing part of your code into a different file does not create another thread. There is no reason to put all code into main, only simple examples do that.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Where to place Window and Events using xCode?
« Reply #4 on: October 24, 2014, 01:19:38 pm »
Reading your last message, I can only highly recommended you get the basis first. This is a huge confusion here; threads don't create themselves that easily.
SFML / OS X developer