image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
LinkBack Thread Tools
  #1  
Old March 28th, 2008, 05:44 PM
Registered User
 
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
raydot is on a distinguished road
Question Objective-C and C++? (And Qt!)

All,

For a personal project I want to create a simple 2D game that I can use to build out some AI classes and the like in C++.

Does anyone know of any resources that describe how to add C++ classes into your XCode projects? Everything out there seems to be written in Objective-C, or doesn't include any discussion of graphics (not game-type graphics, at least).

I don't mind doing the graphics whichever way but I'd like the AI classes to be in C++. Any suggestions on how to bridge the gap? Can Objective-C and C++ even be mixed in a single application? Any thoughts on Qt?

Thanks.
Reply With Quote
  #2  
Old March 29th, 2008, 04:28 AM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,682
Thanks: 6
Thanked 53 Times in 48 Posts
Mikuro will become famous soon enough
Objective-C and C++ can indeed be mixed, in a hybrid called Objective-C++. The short answer is that you need to rename your Objective-C .m files to .mm to use C++ code in them. See http://www.cocoadev.com/index.pl?ObjectiveCPlusPlus for more info. (And bookmark that site, because it will be your new best friend.)

As for graphics, you'd probably want to use OpenGL, or perhaps find a C/C++ sprite framework based on OpenGL.
__________________
Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.8

Useful programs: Privoxy, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
  #3  
Old March 29th, 2008, 02:46 PM
Registered User
 
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
raydot is on a distinguished road
Thanks Mikuro! This is a huge help. I knew a solution had to be out there.
Reply With Quote
Reply

Bookmarks

Tags
c++, games, graphics, objective-c, qt?

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT -5. The time now is 09:45 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.