summaryrefslogtreecommitdiff
path: root/gui/src/chainImage.h
blob: 3db4cb2b32d8bc90001f7342b3d33b1c0236eb35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once

#include "ofMain.h"

#define THUMB_BORDER_RATIO 0.8

class chainImage : public ofImage{
	//todo: threaded image loader

	public:
		chainImage(){
			link=NULL;
			ofImage();
		}
		void init(ofPoint _linkPos,float _linkScale,float _linkRot);

		void start();
		bool load(std::string _filename){
			filename=_filename;
			return ofImage::load(filename);
		}

		bool update(float decayRatio);
		ofVec3f getTransform();
		float getScale();

		void drawChain(float fadeIn);

		ofImage thumbnail;
		void makeThumbnail();

		chainImage *link;
		ofPoint linkPos;
		float linkScale;
		float linkRot;
		float transition;
		float fadeIn;
		float speed;
		float time;
		float scale;

		std::string filename;

};

class chainImageSet{
	public:
		chainImageSet(){
			currentDefaultImageRatio=0.3;
		}
		void drawGui();
		bool add(std::string filename,glm::vec2 pos);
		void keyPressed(int key);
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		std::list <chainImage> images;
		float currentDefaultImageRatio;

		std::list<chainImage>::iterator selected;
		ofPoint clickPoint;
		ofPoint dragPoint;
		float dragScale;
};