简体   繁体   中英

C++ and Mac OSX

In just about all books I read it mentions windows APIs(eg DirectX) when talking about C++ and game programming.

What APIs are for Mac when using C++ or what can be used for multi-platform development?

I want to create games using C++ and am currently on a Mac. I have no problem switching between Unix and Windows if it is needed.

What is recommended for C++ game development and will programming for mac be a drawback?

Or should I just go with C++ and OpenGL and use it for all platforms? :P

I would recommend SFML and OpenGL. SFML is a more modern, C++ oriented, cross platform framework that allows you to write common code for window, keyboard and mouse handling. You would then write the bulk of your game using OpenGL, which is cross platform anyway.

\n

I am using SFML and OpenGL myself to target Mac OS X, Linux and Windows, primarily developing on Mac (I can triple boot into any of the three OSs to develop on them).

EDIT: I've had a change of heart on this as I am a bit spooked by the Mac support in SFML; I am now going to use Qt as it is better supported, provides better tools, better documentation and better examples.

You can use OpenGL wich is cross platform, and use GLUT or SDL for handling input and windows and stuff or use just SDL. (I would go with mixing OpenGL and SDL and because its easier to manage input that way and is still cross platform. Unless your making a 2D game, then use SDL as SDL is for making 2D games).

Ohh and one addition thing about OpenGL on Mac is the header for OpenGL is a little different from most tutorials:

#include <OpenGL/OpenGL.h>

Don't spend hours on that like I did...

Oh, and if you plan to use glut:

#include <GLUT/glut.h>

If you're making a 2D game I would also recommend you try SFML ; it's a fairly young library that has the same scope as SDL. It's pure C++ (as opposed to SDL which is just C) so development should be somewhat easier for you, if you like OOP.

It would also appear that SFML is significantly faster than SDL:
http://www.sfml-dev.org/forum/viewtopic.php?t=43

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM