diff options
| author | Japa Illo | 2012-02-13 22:59:56 +0530 |
|---|---|---|
| committer | Japa Illo | 2012-02-13 22:59:56 +0530 |
| commit | aa921e71bd1a551ced19d29051439e88d2330975 (patch) | |
| tree | 4cf6797ead59fef54b004d2ef0aab1bcb198720c /UserInput.cpp | |
| parent | 78f13e7490e78098152af2c6771dc63b09808f46 (diff) | |
| download | stonesense-aa921e71bd1a551ced19d29051439e88d2330975.tar.gz stonesense-aa921e71bd1a551ced19d29051439e88d2330975.tar.bz2 stonesense-aa921e71bd1a551ced19d29051439e88d2330975.tar.xz | |
Zoom and enhance!
Signed-off-by: Japa Illo <japa.mala.illo@gmail.com>
Diffstat (limited to 'UserInput.cpp')
| -rw-r--r-- | UserInput.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/UserInput.cpp b/UserInput.cpp index 456ec81..45a83c6 100644 --- a/UserInput.cpp +++ b/UserInput.cpp @@ -4,6 +4,7 @@ #include "ContentLoader.h"
#include "GameBuildings.h"
#include "Creatures.h"
+#include <math.h>
extern int mouse_x, mouse_y, mouse_z;
extern unsigned int mouse_b;
ALLEGRO_MOUSE_STATE mouse;
@@ -275,29 +276,11 @@ void doKeys(int Key) }
if(Key == ALLEGRO_KEY_FULLSTOP){
config.zoom++;
- if (config.zoom == -1)
- config.zoom = 1;
- if(config.zoom > 0)
- {
- config.scale = 1.0f * config.zoom;
- }
- if(config.zoom < 0)
- {
- config.scale = 1.0f / abs((float)config.zoom);
- }
+ config.scale = pow(2.0f, config.zoom);
}
if(Key == ALLEGRO_KEY_COMMA){
config.zoom--;
- if (config.zoom == 0)
- config.zoom = -2;
- if(config.zoom > 0)
- {
- config.scale = 1.0f * config.zoom;
- }
- if(config.zoom < 0)
- {
- config.scale = 1.0f / abs((float)config.zoom);
- }
+ config.scale = pow(2.0f, config.zoom);
}
if(Key == ALLEGRO_KEY_F5){
if (al_key_down(&keyboard,ALLEGRO_KEY_LCTRL) || al_key_down(&keyboard,ALLEGRO_KEY_RCTRL))
|
