summaryrefslogtreecommitdiff
path: root/src/viewport.h
blob: 7ab1477a29444dbaf0582688e9851142516c352d (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
#ifndef VIEWPORT_H
#define VIEWPORT_H

#include "ofMain.h"
#include "ofxXmlSettings.h"

class vpcontrol {
	public:
		vpcontrol(){
			fillgrey=false;
			fillgreyfreq=1.0f;
			xshift=0;
			yshift=0;
			fscale=1.0f;
		}
		void loadpalette(string &filename){
			ofxXmlSettings XML;
			if( !XML.loadFile(filename) ){
				printf("unable to load palette file\n");
			}else{
				palette.clear();
				palettename=XML.getAttribute("palette","name","",0);
				if(XML.pushTag("palette")) {
					int numCols=XML.getNumTags("colour");
					for (int i=0;i<numCols;i++) {
						palette.push_back(ofColor.fromHex(ofFromHex(XML.getAttribute("colour","hex",0x00,0))));
					}
				}
			}
		}
		bool fillgrey;
		float fillgreyfreq;
		int xshift,yshift;
		float fscale,scale;
		vector<ofColor> palette;
		string palettename;
};

class viewport
{
    public:
		viewport();
		viewport(int _w,int _h,int _ox,int _oy);
		virtual ~viewport();
	    void setup(int _w,int _h,int _ox,int _oy);
	    void drawport(vpcontrol &control);
		void draw(uint8_t brightness);
		ofFbo rb1,rb2;
    protected:
    private:
		int x,y,w,h,ox,oy;
		float seed;
};

#endif // VIEWPORT_H