Compare commits

..

No commits in common. "f78e71f96b103bafeb3c1201c43bee2e13b70bea" and "22cd090f92f6b1d75637778871cb227ead6666b7" have entirely different histories.

5 changed files with 3 additions and 19 deletions

View File

@ -10,8 +10,6 @@ static bool init = false;
static unsigned int width;
static unsigned int height;
static sf::Image image;
int firstperson_init(unsigned int _width, unsigned int _height)
{
printf("firstperson_init()\n");
@ -19,9 +17,6 @@ int firstperson_init(unsigned int _width, unsigned int _height)
width = _width;
height = _height;
init = true;
if (!image.loadFromFile("xd.bmp")) return 0;
return 1;
}
@ -75,17 +70,11 @@ void firstperson_update(sf::RenderTarget* renderTarget, Camera* camera)
renderTexture.draw(rectangle);
}
sf::Texture imageTexture;
sf::Sprite imageSprite;
imageTexture.loadFromImage(image);
imageSprite.setTexture(imageTexture);
renderTexture.draw(imageSprite);
renderTexture.display();
sf::Sprite sprite(renderTexture.getTexture());
sprite.setPosition(renderTexturePosition);
renderTarget->draw(sprite);
}
void firstperson_setTexturePosition(float x, float y)

View File

@ -130,7 +130,6 @@ static float castRay(sf::Vector2f point, float direction, TileData* tileData)
if (gridValue) {
tileData->value = gridValue;
tileData->side = goingDown? NORTH : SOUTH;
tileData->horizontalUV = 0.f;
return horizontalRayDist;
}
@ -144,7 +143,6 @@ static float castRay(sf::Vector2f point, float direction, TileData* tileData)
if (gridValue) {
tileData->value = gridValue;
tileData->side = goingRight? WEST : EAST;
tileData->horizontalUV = 0.f;
return verticalRayDist;
}

View File

@ -15,7 +15,6 @@ typedef struct
{
unsigned int value;
level_tileSide side;
float horizontalUV;
} TileData;
int level_init();

View File

@ -7,7 +7,7 @@
#include "minimap.h"
#include "firstperson.h"
#define MINIMAP_SIZE 512
#define MINIMAP_SIZE 480
#define VIEW_SIZE MINIMAP_SIZE*2
static int handleKeyCode(sf::Keyboard::Key key);
@ -21,13 +21,12 @@ static sf::Clock timer;
int view_init()
{
printf("view_init()\n");
if (!camera_init(&camera, sf::Vector2f(10.f/2.f, 10.f/2.f), 0.f, VIEW_SIZE, 0.5f*PI)) return 0;
if (!camera_init(&camera, sf::Vector2f(10.f/2.f, 10.f/2.f), 0.f, 2<<7, 0.5f*PI)) return 0;
if (!minimap_init(MINIMAP_SIZE)) return 0;
if (!firstperson_init(VIEW_SIZE, MINIMAP_SIZE)) return 0;
minimap_setTexturePosition(0.f, 0.f);
firstperson_setTexturePosition(MINIMAP_SIZE, 0.f);
return 1;
}
@ -55,7 +54,6 @@ int view_update()
window.clear();
minimap_update(&window, &camera);
firstperson_update(&window, &camera);
window.display();
return 1;

BIN
xd.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB