Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a game written in C++ (using STL and c++11 extensively).

I would like to do the following things:

  • Attach graphics to this game -> Think chessboard of some kind. I just need some pictures and simple status bars, no movement necessary, even though it would be nice I guess. It's a turn based game.
  • Port the game across Windows / Android / iOS

So, all in all, I need a tool that would provide a portable, simple, 2D graphical interface. A tool that would allow me to "bind" my c++ code to portable graphical representation.

How would I go about making this idea come true?

share|improve this question
    
Are you making a game, or a game engine? Also, are you asking for us to suggest a 2D graphics interface you could use, or are you asking for something else? Please be clearer. –  Jonathan Hobbs May 8 '12 at 0:43
    
Edited my question. Yes, i basically want to take my code, stitch some 2D representation to it and port it :) –  ScarletAmaranth May 8 '12 at 0:49
    
Best bet would be cocos2d-x –  Coyote May 10 '12 at 15:07
add comment

5 Answers 5

up vote 2 down vote accepted

Since the customary language for ios is objective-c and android is java, you should add to your question that you need a kit that also supports C++ across those platforms.

http://www.madewithmarmalade.com/ is one, it's probably stronger than what you're looking for and it's not free... but there is a trial version.

I have not tried it personally, your mileage may vary.

share|improve this answer
    
This is not fully true. Android supports native C++ if you're able to configure the NDK. There's also a version of SDL that uses NDK to run on android. The only problem I see is that it doesnt support all the STL lib yet, maybe C++11 set may be out. Just a guess, but you can try to replace it with BOOST or other implementation of the TR1. It may work or not. –  Gustavo Maciel May 8 '12 at 2:11
    
Yes, but unfortunately none of those options answer the question of being portable to all the platforms and with 2D graphics. That being said, I'm going to have to check out android and C++ because I'm most familiar with that language and it might be fun –  Patrick Hughes May 8 '12 at 2:22
    
cocos2d-x works great on android and iOS... it's C++ and is supported natively on both. –  Coyote May 8 '12 at 22:04
add comment

No need to hook to HTML5 or native iOS/Android graphics functions when you have native OpenGL ES support on both platforms. On android binding native graphics Java functions to your C++ code would give you horrendous results.

I think your problem can be solved with a little help from a friend... I would safely bet cocos2d-x does what you need. It is mainly a 2D graphics engine. It's a cross platform C++ OpenGL (ES) based library.

It's a port of cocos2d which is a very successful Objective-C game framework. But don't reject it on the basis of it's framework status. You don't have to use everything.

Of course you will have to take the time to get to know the library, the features and optimizations it offers. But I believe you will find a lasting friendship with this one.

To run your C++ code on android you will have to go with the Android NDK. You will have to compile most of your game as a library and bridge calls to the native Android functions.

share|improve this answer
add comment

You've really started backwards in some respects. Even if your only goal was to add "simple" graphics for one platform, you would find yourself spending much more time on the graphics than on the underlying game implementation.

I would look at using a browser to display the pictures you need, which would be platform independent; and put your game logic on a web server. I would guess that a turn based game wants a web server in the loop anyway.

share|improve this answer
add comment

Have you considered using the Qt framework? It has the UI and simple 2D graphics capability all in one package. Works on Windows, Apple, and phones.

share|improve this answer
add comment
  • Portable C++0x is not quite there yet, depending on what features you use.
  • As for cross platform input, graphics, etc SDL2 is stable enough these days.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.