mirror of https://github.com/kurisufriend/threedee
parent
a8d8616b77
commit
c84dedd768
@ -0,0 +1,19 @@ |
|||||||
|
#include "demo.h" |
||||||
|
|
||||||
|
void game::run(SDL_Renderer* renderer) |
||||||
|
{ |
||||||
|
ray2D ray = ray2D::trace(vector2(0, 201), vector2(1, 0)); |
||||||
|
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, 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
|
||||||
|
global::entList.at(0)->x = global::mousePos.x; |
||||||
|
global::entList.at(0)->y = global::mousePos.y; |
||||||
|
|
||||||
|
global::entList.run(renderer); |
||||||
|
global::entList3D.run(renderer); |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
#pragma once |
||||||
|
#include <Windows.h> |
||||||
|
#include <stdio.h> |
||||||
|
#include <iostream> |
||||||
|
#include "SDL.h" |
||||||
|
|
||||||
|
#include "../stuff/objects/vector2.h" |
||||||
|
#include "../stuff/objects/vector3.h" |
||||||
|
#include "../stuff/objects/ray2D.h" |
||||||
|
|
||||||
|
#include "../stuff/globals/globals.h" |
||||||
|
#include "../stuff/callbacks/callbacks.h" |
||||||
|
#include "../stuff/objects/square.h" |
||||||
|
#include "../stuff/objects/argb.h" |
||||||
|
|
||||||
|
namespace game |
||||||
|
{ |
||||||
|
void run(SDL_Renderer* renderer); |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
#pragma once |
||||||
|
#include <Windows.h> |
||||||
|
#include "SDL.h" |
||||||
|
struct argb |
||||||
|
{ |
||||||
|
BYTE a, r, g, b; |
||||||
|
argb(BYTE a_, BYTE r_, BYTE g_, BYTE b_) |
||||||
|
{ |
||||||
|
a = a_; |
||||||
|
r = r_; |
||||||
|
g = g_; |
||||||
|
b = b_; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
#define WHITE argb(255, 255, 255, 255) |
||||||
|
#define RED argb(255, 255, 0, 0) |
||||||
|
#define BLUE argb(255, 0, 0, 255) |
||||||
|
#define GREEN argb(255, 0, 255, 0) |
||||||
|
|
||||||
|
#define SETRENDER_WHITE SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255) |
||||||
|
#define SETRENDER_BLACK SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0) |
Loading…
Reference in new issue