Add mouse support
This commit is contained in:
parent
a0b460a5cc
commit
b7b1780f9e
7
main.cpp
7
main.cpp
|
@ -1,5 +1,4 @@
|
|||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include "SDL2/SDL.h"
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
|
@ -73,6 +72,10 @@ int main(int argc, char const *argv[]) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (e.type == SDL_MOUSEMOTION) {
|
||||
platform.x = e.motion.x - 100;
|
||||
}
|
||||
}
|
||||
|
||||
// Re-rendering
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
|
@ -80,7 +83,7 @@ int main(int argc, char const *argv[]) {
|
|||
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
|
||||
SDL_RenderFillRect(renderer, &platform);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
SDL_Delay(1);
|
||||
}
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
|
|
Loading…
Reference in New Issue