I have been playing around with C++ and OF lately, getting familiar with the what I'm dealing with, which is pretty heavy. What can I say, C++ is hard. Here is an OF "hello world" program. It just prints "Hello OF" in red letters, but it will also give you an idea of how you can use OF. This is just a basic example derived from the examples in OF itself, but stripped down for clarity. The class is called testApp and this is the .h file for it:
#ifndef _TEST_APP#define _TEST_APP#include "ofMain.h"class testApp : public ofBaseApp
{public:
testApp();
void setup();
void update();
void draw();
void keyPressed (int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
}#endif
This is a great experiment from Sakri.net. The applications for this should be amazing. It's incredibly simple to use as well. Say you have an object on the stage named test, you simply do the following:
import flash.display.BitmapData;
import net.sakri.flash.bitmap.MarchingSquares;
var bmd:BitmapData = new BitmapData(test.width, test.height, true, 0x00000000);
bmd.draw(test);
var temp:Array = MarchingSquares.getBlobOutlinePointsClockwise(bmd);
Now temp contains Point objects that describe the outline of your item!
Posted by Shiggs | Posted in C++, Frameworks | Posted on 14-11-2009
If you haven't seen this yet, I highly recommend checking it out. As an Actionscript developer I have often come across performance limitations (if you code AS, you are yawning and saying something along the lines of duh jackass) BUT! I have a point. I have also come to greatly appreciate the simplicity and elegance of Actionscript, which is where OF comes in. OF stands for Open Frameworks and it's pretty much as good as it gets in terms of programming as far as I'm concerned. It is C++ so the learning curve is pretty much as steep as it gets minus assembly, but if you are comfortable with AS3, this should be ok for you, because of the programming model that OF offers, which is the beauty of this whole thing. AS3 ease with C++ performance. Check it out.
1.) Make sure your SDK supports it. I used 3.4 which you can download here.
2.) After you have done this go to your Flex preferences and add it to "Installed Flex SDK's"
3.) Now go to your project properties and under "Flex Build Path" under the "Library Path" tab remove playerglobal.swc from under the Flex SDK
4.) Click "Add SWC" and navigate to where your SDK is installed which will looks something like this Flex Builder 3\sdks\3.4.0.3794\frameworks\libs\player\10 and add playerglobal.swc from there
5.) Under the new playerglobal.swc you will see Link Type: merged into code click edit and select "external" from the drop down.
6.) Last thing is under "Flex Compiler" make sure your check is for flash player 10.