Archive

Posts Tagged ‘e’

OpenSource OpenGL 2D RPG Engine (iPhone)

April 10, 2012 8 comments

Hey guys,

if you are following this blog long enough than you surely know that I was writing a 2D RPG Engine about 9 months ago. Well, i stopped the project at the end of last year due to more interesting stuff but had a lot of questions in the last time if I couldn’t make it available for the community.

So here we go.. Download the Engine Source code here:

https://github.com/MarkusPfundstein/OpenGL-2D-RPG-Engine-iPhone

READ THIS: – The code is by NO MEANS perfect. It was the first time that I approached a big project like this, so stuff is sometimes a bit messy. Especially the implementation of the script engine is nothing i am proud of but ok 🙂 I think for learning purposes it is pretty good. The engine can render up to 3000×3000 tiles on 60 fps on a ipod 4th gen.. That is quite powerful 🙂

Okidok! Have fun..

P.S. The source code for the Level Editor written in Cocoa and C++ will be online next week! Stay tuned 🙂

Cocos2dx Extensions: CCValue

March 25, 2012 1 comment

Hey guys,

i added another small extensions to my github. It is a template class which can be used like the NSValue class from the Cocoa library so basically speaking it allows you to store structs like CCRect/CCPoint in CCArray and CCDictionary which can be incredible useful sometimes.

Clone it here: https://github.com/MarkusPfundstein/Cocos2DX-Extensions

Some example code:


CCRect t1;

t1.size = CCSizeMake(100, 200);

t1.origin = CCPointMake(10, 33);


CCValue<CCRect> *value = CCValue<CCRect>::valueWithValue(t1);


CCArray *array = CCArray::arrayWithCapacity(2);

array->addObject(value);


CCRect t2;

t2.size = CCSizeMake(100, 200);

t2.origin = CCPointMake(10, 33);


CCValue<CCRect> *v2 = CCValue<CCRect>::valueWithValue(t2);


CCValue<CCRect> *v3 = static_cast<CCValue<CCRect> *>(array->objectAtIndex(0));


CCValue<CCRect> *v4 = CCValue<CCRect>::valueWithValue(v3);

CCRect rectv4 = v4->getValue();

rectv4.size = CCSizeMake(10,10);


if (v3->isEqualToValue(v2))

{

    CCLog("Equal");

}


if (v3->isEqualToValue(v4))

{

    CCLog("still equal");

}