#include <chrono>
#define TICKS_PER_SEC 20
-#define MSEC_PER_TICK 500//(1000/TICKS_PER_SEC)
+#define MSEC_PER_TICK (1000/TICKS_PER_SEC)
SDL_Window *window = NULL;
SDL_Surface *renderSurface = NULL;
unsigned int millis(void){
std::chrono::system_clock::time_point now=std::chrono::system_clock::now();
- return std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count();
+ return std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
}
int main(int argc,char **argv){
atexit(IMG_Quit);
//Turn on double Buffering
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ //ANTIALIASING!!!
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16);
//create the window
window = SDL_CreateWindow("Independent Study v.0.2 alpha", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL
#ifdef FULLSCREEN
glViewport(0,0,SCREEN_WIDTH, SCREEN_HEIGHT);
glClearColor(.3,.5,.8,0);
glEnable(GL_BLEND);
+ glEnable(GL_MULTISAMPLE);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
SDL_ShowCursor(SDL_DISABLE);
**************************/
//DRAW MOUSE HERE!!!!!W
- glColor3ub(255,0,0);
mx=(ui.mousex/(float)SCREEN_WIDTH)*2.0f-1.0f;
my=((SCREEN_HEIGHT-ui.mousey)/(float)SCREEN_HEIGHT)*2.0f-1.0f;
if(player.loc.x-1>-1)mx+=player.loc.x;
- glRectf(mx,my,mx+HLINE*4,my+HLINE*4);
+
+ glBegin(GL_TRIANGLES);
+
+ glColor3ub(255,255,255);
+ glVertex2f(mx,my);
+ glVertex2f(mx + (HLINE*3.5),my - (HLINE*1));
+ glVertex2f(mx + (HLINE*1),my - (HLINE*6));
+
+ glEnd();
glPopMatrix(); //take the matrix(s) off the stack to pass them to the renderer
SDL_GL_SwapWindow(window); //give the stack to SDL to render it