Browse Source

Arbeit in Afrika

Menus
seba 12 years ago
parent
commit
f542e933b2
12 changed files with 426 additions and 19 deletions
  1. 3
    1
      glfontengine.cpp
  2. 36
    4
      glmenu/menuitem.cpp
  3. 14
    1
      glmenu/menuitem.h
  4. 174
    1
      glmenu/menuitems.cpp
  5. 78
    0
      glmenu/menuitems.h
  6. 17
    0
      glmenu/menumanager.cpp
  7. 5
    0
      glmenu/menumanager.h
  8. 55
    9
      glmenu/menumenu.cpp
  9. 7
    0
      glmenu/menumenu.h
  10. 24
    1
      glsdlscreen.cpp
  11. 4
    0
      glsdlscreen.h
  12. 9
    2
      gltexture.cpp

+ 3
- 1
glfontengine.cpp View File

@@ -95,7 +95,7 @@ bool GLFontEngine::fontSelect(std::string fontstr) {
95 95
 	else {
96 96
 		//fallbackfont - ersten aus der liste
97 97
 		font = (++fontpool.begin())->second;
98
-		std::cout << "font: " << font << std::endl;
98
+// 		std::cout << "font: " << font << std::endl;
99 99
 	}
100 100
 		
101 101
 	return true;
@@ -158,6 +158,8 @@ void GLFontEngine::renderLine(std::string text, SDL_Rect pos) {
158 158
 
159 159
 void GLFontEngine::renderLine(std::string str, int x, int y, bool center, SDL_Rect *rendered_to) {
160 160
 
161
+	glEnable(GL_TEXTURE_2D);
162
+	
161 163
 	SDL_Rect m = { x, y, getTextWidth(str), fsize};
162 164
 
163 165
 	if(center)

+ 36
- 4
glmenu/menuitem.cpp View File

@@ -5,14 +5,31 @@ MenuItem::MenuItem(std::string c) {
5 5
 	fontsizeadd = 0;
6 6
 	fontname = "menufont";
7 7
 	usevalue = false;
8
+	selectable = true;
9
+	grey = false;
10
+	novaluecenter = false;
8 11
 	
9 12
 	fontengine.fontSelect(fontname);
10 13
 }
11 14
 
12
-void MenuItem::render(Punkt2D pos, bool center, int basefontsize, int maxwidth, int valuewidth, bool highlight) {
15
+std::string MenuItem::getValue() {
16
+	return value;
17
+}
18
+
19
+std::string MenuItem::getCaption() {
20
+	return caption;
21
+}
22
+
23
+void MenuItem::setCaption(std::string str) {
24
+	caption = str;
25
+}
26
+
27
+void MenuItem::render(Punkt2D pos, bool center, int basefontsize, int maxwidth, int valuewidth, bool highlight, int caplen, int vallen) {
13 28
 	fontengine.setSize(basefontsize+fontsizeadd);
14 29
 	if(highlight)
15 30
 		fontengine.setColor(1.0f, 0.0f, 0.0f);
31
+	else if(grey)
32
+		fontengine.setColor(0.8f, 0.8f, 0.8f);
16 33
 	else
17 34
 		fontengine.setColor(1.0f, 1.0f, 1.0f);
18 35
 	
@@ -21,18 +38,33 @@ void MenuItem::render(Punkt2D pos, bool center, int basefontsize, int maxwidth,
21 38
 	} else {
22 39
 		// center und position ggf. überarbeiten..
23 40
 		
24
-		Punkt2D tmp;
25
-		tmp = pos - valuewidth/2 - fontengine.getTextWidth(caption)/2;
41
+		Punkt2D tmp = pos;
42
+		
43
+		tmp.x = pos.x - valuewidth/2 - fontengine.getTextWidth(caption)/2;
26 44
 		fontengine.renderLine(caption, tmp.x, tmp.y, center);
27
-		tmp = pos + valuewidth/2;
45
+		
46
+		tmp.x = pos.x + valuewidth/2;
28 47
 		fontengine.renderLine(value, tmp.x, tmp.y, false);
48
+// 		std::cout << "Value: " << value << std::endl;
29 49
 	}
30 50
 }
31 51
 
52
+bool MenuItem::isSelectable() {
53
+	return (!grey)&&selectable;
54
+}
55
+
56
+void MenuItem::setFontSizeAdd(int fsa) {
57
+	fontsizeadd = fsa;
58
+}
59
+
32 60
 int MenuItem::getFontSizeAdd() {
33 61
 	return fontsizeadd;
34 62
 }
35 63
 
64
+void MenuItem::greyItem(bool _grey) {
65
+	grey = _grey;
66
+}
67
+
36 68
 MenuItem::~MenuItem() {
37 69
 	
38 70
 	

+ 14
- 1
glmenu/menuitem.h View File

@@ -13,18 +13,31 @@ class MenuItem {
13 13
 		GLFontEngine fontengine;
14 14
 		std::string fontname;
15 15
 		int fontsizeadd;
16
+		bool grey;
16 17
 		
17 18
 		bool usevalue;
19
+		bool selectable;
20
+		bool novaluecenter;
18 21
 	public:
19 22
 		MenuItem(std::string);
20 23
 		virtual ~MenuItem();
21 24
 		
25
+		std::string getValue();
26
+		std::string getCaption();
27
+		void setCaption(std::string str);
28
+		
22 29
 		virtual void left() { };
23 30
 		virtual void right() { };
24 31
 		virtual void select() { };
32
+		virtual void charInput(char c) { };
33
+		
34
+		void setFontSizeAdd(int fsa);
25 35
 		int getFontSizeAdd();
36
+		bool isSelectable();
37
+		void greyItem(bool _grey);
38
+		void noValueCenter(bool _vc);
26 39
 		
27
-		virtual void render(Punkt2D pos, bool center, int basefontsize, int maxwidth, int valuewidth, bool highlight);
40
+		virtual void render(Punkt2D pos, bool center, int basefontsize, int maxwidth, int valuewidth, bool highlight, int caplen, int vallen);
28 41
 };
29 42
 
30 43
 #endif

+ 174
- 1
glmenu/menuitems.cpp View File

@@ -1,9 +1,182 @@
1 1
 #include "menuitems.h"
2 2
 
3
+// MISendSDLEvent
4
+
3 5
 MISendSDLEvent::MISendSDLEvent(std::string str, SDL_Event event) : MenuItem(str) {
4
-	sendevent = event;
6
+	resetEvent(event);
5 7
 }
6 8
 
7 9
 void MISendSDLEvent::select() {
8 10
 	SDL_PushEvent(&sendevent);
9 11
 }
12
+
13
+void MISendSDLEvent::resetEvent(SDL_Event event) {
14
+	sendevent = event;
15
+}
16
+
17
+// MITextLabel
18
+
19
+MITextLabel::MITextLabel(std::string str) : MenuItem(str) {
20
+	selectable = false;
21
+}
22
+
23
+// MIValueLabel
24
+
25
+MIValueLabel::MIValueLabel(std::string str) : MenuItem(str) {
26
+	selectable = false;
27
+	usevalue = true;
28
+}
29
+
30
+void MIValueLabel::setValue(std::string _val) {
31
+	value = _val;
32
+}
33
+
34
+// MIToggle
35
+
36
+MIToggle::MIToggle(std::string str) : MenuItem(str) {
37
+	usevalue = true;
38
+	togglepos = 0;
39
+}
40
+
41
+void MIToggle::left() {
42
+	togglepos--;
43
+	if(togglepos<0)
44
+		togglepos = toggles.size()-1;
45
+	value = getValueString();
46
+}
47
+
48
+void MIToggle::right() {
49
+	togglepos++;
50
+	if(togglepos>=toggles.size())
51
+		togglepos = 0;
52
+	value = getValueString();
53
+}
54
+
55
+void MIToggle::select() {
56
+	right();
57
+}
58
+
59
+void MIToggle::addToggle(std::string str) {
60
+	toggles.push_back(str);
61
+	if(toggles.size()==1) {
62
+		value = getValueString();
63
+	}
64
+}
65
+
66
+int MIToggle::getValueInt() {
67
+	return togglepos;
68
+}
69
+
70
+void MIToggle::setValueInt(int val) {
71
+	if(val<0||val>=toggles.size())
72
+		return;
73
+	togglepos = val;
74
+	value = getValueString();
75
+}
76
+
77
+void MIToggle::setValueString(std::string str) {
78
+	for(unsigned int t=0; t<toggles.size(); t++) {
79
+		std::cout << str << " == " << toggles[t] << std::endl;
80
+		if(str==toggles[t]) {
81
+			togglepos = t;
82
+			value = getValueString();
83
+			return;
84
+		}
85
+	}
86
+}
87
+
88
+std::string MIToggle::getValueString() {
89
+	if(toggles.size()==0)
90
+		return "";
91
+	return toggles[togglepos];
92
+}
93
+
94
+// MIStringInput
95
+
96
+MIStringInput::MIStringInput(std::string str, int _maxlen) : MenuItem(str) {
97
+	usevalue = true;
98
+	maxlen = _maxlen;
99
+}
100
+
101
+void MIStringInput::charInput(char c) {
102
+// 	std::cout << "INPUT: " << c << ", maxlen" << maxlen << std::endl;
103
+	if(c=='\b') {
104
+		if(value.length()>0) {
105
+			value = value.substr(0, value.length()-1);
106
+		}
107
+	} else if(c>=32) {
108
+		if(!maxlen || value.length()<maxlen)
109
+			value +=c;
110
+// 		std::cout << maxlen << " && " << value.length() << " < " << maxlen << std::endl;
111
+	}
112
+}
113
+
114
+void MIStringInput::setValue(std::string str) {
115
+	value = str;
116
+}
117
+
118
+std::string MIStringInput::getValue() {
119
+	return value;
120
+}
121
+
122
+// MICheckbox
123
+
124
+MICheckBox::MICheckBox(std::string str) : MenuItem(str) {
125
+	usevalue = true;
126
+}
127
+
128
+bool MICheckBox::isChecked() {
129
+	return state;
130
+}
131
+
132
+void MICheckBox::setState(bool _state) {
133
+	state = _state;
134
+	updateValue();
135
+}
136
+
137
+void MICheckBox::select() {
138
+	right();
139
+}
140
+
141
+void MICheckBox::right() {
142
+	state = !state;
143
+	updateValue();
144
+}
145
+
146
+void MICheckBox::left() {
147
+	state = !state;
148
+	updateValue();
149
+}
150
+
151
+void MICheckBox::updateValue() {
152
+	value = state ? "An" : "Aus";
153
+}
154
+
155
+// MIEventOnToggle
156
+
157
+MIEventOnToggle::MIEventOnToggle(std::string str, SDL_Event event) : MIToggle(str) {
158
+	resetEvent(event);
159
+}
160
+		
161
+void MIEventOnToggle::sendEvent() {
162
+	SDL_PushEvent(&sendevent);
163
+}
164
+		
165
+void MIEventOnToggle::select() {
166
+	MIToggle::select();
167
+	sendEvent();
168
+}
169
+
170
+void MIEventOnToggle::left() {
171
+	MIToggle::left();
172
+	sendEvent();
173
+}
174
+
175
+void MIEventOnToggle::right() {
176
+	MIToggle::right();
177
+	sendEvent();
178
+}
179
+		
180
+void MIEventOnToggle::resetEvent(SDL_Event event) {
181
+	sendevent = event;
182
+}

+ 78
- 0
glmenu/menuitems.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef __MENUITEMS_H
2 2
 #define __MENUITEMS_H
3 3
 
4
+#include <string>
5
+#include <vector>
4 6
 #include <SDL.h>
5 7
 #include "menuitem.h"
6 8
 
@@ -11,7 +13,83 @@ class MISendSDLEvent : public MenuItem {
11 13
 		MISendSDLEvent(std::string str, SDL_Event event);
12 14
 		
13 15
 		void select();
16
+		void resetEvent(SDL_Event event);
14 17
 };
15 18
 
19
+class MITextLabel : public MenuItem {
20
+	private:
21
+		
22
+	public:
23
+		MITextLabel(std::string str);
24
+	
25
+};
26
+
27
+class MIValueLabel : public MenuItem {
28
+	private:
29
+		
30
+	public:
31
+		MIValueLabel(std::string str);
32
+		void setValue(std::string);
33
+};
34
+
35
+class MIToggle : public MenuItem {
36
+	private:
37
+		std::vector<std::string> toggles;
38
+		int togglepos;
39
+	public:
40
+		MIToggle(std::string);
41
+		
42
+		void left();
43
+		void right();
44
+		void select();
45
+		
46
+		void addToggle(std::string);
47
+		
48
+		int getValueInt();
49
+		void setValueInt(int val);
50
+		std::string getValueString();
51
+		void setValueString(std::string str);
52
+	
53
+};
54
+
55
+class MIStringInput : public MenuItem {
56
+	private:
57
+		int maxlen;
58
+	public:
59
+		MIStringInput(std::string str, int _maxlen=0);
60
+		void charInput(char c);
61
+		void setValue(std::string str);
62
+		std::string getValue();
63
+	
64
+};
65
+
66
+class MICheckBox : public MenuItem {
67
+	private:
68
+		bool state;
69
+		
70
+		void updateValue();
71
+	public:
72
+		MICheckBox(std::string str);
73
+		
74
+		bool isChecked();
75
+		void setState(bool _state);
76
+		void select();
77
+		void right();
78
+		void left();
79
+};
80
+
81
+class MIEventOnToggle : public MIToggle {
82
+	private:
83
+		SDL_Event sendevent;
84
+		void sendEvent();
85
+	public:
86
+		MIEventOnToggle(std::string str, SDL_Event event);
87
+		
88
+		void select();
89
+		void left();
90
+		void right();
91
+		
92
+		void resetEvent(SDL_Event event);
93
+};
16 94
 
17 95
 #endif

+ 17
- 0
glmenu/menumanager.cpp View File

@@ -14,12 +14,17 @@ bool MenuManager::changeMenu(MenuMenu *mm) {
14 14
 	for(unsigned int i=0; i<menus.size(); i++) {
15 15
 		if(menus[i]==mm) {
16 16
 			aktuell = mm;
17
+			aktuell->resetItemPos();
17 18
 			return true;
18 19
 		}
19 20
 	}
20 21
 	return false;
21 22
 }
22 23
 
24
+const MenuMenu* MenuManager::getMenu() {
25
+	return aktuell;
26
+}
27
+
23 28
 void MenuManager::render() {
24 29
 	glEnable(GL_TEXTURE_2D);
25 30
 	GLFontEngine::prepare2DbyPushingMatrix();
@@ -52,3 +57,15 @@ void MenuManager::select() {
52 57
 	if(aktuell)
53 58
 		aktuell->select();
54 59
 }
60
+
61
+void MenuManager::charInput(char c) {
62
+	if(aktuell)
63
+		aktuell->charInput(c);
64
+}
65
+
66
+void MenuManager::reset() {
67
+	if(aktuell) {
68
+		aktuell->resetItemPos();
69
+	}
70
+	
71
+}

+ 5
- 0
glmenu/menumanager.h View File

@@ -17,6 +17,7 @@ class MenuManager {
17 17
 		
18 18
 		void addMenu(MenuMenu*);
19 19
 		bool changeMenu(MenuMenu*);
20
+		const MenuMenu* getMenu();
20 21
 		void render();
21 22
 		
22 23
 		void up();
@@ -24,6 +25,10 @@ class MenuManager {
24 25
 		void left();
25 26
 		void right();
26 27
 		void select();
28
+		void charInput(char c);
29
+		
30
+		
31
+		void reset();
27 32
 };
28 33
 
29 34
 #endif

+ 55
- 9
glmenu/menumenu.cpp View File

@@ -4,6 +4,8 @@ MenuMenu::MenuMenu() {
4 4
 	itempos = 0;
5 5
 	centermenu = false;
6 6
 	centerScreenX = false;
7
+	dohighlight = true;
8
+	paintbackground = true;
7 9
 	basefontsize = 20;
8 10
 	maxwidth = 0;
9 11
 	valuewidth = 100;
@@ -32,22 +34,30 @@ void MenuMenu::setMaxWidth(int _mw) {
32 34
 		maxwidth = _mw;
33 35
 }
34 36
 
37
+void MenuMenu::setPaintBackground(bool _pbg) {
38
+	paintbackground = _pbg;
39
+}
40
+
35 41
 void MenuMenu::addMenuItem(MenuItem* mi) {
36 42
 	menuitems.push_back(mi);
37 43
 }
38 44
 
39 45
 void MenuMenu::up() {
40
-	if(itempos==0)
41
-		itempos = menuitems.size()-1;
42
-	else
43
-		itempos--;
46
+	do {
47
+		if(itempos==0)
48
+			itempos = menuitems.size()-1;
49
+		else
50
+			itempos--;
51
+	} while(!menuitems[itempos]->isSelectable());
44 52
 }
45 53
 
46 54
 void MenuMenu::down() {
47
-	if(itempos==menuitems.size()-1)
48
-		itempos = 0;
49
-	else
50
-		itempos++;
55
+	do {
56
+		if(itempos==menuitems.size()-1)
57
+			itempos = 0;
58
+		else
59
+			itempos++;
60
+	} while(!menuitems[itempos]->isSelectable());
51 61
 }
52 62
 
53 63
 void MenuMenu::left() {
@@ -62,15 +72,51 @@ void MenuMenu::select() {
62 72
 	menuitems[itempos]->select();
63 73
 }
64 74
 
75
+void MenuMenu::charInput(char c) {
76
+	menuitems[itempos]->charInput(c);
77
+}
78
+
79
+void MenuMenu::resetItemPos() {
80
+	dohighlight = true;
81
+	for(itempos = 0; itempos<menuitems.size()&&!menuitems[itempos]->isSelectable(); itempos++);
82
+	if(itempos==menuitems.size()) {
83
+		itempos = 0;
84
+		dohighlight = false;
85
+	}
86
+}
87
+
65 88
 void MenuMenu::render() {
66 89
 	Punkt2D pos = menupos;
67 90
 	if(centerScreenX) {
68 91
 		SDL_Surface *screen = SDL_GetVideoSurface();
69 92
 		pos.x = screen->w/2;
70 93
 	}
94
+	
95
+	int clen=0, vlen=0, height=0;
96
+	for(unsigned int i=0; i<menuitems.size(); i++) {
97
+		fontengine.setSize(basefontsize+menuitems[i]->getFontSizeAdd());
98
+		
99
+		clen = std::max(clen, fontengine.getTextWidth(menuitems[i]->getCaption()));
100
+		vlen = std::max(vlen, fontengine.getTextWidth(menuitems[i]->getValue()));
101
+		height += basefontsize + menuitems[i]->getFontSizeAdd() + offset;
102
+	}
103
+	
104
+	std::cout << "clen: " << clen << " und " << (int) paintbackground << std::endl;
105
+	
106
+	if(paintbackground&&false) {
107
+		// geht noch nicht ganz
108
+		glDisable(GL_TEXTURE_2D);
109
+		glColor3f(0.4f, 0.4f, 0.4f);
110
+		SDL_Rect bgarea = { pos.x-(clen/2)-((vlen>0)?(valuewidth/2+vlen/2):0),
111
+							pos.y,
112
+	    					clen+((vlen>0)?vlen/2+valuewidth/2:0),
113
+							height };
114
+		std::cout << bgarea.x << " " << bgarea.y << " " << bgarea.w << " " << bgarea.h << std::endl;
115
+		GLFontEngine::paintSDLRect(bgarea);
116
+	}
71 117
 
72 118
 	for(unsigned int i=0; i<menuitems.size(); i++) {
73
-		menuitems[i]->render(pos, centermenu, basefontsize, maxwidth, valuewidth, itempos==i);
119
+		menuitems[i]->render(pos, centermenu, basefontsize, maxwidth, valuewidth, (itempos==i)&&dohighlight, clen, vlen);
74 120
 		pos.y += basefontsize + menuitems[i]->getFontSizeAdd() + offset;
75 121
 	}
76 122
 }

+ 7
- 0
glmenu/menumenu.h View File

@@ -14,10 +14,13 @@ class MenuMenu {
14 14
 		Punkt2D menupos;
15 15
 		bool centermenu;
16 16
 		bool centerScreenX;
17
+		bool dohighlight;
18
+		bool paintbackground;
17 19
 		int basefontsize;
18 20
 		int offset;
19 21
 		int maxwidth;
20 22
 		int valuewidth;
23
+		GLFontEngine fontengine;
21 24
 	public:
22 25
 		MenuMenu();
23 26
 		
@@ -26,12 +29,16 @@ class MenuMenu {
26 29
 		void setCenterScreenX(bool);
27 30
 		void setBaseFontSize(int);
28 31
 		void setMaxWidth(int);
32
+		void setPaintBackground(bool);
29 33
 		
30 34
 		void up();
31 35
 		void down();
32 36
 		void left();
33 37
 		void right();
34 38
 		void select();
39
+		void charInput(char c);
40
+		
41
+		void resetItemPos();
35 42
 		
36 43
 		
37 44
 		void addMenuItem(MenuItem*);

+ 24
- 1
glsdlscreen.cpp View File

@@ -32,6 +32,9 @@ int GLSDLScreen::getFlags() {
32 32
 		videoflags |= SDL_HWPALETTE;
33 33
 	}
34 34
 	
35
+	if(fullscreen)
36
+		videoflags |= SDL_FULLSCREEN;
37
+	
35 38
 	return videoflags;
36 39
 }
37 40
 void GLSDLScreen::enableOpenGL(bool w) {
@@ -68,6 +71,13 @@ void GLSDLScreen::setVideoMode(int _width, int _height, int _bpp) {
68 71
 		height = 1;
69 72
 }
70 73
 
74
+void GLSDLScreen::getVideoRes(std::string vidstr, int *_w, int *_h) {
75
+	if(_w)
76
+		*_w = atoi(vidstr.substr(0, vidstr.find("x")).c_str());
77
+	if(_h)
78
+		*_h = atoi(vidstr.substr(vidstr.find("x")+1, (vidstr.length()-vidstr.find("x")-1)).c_str());
79
+}
80
+
71 81
 bool GLSDLScreen::isOK() {
72 82
 	return SDL_VideoModeOK(width, height, bpp, getFlags());
73 83
 }
@@ -111,10 +121,14 @@ bool GLSDLScreen::apply() {
111 121
 			extraglparam();
112 122
 		}
113 123
 		
114
-		glMatrixMode(GL_MODELVIEW);
124
+		
115 125
 
116 126
 		// Texturen neuladen, eigentlich nur für Windows. Aber egal.
117 127
 		GLTexture::reloadAll();
128
+		glMatrixMode(GL_TEXTURE);
129
+		glLoadIdentity();
130
+				
131
+		glMatrixMode(GL_MODELVIEW);
118 132
 	}
119 133
 	
120 134
 	return true;
@@ -127,3 +141,12 @@ int GLSDLScreen::getWidth() {
127 141
 int GLSDLScreen::getHeight() {
128 142
 	return height;
129 143
 }
144
+
145
+void GLSDLScreen::clearScreen() {
146
+	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
147
+	glLoadIdentity();
148
+}
149
+
150
+void GLSDLScreen::renderScreen() {
151
+	SDL_GL_SwapBuffers();
152
+}

+ 4
- 0
glsdlscreen.h View File

@@ -27,6 +27,7 @@ class GLSDLScreen {
27 27
 		void enableResizable(bool);
28 28
 		void enableFullscreen(bool);
29 29
 		void setVideoMode(int _width, int _height, int _bpp);
30
+		static void getVideoRes(std::string vidstr, int *w, int *h);
30 31
 		
31 32
 		void setGLNearFar(float _znear, float _zfar);
32 33
 		void enableGLSetup(bool);
@@ -37,6 +38,9 @@ class GLSDLScreen {
37 38
 		
38 39
 		int getWidth();
39 40
 		int getHeight();
41
+		
42
+		void clearScreen();
43
+		void renderScreen();
40 44
 };
41 45
 
42 46
 #endif

+ 9
- 2
gltexture.cpp View File

@@ -9,6 +9,7 @@ GLTexture::GLTexture(std::string fname, GLint _minfilter, GLint _magfilter, GLin
9 9
 	init();
10 10
 	setParameter(_minfilter, _magfilter, _wraps, _wrapt);
11 11
 	loadImage(fname);
12
+	filename = fname;
12 13
 	
13 14
 	alltextures.push_back(this);
14 15
 }
@@ -128,17 +129,22 @@ bool GLTexture::setParameter(GLint _minfilter, GLint _magfilter, GLint _wraps, G
128 129
 	if(!loaded)
129 130
 		return true;
130 131
 	
132
+	loaded = false;
133
+	texconverted = false;
134
+	
131 135
 	if(keepsurface&&tex!=0) {
132 136
 		unloadTexture();
133 137
 		return loadLocalSurface();
134 138
 	} else if(filename!="") {
135
-		return loadImage("filename");
139
+		std::cout << "Filename: " << filename << std::endl;
140
+		return loadImage(filename);
136 141
 	} else {
137 142
 		// keine datei, kein surface
138 143
 		unloadTexture();
139 144
 		std::cerr << "Couldn't reload GLTexture " << this << "- No surface, no file!" << std::endl;
140 145
 		return false;
141 146
 	}
147
+	std::cout << "Texture reloaded" << std::endl;
142 148
 }
143 149
 
144 150
 int GLTexture::getW() {
@@ -154,8 +160,9 @@ bool GLTexture::isLoaded() {
154 160
 }
155 161
 
156 162
 void GLTexture::reloadAll() {
157
-	for(unsigned int i=0; i<alltextures.size(); i++)
163
+	for(unsigned int i=0; i<alltextures.size(); i++) {
158 164
 		alltextures[i]->setParameter();
165
+	}
159 166
 }
160 167
 
161 168
 GLTexture::~GLTexture() {

Loading…
Cancel
Save