Skip to content

Commit

Permalink
further fixes in core, added clicked state for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
WonderCsabo committed Jun 17, 2011
1 parent fb95214 commit 9827806
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 67 deletions.
6 changes: 5 additions & 1 deletion application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ Application::Application(int x, int y): sizeX(x), sizeY(y)
v.push_back("fbutton_m.kep");
v.push_back("0button_m.kep");
v.push_back("hbutton_m.kep");
v.push_back("nbutton_m.kep");
v.push_back("fbutton_m.kep");
v.push_back("fbutton_c.kep");
v.push_back("0button_c.kep");
v.push_back("hbutton_c.kep");
v.push_back("fbutton_c.kep");

img = new Image(v); // image loader/drawer object
}
Expand Down
6 changes: 4 additions & 2 deletions button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ int Button::Type()
t=5;
break;
}
if(Mouse)
if(isClicked)
return t+8;
else if(Mouse)
return t+4;
else
return t;
Expand All @@ -47,7 +49,7 @@ void Button::Show(std::vector<std::vector<std::vector<Color> > > &images)
{
Image::DrawImage(posX,posY,Button::Type(),images); //draw the button

if(isFocused || isClicked) // draw the nice dotted frame
if(isFocused) // draw the nice dotted frame
{
for(int i=0;i<sizeX-8;i+=2)
{
Expand Down
10 changes: 5 additions & 5 deletions core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <cmath>
#include "core.hpp"
#include <iostream>
using namespace std;

bool Core::isOperator(char c)
Expand Down Expand Up @@ -67,14 +66,16 @@ void Core::Tokenize(string input)
if(!isdigit(input[j]) && input[j] != '.')
break;
}
if(t<input.length()-1)
if(t<input.length()-1 || (t == input.length()-1 && input[t]==')'))
input = input.substr(0,i)+"(0-"+input.substr(i+1,t-i-1)+")"+input.substr(t,input.length()-t);
else
input="0"+input;

}
}

if(!isdigit(input[i-1]) && input[i] == ')') //somehow the algorith cant handle this error, fix it here for now
for(unsigned int i=0; i<input.size(); i++)
{
if((!isdigit(input[i-1]) && input[i-1]!=')') && input[i] == ')') //somehow the algorith cant handle this error, fix it here for now
{
bad = true;
break;
Expand Down Expand Up @@ -105,7 +106,6 @@ void Core::Tokenize(string input)
bad = true;
break;
}

}

if(!temp.empty() && isdigit(input[input.size()-1]) && !bad) //adding the last char
Expand Down
1 change: 0 additions & 1 deletion enterbutton.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**Object for the button which fires calc. Inherits everything expect the calc firing.**/

#include "enterbutton.hpp"
#include <iostream>
#include "core.hpp"

void EnterButton::Action(std::string &s)
Expand Down
29 changes: 29 additions & 0 deletions include/0button_c.kep

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions include/fbutton_c.kep
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
34
27
220 224 226 203 171 83 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 203 171 83 220 224 226
203 171 83 215 179 95 226 192 132 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 227 193 133 226 192 132 215 179 95 203 171 83
194 155 41 237 202 141 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 238 203 142 237 202 141 194 155 41
194 155 41 240 204 141 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 241 205 142 240 204 141 194 155 41
194 155 41 242 205 140 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 243 206 141 242 205 140 194 155 41
194 155 41 243 205 139 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 244 206 140 243 205 139 194 155 41
194 155 41 243 204 136 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 244 205 137 243 204 136 194 155 41
194 155 41 243 203 134 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 244 204 135 243 203 134 194 155 41
194 155 41 243 202 130 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 244 203 131 243 202 130 194 155 41
194 155 41 244 201 129 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 245 202 130 244 201 129 194 155 41
194 155 41 244 201 126 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 245 202 127 244 201 126 194 155 41
194 155 41 244 200 123 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 245 201 124 244 200 123 194 155 41
194 155 41 244 198 120 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 245 199 121 244 198 120 194 155 41
194 155 41 244 186 86 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 245 187 87 244 186 86 194 155 41
194 155 41 244 187 88 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 245 188 89 244 187 88 194 155 41
194 155 41 244 189 90 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 191 91 245 191 91 245 191 90 245 191 90 245 191 90 245 191 90 245 191 90 245 191 90 245 191 90 245 191 90 245 191 90 245 191 91 245 191 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 245 190 91 244 189 90 194 155 41
194 155 41 244 190 94 245 191 95 245 191 95 245 191 95 245 192 95 245 192 94 245 192 94 245 192 94 245 193 94 245 193 94 245 193 92 245 193 94 245 193 92 245 193 92 245 193 92 245 193 92 245 193 92 245 193 92 245 193 92 245 193 92 245 193 92 245 193 94 245 193 92 245 193 94 245 193 94 245 192 94 245 192 94 245 192 94 245 192 95 245 191 95 245 191 95 244 190 94 194 155 41
194 155 41 244 192 97 245 193 98 245 193 97 245 193 97 245 193 97 245 194 96 245 194 96 245 194 96 244 195 96 244 195 95 244 195 95 244 195 95 244 195 95 244 196 95 244 196 95 244 196 95 244 196 95 244 196 95 244 196 95 244 196 95 244 195 95 244 195 95 244 195 95 244 195 95 244 195 95 245 194 96 245 194 96 245 194 96 245 193 97 245 193 97 245 193 97 244 192 97 194 155 41
194 155 41 244 194 99 245 195 100 244 196 99 244 196 99 244 196 98 244 197 98 244 198 97 244 198 97 244 198 97 244 198 97 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 199 96 244 198 97 244 198 97 244 198 97 244 198 97 244 197 98 244 196 98 244 196 98 244 196 99 244 194 99 194 155 41
194 155 41 243 197 101 244 199 101 244 199 101 244 200 100 244 201 99 244 201 99 244 202 98 244 202 98 244 202 98 244 203 98 244 204 97 244 204 97 244 204 97 244 205 97 244 205 97 244 205 97 244 205 97 244 205 97 244 205 97 244 205 97 244 204 97 244 204 97 244 204 97 244 203 98 244 202 98 244 202 98 244 202 98 244 201 99 244 201 99 244 200 100 244 199 101 243 198 100 194 155 41
194 155 41 243 200 102 244 202 102 244 202 102 244 204 101 244 204 100 244 205 100 244 206 99 244 207 99 244 208 99 244 208 99 244 209 98 244 209 98 244 209 98 244 210 99 244 210 99 244 210 99 244 210 99 244 210 99 244 210 99 244 210 99 244 209 98 244 209 98 244 209 98 244 208 99 244 208 99 244 207 99 244 206 99 244 205 100 244 204 100 244 204 101 244 202 102 243 201 101 194 155 41
194 155 41 243 204 104 244 206 104 244 207 103 244 208 102 244 209 102 244 210 102 244 212 102 244 213 102 244 214 102 244 215 103 243 216 103 243 217 104 243 218 105 243 218 105 243 218 105 243 219 106 243 219 106 243 219 106 243 218 105 243 218 106 243 218 105 243 217 104 243 216 103 244 215 103 244 214 102 244 213 102 244 212 101 244 210 102 244 209 102 244 208 102 244 207 103 243 205 103 194 155 41
194 155 41 243 206 106 244 209 106 244 211 105 244 213 105 244 215 105 243 217 106 243 219 107 243 221 110 243 222 113 243 224 114 243 224 116 243 224 118 243 225 121 243 226 122 243 226 123 243 227 124 243 227 124 243 227 124 243 226 123 243 226 122 243 225 121 243 224 118 243 224 116 243 224 114 243 222 113 243 221 110 243 219 107 243 217 106 244 215 105 244 213 105 244 211 105 243 208 105 194 155 41
194 155 41 243 210 109 244 213 109 244 216 107 243 219 110 243 222 112 243 224 115 243 226 121 243 227 125 243 229 130 243 231 136 243 232 140 243 233 144 243 234 148 243 235 151 243 235 153 243 235 154 243 235 154 243 235 154 243 235 153 243 235 151 243 234 148 243 233 144 243 232 140 243 231 136 243 229 130 243 227 125 243 226 121 243 224 115 243 222 112 243 219 110 244 216 107 243 212 108 194 155 41
194 155 41 243 215 112 243 219 112 243 222 113 243 224 116 243 227 123 243 230 130 243 232 138 243 234 147 243 236 155 243 238 161 242 237 165 242 238 170 242 239 172 242 240 174 242 240 175 242 240 175 242 240 176 242 240 175 242 240 175 242 240 174 242 239 172 242 238 170 242 238 165 243 238 161 243 236 155 243 234 147 243 232 138 243 230 130 243 227 123 243 224 116 243 222 113 242 218 111 194 155 41
202 169 73 227 200 85 243 225 119 243 227 123 243 230 127 243 233 136 243 236 146 243 238 157 242 238 164 242 239 171 242 240 175 242 241 178 242 241 181 242 242 184 242 242 186 242 242 187 242 242 187 242 242 187 242 242 187 242 242 187 242 242 186 242 242 184 242 241 181 242 241 178 242 240 175 242 239 171 242 238 164 243 238 157 243 236 146 243 233 136 243 230 127 243 227 123 227 203 86 202 172 76
220 226 224 203 173 80 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 194 155 41 203 173 80 221 227 221
Loading

0 comments on commit 9827806

Please sign in to comment.