diff --git a/src/a.out b/src/a.out new file mode 100755 index 0000000..060e254 Binary files /dev/null and b/src/a.out differ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..fa1fb48 --- /dev/null +++ b/src/main.c @@ -0,0 +1,81 @@ +#include //printf and shit + +#include + +const int width = 800; +const int height = 600; + + +int main(){ + //legally required print (it broke without it) + printf("asd"); + + //general setup + SDL_Init(SDL_INIT_EVERYTHING); + SDL_Window *window = SDL_CreateWindow("amogus", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL); + SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0); + + //clear + //this kinda doesnt work + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + + int mousex; + int mousey; + SDL_Rect rect; + rect.x = 250; + rect.y = 150; + rect.w = 10; + rect.h = 10; + + while (1) { + //update mouse + SDL_PumpEvents(); + const Uint8 *state = SDL_GetKeyboardState(NULL); + SDL_GetMouseState(&mousex, &mousey); + + if (state[SDL_SCANCODE_Q]) { + goto cleanup; + } + if (state[SDL_SCANCODE_W]) { + rect.y -= 1; + } + + if (state[SDL_SCANCODE_A]) { + rect.x -= 1; + } + + if (state[SDL_SCANCODE_S]) { + rect.y += 1; + } + + if (state[SDL_SCANCODE_D]) { + rect.x += 1; + } + + if (state[SDL_SCANCODE_T]) { + rect.x = 10; + rect.y = 10; + } + SDL_Delay(1); + + //render loop + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDL_RenderDrawPoint(renderer, mousex, mousey); + + SDL_RenderFillRect(renderer, &rect); + + SDL_RenderPresent(renderer); + } + SDL_RenderPresent(renderer); + +cleanup: + + //CLEANUP + SDL_DestroyWindow(window); + SDL_Quit; + return 0; +}