|
|
@ -24,7 +24,7 @@ int main(int argc, char** argv) |
|
|
|
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); |
|
|
|
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); |
|
|
|
SDL_Event eventHandler; |
|
|
|
SDL_Event eventHandler; |
|
|
|
|
|
|
|
|
|
|
|
global::entList.push_back(square(200, 200, 50)); |
|
|
|
global::entList.push_back(&square(200, 200, 50)); |
|
|
|
|
|
|
|
|
|
|
|
//global::entList3D.push_back(cube(200, 200, 100, 50));
|
|
|
|
//global::entList3D.push_back(cube(200, 200, 100, 50));
|
|
|
|
|
|
|
|
|
|
|
@ -40,10 +40,12 @@ int main(int argc, char** argv) |
|
|
|
ray2D ray2 = ray2D::trace(vector2(201, 0), vector2(0, 1)); |
|
|
|
ray2D ray2 = ray2D::trace(vector2(201, 0), vector2(0, 1)); |
|
|
|
SDL_RenderDrawLine(renderer, ray.start.x, ray.start.y, ray.end.x, ray.end.y); |
|
|
|
SDL_RenderDrawLine(renderer, ray.start.x, ray.start.y, ray.end.x, ray.end.y); |
|
|
|
SDL_RenderDrawLine(renderer, ray2.start.x, ray2.start.y, ray2.end.x, ray2.end.y); |
|
|
|
SDL_RenderDrawLine(renderer, ray2.start.x, ray2.start.y, ray2.end.x, ray2.end.y); |
|
|
|
|
|
|
|
std::cout << global::entList.at(0) << std::endl; |
|
|
|
|
|
|
|
if (ray.hitEnt) |
|
|
|
|
|
|
|
std::cout << std::hex << ray.hitEnt << std::endl; |
|
|
|
//demo rays with moving object
|
|
|
|
//demo rays with moving object
|
|
|
|
global::entList.at(0).x = global::mousePos.x; |
|
|
|
global::entList.at(0)->x = global::mousePos.x; |
|
|
|
global::entList.at(0).y = global::mousePos.y; |
|
|
|
global::entList.at(0)->y = global::mousePos.y; |
|
|
|
|
|
|
|
|
|
|
|
global::entList.run(renderer); |
|
|
|
global::entList.run(renderer); |
|
|
|
global::entList3D.run(renderer); |
|
|
|
global::entList3D.run(renderer); |
|
|
|