|
|
@ -2,28 +2,16 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include "SDL.h" |
|
|
|
#include "SDL.h" |
|
|
|
|
|
|
|
|
|
|
|
struct Vector2 |
|
|
|
#include "stuff/objects/vector2.h" |
|
|
|
{
|
|
|
|
#include "stuff/objects/vector.h" |
|
|
|
float x, y; |
|
|
|
|
|
|
|
Vector2() |
|
|
|
#include "stuff/globals/globals.h" |
|
|
|
{ |
|
|
|
#include "stuff/callbacks/callbacks.h" |
|
|
|
this->x = 0.f; |
|
|
|
|
|
|
|
this->y = 0.f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Vector2(float x_, float y_) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this->x = x_; |
|
|
|
|
|
|
|
this->y = y_; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) |
|
|
|
int main(int argc, char** argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool running = true; |
|
|
|
SDL_Window* window = nullptr; |
|
|
|
Vector2 mousePos; |
|
|
|
SDL_Surface* surface = nullptr; |
|
|
|
|
|
|
|
|
|
|
|
SDL_Window* window = nullptr;; |
|
|
|
|
|
|
|
SDL_Surface* surface = nullptr;; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SDL_Init(SDL_INIT_VIDEO); |
|
|
|
SDL_Init(SDL_INIT_VIDEO); |
|
|
|
window = SDL_CreateWindow("threedee", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 720, SDL_WINDOW_SHOWN); |
|
|
|
window = SDL_CreateWindow("threedee", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1280, 720, SDL_WINDOW_SHOWN); |
|
|
@ -31,25 +19,10 @@ int main(int argc, char** argv) |
|
|
|
|
|
|
|
|
|
|
|
SDL_Event eventHandler; |
|
|
|
SDL_Event eventHandler; |
|
|
|
|
|
|
|
|
|
|
|
while (running) |
|
|
|
while (global::running) |
|
|
|
{ |
|
|
|
|
|
|
|
while (SDL_PollEvent(&eventHandler)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (eventHandler.type) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
case SDL_QUIT: |
|
|
|
callbacks::handleCallbacks(&eventHandler); |
|
|
|
running = false; |
|
|
|
SDL_Rect cursor{ global::mousePos.x, global::mousePos.y, 5, 5 }; |
|
|
|
break; |
|
|
|
|
|
|
|
case SDL_MOUSEMOTION: |
|
|
|
|
|
|
|
mousePos = Vector2(eventHandler.motion.x, eventHandler.motion.y); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SDL_Rect cursor; |
|
|
|
|
|
|
|
cursor.x = mousePos.x; |
|
|
|
|
|
|
|
cursor.y = mousePos.y; |
|
|
|
|
|
|
|
cursor.w = 5; |
|
|
|
|
|
|
|
cursor.h = 5; |
|
|
|
|
|
|
|
SDL_FillRect(surface, &cursor, SDL_MapRGB(surface->format, 0xFF, 0xFF, 0xFF)); |
|
|
|
SDL_FillRect(surface, &cursor, SDL_MapRGB(surface->format, 0xFF, 0xFF, 0xFF)); |
|
|
|
|
|
|
|
|
|
|
|
SDL_UpdateWindowSurface(window); |
|
|
|
SDL_UpdateWindowSurface(window); |
|
|
|