diff --git a/README.md b/README.md index 675b84f..7800fff 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,48 @@ ofxAssets is an openFrameworks addon for simple access to assets inside your dat ## Usage -```c+++ -//insert usage here -``` \ No newline at end of file +### Include source and headers +Setup the addon with your project (e.g. drag the ofxAssets src files into your XCode project). + +### Put assets into an assets folder + +Assets go inside `data/assets` + +``` +appFolder/ +appFolder/data/assets/images - places images here (png, jpg, jpeg) +appFolder/data/assets/shaders - place any shaders here (vert, frag, geom) +appFolder/data/assets/fonts - place any font files here (ttf) +``` + +### Use ofxAssets in your code + +`header` +```c++ +#include “ofxAssets.h” +using namespace ofxAssets; // this is optional +``` + +`source` +```c++ +//example +void testApp::draw() { + + // quick access to assets + image(“imageName”).draw(10,10); + font(“fontName”, 30).drawString(“...”, 10, 10); + shader(“shaderName”).begin(); + + // if you don’t put ‘using namespace ofxAssets’ at the top of your source or header, then use: + ofxAssets::image(“imageName”).draw(10,10); +} +``` + +You can also reload the asset register (e.g. you edit an image externally and what to see it updated in your app) using + +```c++ +AssetRegister::refresh() +``` + +## Notes +If your asset filename is like `background.png`, then you access this asset without the extension, e.g. `image(“background”).draw(10,10)`. \ No newline at end of file diff --git a/ofxAssets-example/addons.make b/ofxAssets-example/addons.make index 69d05dd..a826058 100644 --- a/ofxAssets-example/addons.make +++ b/ofxAssets-example/addons.make @@ -1,6 +1,4 @@ #This file is currently only for linux users! #Add your addon and all other necessary ones here (without '#') #put every addon in one line, for example -#myAddon -#ofxXmlSettings -#ofxOpenCv +ofxAssets \ No newline at end of file