Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Bigfatmeany

Member Since 17 Apr 2013
Offline Last Active Nov 20 2014 09:50 PM

Topics I've Started

Fez like 3D engine.

06 May 2014 - 10:12 PM

I was playing minecraft with a friend earlier because I was bored and wanted a break from the programming I was doing. she was complaining about lag, and proposed the question "Why does minecraft lag on my computer". Well, shes pretty tech savey, so I gave my explanation (which I'm not going to state as to avoid de-railing the thread) and then I thought about FEZ. It was stated in "Indie Game: The Movie" (Im not sure of the company who created it or I would post it here) that the graphics in FEZ were created by taking 6 images from photoshop, putting them into a 32x32 square on a tile sheet, then wraping them around to make them form a block. 

 

Phil Fish, the creator of FEZ, made it sound simple, but it doesn't seem that simple to me. While Phil used Microsofts XDA, Mojang seems to have managed to do the same thing with java(I believe, the language could have changed, as I stopped keeping up to date with minecraft long ago).

 

I have theorized many ways to do this, but im unsure how to go about executing a test. I have never worked in a 3D enviroment before. I have never wanted to venture out of my 2D wonderland that im in.

 

So the quest is;

Where does one start with a SIMPLE <- it's obviously not simple, but I mean in comparisons to others, 3D engine.,

Or must something like DirectX be used to do this.

Im using the word engine, because It is what I believe an engine to be, there could be a better word for this.

 

 

My generally accepted (by myself I mean, i've never had anyone else to discuss this with) theory is to take an index of arrays, create an array for each side of the cube, and work that with an index of arrays grabbing textures, then rendering the full block to the screen. 

 

The language im using is C++.


Expression must have class type?

06 April 2014 - 09:37 PM

Im working on Tile Mapping using SDL2, and so far stuff was going good, but for the life of me I can't figure out what I need to do to solve this problem.

This is the error: Expression must have class type.

Here is the class along with its' header.

#include "Sprite.h"
#include "includes.h"



CSprite::CSprite(SDL_Renderer *passedrenderer, std::string Filepath, int x, int y, int w, int h)
{

	renderer = passedrenderer;
	std::cout<<"Before\n";
	image = IMG_LoadTexture(renderer, Filepath.c_str());
	std::cout<<"after " << image<<std::endl;

	rect.x = x;
	rect.y = y;
	rect.w = w;
	rect.h = h;

}


CSprite::~CSprite()
{
	SDL_DestroyTexture(image);
}

void CSprite::Draw()
{
	SDL_RenderCopy(renderer, image, NULL, &rect);
}
void CSprite::SetX(int X)
{
	rect.x = X;
}
void CSprite::SetY(int Y)
{
	rect.y = Y;
}
void CSprite::SetPosition(int X, int Y)
{
	rect.x = X;
	rect.y = Y;

}
int CSprite::GetX()
{
	return rect.x;
}
int CSprite::GetY()
{
	return rect.y;
}
void CSprite::LoadMap(char *name)
{
	int x, y;
	FILE *Map;
	Map = fopen(name, "rb");


	for (y = 0; y < MAP_MAX_Y;y++)
	{
		for (x = 0; x < MAP_MAX_X;x++)
		{
			fscanf(Map, "%d", &Map.tile[y][x]);
		}
	}
	fclose(Map);
 
	
}
void CSprite::DrawMap()
{
	int x, y;

	for (y = 0; y < MAP_MAX_Y; y++)
	{
		for (x = 0; x < MAP_MAX_X; x++)
		{
			if (&Map.tile[y][x] != 0)
			{

			}
		}
	}
}

Header:

#pragma once
#include "includes.h"
class CSprite
{
public:
	CSprite(SDL_Renderer *passedrenderer,std::string Filepath, int x, int y, int w, int h);
	~CSprite();

	void SetX(int X);
	void SetY(int Y);
	void SetPosition(int X, int Y);
	void Draw();
	void LoadMap(char *name);
	int GetX();
	int GetY();
	void DrawMap();
    #define	MAP_MAX_Y 10;
    #define MAP_MAX_X 10;
    #define TILE_SIZE 32;
private:
	SDL_Texture *image;
	SDL_Rect rect;
	SDL_Renderer *renderer;
	

};

Thanks for any help, I'm going to attempt to solve this again tomorrow, but I've been a bit crushed on time recently.


Error LNK2019, SDL_IMG, SLD_LoadTexture. Unsolvable problem.

14 March 2014 - 08:55 PM

Im using SDL2 to do all my image rendering, screen creation, basically what it's used for. I'm near the end of finishing up, and I wanted to test my image loading function, The test ended in a failure. I have been trying to solve this problem for little over two hours now, and I am making no progress. this is my error.

Error	1 error LNK2019: unresolved external symbol _IMG_LoadTexture referenced in function "public: __thiscall CSprite::CSprite(struct SDL_Renderer *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int,int)" (??0CSprite@@QAE@PAUSDL_Renderer@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHHH@Z)	z:\my documents\visual studio 2013\Projects\SDL tuts 1\SDL tuts 1\Sprite.obj	SDL tuts 1

here is the class, and the header file.

#include "Sprite.h"
#include "includes.h"



CSprite::CSprite(SDL_Renderer *passedrenderer, std::string Filepath, int x, int y, int w, int h)
{

	renderer = passedrenderer;
	image = NULL;
	image = IMG_LoadTexture(renderer, Filepath.c_str());

	rect.x = x;
	rect.y = y;
	rect.w = w;
	rect.h = h;
}


CSprite::~CSprite()
{
	SDL_DestroyTexture(image);
}

void CSprite::Draw()
{
	SDL_RenderCopy(renderer, image, NULL, &rect);
}
#pragma once
#include "includes.h"
class CSprite
{
public:
	CSprite(SDL_Renderer *passedrenderer,std::string Filepath, int x, int y, int w, int h);
	~CSprite();

	void Draw();
private:
	SDL_Texture *image;
	SDL_Rect rect;
	SDL_Renderer *renderer;
	

};

If you need anything else, Im more than willing to give the needed resources.


Branching paths.

09 March 2014 - 05:27 AM

I want to handle a story-line completely based off of branching selections. I.e selections you make affects others. Is there a better way to handle different paths, and disabling events that could happen in other paths if you select a different path, other than tons and tons of if statements?


SDL and android?

20 February 2014 - 08:14 PM

I won't say i'm new to programming, however I am new to android and mobile platforms. My question is simple, How difficult, if possible, would it be to port over a game made for desktop, onto the android platform. I'm not worried about IOS, as I simply have no desire for it. Is this even possible, and excluding modifying controls, what would most likely have to be changes. It's a simple 2D platformer, that is still to early in development to post any preview pics of, or I would as I feel it could help answer my question. Oh and im using Visual Studio 2013, C++11.


PARTNERS