Created
April 21, 2011 12:07
-
-
Save koyachi/934338 to your computer and use it in GitHub Desktop.
fieldkit.cpp sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var g2d = new Graphics2D(); | |
function main() { | |
g2d.background(1.0, 1.0, 1.0); | |
g2d.stroke(0.0, 0.0, 0.0); | |
g2d.fill(0.0, 1.0, 0.0); | |
g2d.rect(0.1, 0.1, 0.3, 0.3); | |
// なんか変 | |
// var msg = "hello"; | |
// g2d.textFont("Helvetica", 0.01); | |
// g2d.text(msg, 0.1, 0.1); | |
g2d.fill(1.0, 0.0, 1.0); | |
g2d.rect(0.2, 0.2, 0.3, 0.3); | |
} | |
main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cinder/app/AppBasic.h" | |
#include "cinder/gl/gl.h" | |
#include "cinder/gl/Texture.h" | |
#include "cinder/ImageIo.h" | |
#include "fieldkit/FieldKit.h" | |
#include "fieldkit/script/ScriptKit.h" | |
using namespace ci; | |
using namespace ci::app; | |
using namespace std; | |
using namespace fieldkit; | |
using namespace fieldkit::script; | |
class HelloCinder20110420App : public AppBasic { | |
private: | |
ScriptContext *scriptContext; | |
Graphics2D *g2d; | |
public: | |
void prepareSettings(Settings *settings); | |
void setup(); | |
void mouseDown( MouseEvent event ); | |
void update(); | |
void draw(); | |
}; | |
void HelloCinder20110420App::prepareSettings(Settings *settings) { | |
settings->setWindowSize(800, 600); | |
settings->setFrameRate(60.f); | |
} | |
void HelloCinder20110420App::setup() | |
{ | |
scriptContext = new ScriptContext(); | |
g2d = new Graphics2D(); | |
scriptContext->add(g2d); | |
scriptContext->execute("/Users/koyachi/code/cinder/HelloCinder20110420/src/foo.js"); | |
} | |
void HelloCinder20110420App::mouseDown( MouseEvent event ) | |
{ | |
} | |
void HelloCinder20110420App::update() | |
{ | |
/* | |
// NG | |
if (scriptContext->filesModified()) { | |
delete scriptContext; | |
delete g2d; | |
scriptContext = new ScriptContext(); | |
g2d = new Graphics2D(); | |
scriptContext->add(g2d); | |
scriptContext->execute("/Users/koyachi/code/cinder/HelloCinder20110420/src/foo.js"); | |
} | |
*/ | |
} | |
void HelloCinder20110420App::draw() | |
{ | |
} | |
CINDER_APP_BASIC( HelloCinder20110420App, RendererGl ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment