diff options
Diffstat (limited to 'offsetProject/src')
| -rw-r--r-- | offsetProject/src/imageStore.h | 28 | ||||
| -rw-r--r-- | offsetProject/src/main.cpp | 2 |
2 files changed, 22 insertions, 8 deletions
diff --git a/offsetProject/src/imageStore.h b/offsetProject/src/imageStore.h index 3cfb7eb..1db0ee2 100644 --- a/offsetProject/src/imageStore.h +++ b/offsetProject/src/imageStore.h @@ -3,7 +3,7 @@ #define IMAGE_STORE_SIZE 256 #define MIN_TILE_SIZE 8 -#define MAX_TILE_SIZE 32 +#define MAX_TILE_SIZE 16 #include "ofMain.h" #include "ofxJSONElement.h" @@ -121,19 +121,33 @@ class imageStore : public ofThread{ to_update.pop_front(); - int drawcount=0; - for (map<string,ofImage>::iterator i=images.begin();i!=images.end();++i){ - if(i->second.isUsingTexture()){ - drawcount++; - } - } + //int drawcount=0; + //for (map<string,ofImage>::iterator i=images.begin();i!=images.end();++i){ + // if(i->second.isUsingTexture()){ + // drawcount++; + // } + //} //cout<<"loaded "<<im<<" "<<ofToLong(im)%(long)(ofGetWidth()-images[im].getWidth()+1)<<","<<ofToLong(im)%(long)(ofGetHeight()-images[im].getHeight()+1)<<endl; } + /* for (map<string,ofImage>::iterator i=images.begin();i!=images.end();++i){ if(i->second.isUsingTexture()){ i->second.draw(ofToLong(i->first)%(long)(ofGetWidth()-i->second.getWidth()+1),ofToLong(i->first)%(long)(ofGetHeight()-i->second.getHeight()+1)); } } + */ + map<string,ofImage>::iterator it=images.begin(); + if (it!=images.end()){ + for (int i=0;i<ofGetWidth()/MAX_TILE_SIZE;i++){ + for (int j=0;j<ofGetHeight()/MAX_TILE_SIZE;j++){ + if (it->second.isUsingTexture()){ + it->second.draw(i*MAX_TILE_SIZE,j*MAX_TILE_SIZE); + } + it++; + if (it==images.end()) it=images.begin(); + } + } + } unlock(); } } diff --git a/offsetProject/src/main.cpp b/offsetProject/src/main.cpp index 9013dff..fc6f65f 100644 --- a/offsetProject/src/main.cpp +++ b/offsetProject/src/main.cpp @@ -1,6 +1,6 @@ #include "ofApp.h" int main() { - ofSetupOpenGL(600, 400, OF_WINDOW); + ofSetupOpenGL(1500,800, OF_WINDOW); ofRunApp(new ofApp()); } |
