diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-14 15:39:12 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-14 15:39:12 -0400 |
commit | 329c8cb80d29aff078284db227af6c2cb114fc2f (patch) | |
tree | d4c117609995a1cd670f8ba94a11001e2961096d /src | |
parent | dac8bb25d3b5a77136edb3eb227a4c1a5b1af9cf (diff) |
FIXED TIMINGgit statusgit status oh yeah and jumping
Diffstat (limited to 'src')
-rw-r--r-- | src/World.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp index 0e8d8fc..45df63c 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -116,7 +116,7 @@ void World::detect(vec2 *v,vec2 *vel,const float width){ // return; // ;)
}
}else if(v->y>line[i].start+HLINE){ // Trashy gravity handling
- vel->y-=.0000001;
+ vel->y-=.0000002;
}
}
}
diff --git a/src/main.cpp b/src/main.cpp index 9f87c2b..a92ff16 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,9 +1,10 @@ #include <common.h> #include <cstdio> #include <ctime> +#include <chrono> #define TICKS_PER_SEC 20 -#define MSEC_PER_TICK (1000/TICKS_PER_SEC) +#define MSEC_PER_TICK 500//(1000/TICKS_PER_SEC) SDL_Window *window = NULL; SDL_Surface *renderSurface = NULL; @@ -30,7 +31,10 @@ void render(); static unsigned int initTime; unsigned int millis(void){ - return ((float)(clock()-initTime)/(float)CLOCKS_PER_SEC)*2000; + //return (float)(clock()-initTime)/(CLOCKS_PER_SEC/1000.0f); + std::chrono::system_clock::time_point now=std::chrono::system_clock::now(); + std::chrono::nanoseconds m=now.time_since_epoch(); + return std::chrono::duration_cast<std::chrono::milliseconds>(m).count(); } int main(int argc,char **argv){ |