Looking around at some SDL games and emulators I notice that each time there's an android version of it, same base code is used as the desktop versions.
For example in an atari 7800 emulator I've found on github, I don't really understand java and I'm trying to see how it's done there. I suppose that based on the line 991 it captures the display from the sdl2 process maybe by running it headless and rendering the sdlwindow in android?
No idea, trying to understand the code but I'm like looking at it like a cat looking at a calendar (a saying in my country).
What I'm trying to do is to somehow archive the same thing in QT5 since the platform I'm using uses it for the interface and anything app related to communicate with their APIs.
Related
I am looking to get started with some 3D programming in C or C++. The problem I have is that it seems like the only tutorials I can find for Mac OS use objective C and Cocoa frameworks. I want to obtain the same environment as Windows users, more or less.
If I try to use a text editor and g++ compiler, I am missing headers, but, if I try to use Xcode, I am forced to grapple with Cocoa, which is frustrating to me. I don't really see any reason why the OpenGL/GLUT that comes pre-installed on Mac should force me to use Xcode, but it seems I can't get the header files without it.
How can I get through all of the Apple 'developer friendly' interfaces to write some old-fashioned code with full cross-platform portability?
Some portion of Objective-C is inevitable if you want to use the latest benefits of the OSX/Cocoa. The easiest way to port an existing application to MacOS would be the following:
Write the "bare bones" nibless application in Objective-C. It would only be a single AppDelegate class and a little setup in the main() function
Add the custom NSGLView descendant in your window which you create in the AppDelegate's didFinishLaunching event handler
Setup the CVDisplayLink and rendering callback in the NSGLView initialization
Use your existing OpenGL rendering code in the CVDisplayLink's callback
Now for the interesting part: where to get all of this ?
Surprisingly, a good nibless application sample is the UI for OSX's port of QEMU (yes, the emulator). Also the Apple's official GLEssenstialPractices demo shows all the information you need to set up OpenGL rendering pipeline. All the rest is up to you.
The detailed and modern introduction to system-level OSX programming can be found in the "Advanced Mac OS X Programming" book by Mark Dalrymple. It explains many things and after reading all of this I've understood most of the design decisions in the OS (it really makes you accept all the "non-standard" things if you think from the performance viewpoint).
To get through the "nibless" programming I would recommend you to read the blog posts like this one http://blog.kleymeyer.com/2008/05/creating-cocoa-applications-programatically-ie-nib-less/ The google search helps a lot.
The same tricks apply to the CocoaTouch/iOS and there are a lot of questions answered on SO, like this one Cocoa touch/Xcode - generating NIB-less graphics context
If you want to create cross-platform applications you could create a project with the Command Line Tool template.
Next, import the OpenGL and GLUT framework. This will get you a "blank" C++ project with the required OpenGL and GLUT headers.
Lighthouse 3D gives you some tips about portability and how to initiate your first project.
http://www.lighthouse3d.com/tutorials/glut-tutorial/initialization/
I have created a software layer (named cocoglut) that allows the translatation of basic or essential GLUT calls to COCOA. This library allows creating/destroying windows and register callbacks from a C/C++ application, just by using GLUT calls, without the need for nib files or for XCode project files (and can be compiled from the command line). This option uses full retina display resolution. The source is on GitHub.
I have access to both OSX and Windows. I have built my demo in Visual Studio 2010 using C++ and DirectX 10. I have read that C++ can be run on the iPhone using XCode, but that any input has to handled in objective-c.
At present there is no input so that's not an issue right now.
What are the steps I would have to take to get it running on the iPhone?
also - was not quite sure how to tag this question. by all means edit them if they're wrong.
Yes, you can run C++ code fine on an iPhone. I've released a couple games which have a large C++ component. Of course, the graphics will need to be redone.
Likely you'll need a little bit of Objective-C++ code to communicate between the UI layer and the underlying engine.
There's no DirectX on iOS (being that it's made by Microsoft) so any code that calls DirectX is going to need to be ported over to something that can be run on iOS, like OpenGL.
Other than that you'll be treating your code like a library. With a layer of objective-c that sets up the app, and calls the necessary parts of your C++ code.
After using 'cocos2d-iphone' in one of my projects, I am trying to decide which flavor of Cocos2d I should use for an Android game. My personal list of pros and cons:
Cocos2d-x
pros: it should be easier to bring the game to iOS later, potentially other platforms as well
cons/doubts: debugging c++ code on Android (easy or not?), compatibility of NDK app with various Android devices (how much of a problem?), accessing platform-specific functionality (in-app purchases, etc.)
cocos2d-android
pros: all Java, easier to setup and access platform-specific functions
cons: will have to translate from Java to either c++ or Objective-C for other platforms
Are there other issues with either of the options that I didn't think about? If anybody had to make this choice, what did you choose and why?
Note that there are two projects with almost the same name: cocos2d-android and cocos2d-android*1*. The latter is a fork of the former and its author did it because cocos2d-android project was almost dead.
In the beginning I was in doubt about cocos2d-android1 (which seems to be a very good work) and cocos2d-x but the possibility to develop in C++ (that I like a lot) and be multi-platform made me chose cocos2d-x.
I'm still trying to learn cocos2d-x.
What I like about it:
List item
it's a C++ framework
you can develop for Android, iPhone, Bada, Blackblerry Playbook, Windows and Linux.
Please, notice that at the moment cocos2d-x team advises that Windows and Linux port are meant for easy your development not for production.
it has a Lua binding
it has a version for Marmalade (a paid multi-platform SDK)
cocos2d-x works with NDK since release 4. Currently I'm using NDK r7. You can develop for devices running since android 2.1 (API 7)
It seems that there are some issues with cocos2d-x on android 4 (what shouldn't be a problem because both it's still not that wide spread and cocos2d-x team will fix any problem they come across).
You will be able to access platform specific functionality like in-app purchase but it comes with a price: you will do almost everything using JNI.
Definitely it's harder than just putting a jar SDK into libs folder and directly call Java functions but it's feasible.
You can develop on Windows, Linux or Mac. For each OS you're using in the development machine the procedures to prepare your environment (cocos2d-x + target SDKs) varies. It's not a problem because you usually will stick with one of them.
Now let me tell you that it's not that easy to debug JNI / Java code. Why? Because there are many steps you must take to enable this and debugging process is slow.
So that cocos2d-x team advices to develop all your game for Linux or Windows and after that everything is up and running you compile it to Android. This way you will have minor problems to solve (if any)
I prefer to develop for android from the beginning.
All in all, I'm really happy coding with cocos2d-x. Community is very passionate about cocos2d-x and they are very supportive.
In the process of learning I wrote two tutorials:
Developing with cocos2d-x for android on Linux, that teaches how to prepare your environment to develop for android using cocos2d-x
How to debug cocos2d-x and Java code using Eclipse that explain in details all needed steps to perform debugging sessions.
Regards.
I had the same problem 2 month ago. Cocos2d-Android is dead, so use cocos2d-x. Here some links and tutorials to start using it.
If you are comfortable with C/C++ , by all means go the Cocos2d-x route.
HOWEVER, if you are coming from an Android and Java background, with no experience in C++ , it can be a really painful experience getting everything in order.
In asmuch as the Cocos2D for Android Project has been slow recently, I wont particularly say its dead. I used the version hosted on github here ..
https://github.com/ZhouWeikuan/cocos2d
There are several tutorial on getting started.
Step by Step Guide on How to build your first Slider Puzzle game in Cocos2d for Android – Part 1 http://denvycom.com/blog/step-by-step-guide-on-how-to-build-your-first-slider-puzzle-game-in-cocos2d-for-android-part-1/
How To Make A Simple Android Game with Cocos2D http://dan.clarke.name/2011/04/how-to-make-a-simple-android-game-with-cocos2d/
For all others coming to this thread, I hope this is useful!
cocos2d-x (98% in C++ and some Android Java Code) is the only version of cocos2d useful for Android.
cocos2d Android (all Java) may be useful if you want to create some prototypes, but as an active open source development project it is long dead and not maintained.
If you want to write a Java game on Android, use AndEngine - it is active and well maintained.
Good Day
I want to start a opengl project, mainly to follow the Nehe tutorials.
My problem is that I only see templates for opengl es for iphone, and when I click build on those, I only have the choice between iphone or ipad simulator.
So How can I get started with a simple opengl template to follow the tutorial series, without using a simulator, but executing it natively on my mac osx lion?
Please give me a step by step instruction if possible :)
I looked around everywhere but all I found were instructions for Xcode 3 and below etc.
Any help would be appreciated
Create a normal Cocoa project, add the OpenGL framework. In your main window add a NSOpenGLView.
http://developer.apple.com/devcenter/mac/resources/opengl/
I am currently in the process of writing an intuitive Xcode 4 Template for an OpenGL Mac application, which I think is exactly what you were wanting.
In the mean time, you can look at this, a Pong clone I made in OpenGL on the Mac, done the proper way.
EDIT: The template isn't completely finished, but it's definately usable. I didn't implemenet the 3D option, so picking that in the dropdown will result in blank files.
Donwload it from here and then move it into the ~/Library/Developer/Xcode/Templates/Project Templates/Applications folder in your user director.
I understand that it's possible to write a plugin for a browser which lets you render to the browser window, so you can effectively run a normal app within the browser. NOT using JS or client technology, but a plugin which basically wraps your application - in our case C++ which does 3D rendering using DirectX or OpenGL.
I know that we'd have to have versions for both IE and other browsers but how does this work - in Windows-speak do we get a HWND through the plugin architecture or is it more complex?
Do you have to write a version of the plugin compiled for each platform - Win/Mac/Linux, since a plugin is a binary I assume this is the case, so you have one version for IE and then multiple versions for FF, Chrome, Safari (which share the same plugin setup IIRC)
With FF - is this an example of a plugin or an extension specifically?
An example of what I mean is QuakeLive - proper 3D rendering within the browser. We're actually using Ogre (cross-platform C++) but this uses Direct3D/OpenGL so it's the same thing.
Things like QuakeLive can be done rather quite simply with Google's NativeClient SDK. It abstracts away the whole plugin architecture so that you can focus on writing your software, and provides support for nearly all plugin-capable browsers on Windows, Mac OS X, and Linux, portably. The user installs the NaCl plugin (which is included in some versions of Chrome and Chromium), and your software runs inside NaCl, seamlessly on all supported platforms, from a single binary.
Note that you can use OpenGL portably from within NaCl, but not DirectX. Future versions will also support ARM and x86_64 with technology from the LLVM project.
FireBreath is a great cross-platform, cross-browser library for developing C++ browser plugins.
Flash Player 11 provides true 3D support via Stage API over DirectX, OpenGL or whatever available at the device:
http://techzoom.org/adobe-flash-player-11-air-3-beta-stage3d-and-64bit-support-on-linux-mac-and-windows/
Its in beta now, so user needs to install it manually, but when Adobe release it then majority of browsers will provide true 3D support instantly. Latest Away3D beta already supports Stage API.
I have a need to get some of this done soon, so if anyone here is an expert on this please look me up.
Steve Bell
Archiform 3D animation studio