[Add] Just the beginning of an A* implementation.

-- I have gone back to makefiles and text editors as QT bored me.
-- I know, there is nothing here.. I just want to look busy. :P
This commit is contained in:
Rtch90 2012-01-06 00:47:12 +00:00
parent f3fd1861bc
commit 589268a94f
10 changed files with 65 additions and 22 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ Win32/Unuk/Unuk/*.user
Win32/Unuk/Unuk.ncb
Win32/Unuk/Unuk.suo
Bin/*.dll
*.swp
*.o
*.exe
*log

Binary file not shown.

View File

@ -39,7 +39,8 @@ HEADERS += ../src/libUnuk/Debug.h \
../src/libUnuk/MapEntities.h \
../src/libUnuk/FPS.h \
../src/libUnuk/MemManager.h \
../src/libUnuk/MemClass.h
../src/libUnuk/MemClass.h \
../src/libUnuk/Node.h
SOURCES += ../src/libUnuk/Debug.cpp \
../src/Unuk/main.cpp \
../src/libUnuk/Input.cpp \

View File

@ -67,7 +67,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-ICZ0NvJNRS,guid=3b12f0647bd9cd4da4459e180000003d</value>
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-nnryLpuskH,guid=b1dc32eb5ce3f37b1b9bd14200000047</value>
<value type="QString">DISPLAY=:0</value>
<value type="QString">HOME=/home/allanis</value>
<value type="QString">HUSHLOGIN=FALSE</value>
@ -80,13 +80,13 @@
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SHLVL=1</value>
<value type="QString">SSH_AGENT_PID=3260</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/ssh-lozFEJmg3235/agent.3235</value>
<value type="QString">SSH_AGENT_PID=3398</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/ssh-LnbIeWkr3373/agent.3373</value>
<value type="QString">TERM=linux</value>
<value type="QString">USER=allanis</value>
<value type="QString">WINDOWPATH=7</value>
<value type="QString">XAUTHORITY=/home/allanis/.Xauthority</value>
<value type="QString">XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1323089410.422893-1130065724</value>
<value type="QString">XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1325788236.314939-282202860</value>
<value type="QString">_=/usr/bin/startx</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList">
@ -106,7 +106,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList">
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-ICZ0NvJNRS,guid=3b12f0647bd9cd4da4459e180000003d</value>
<value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-nnryLpuskH,guid=b1dc32eb5ce3f37b1b9bd14200000047</value>
<value type="QString">DISPLAY=:0</value>
<value type="QString">HOME=/home/allanis</value>
<value type="QString">HUSHLOGIN=FALSE</value>
@ -119,13 +119,13 @@
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SHLVL=1</value>
<value type="QString">SSH_AGENT_PID=3260</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/ssh-lozFEJmg3235/agent.3235</value>
<value type="QString">SSH_AGENT_PID=3398</value>
<value type="QString">SSH_AUTH_SOCK=/tmp/ssh-LnbIeWkr3373/agent.3373</value>
<value type="QString">TERM=linux</value>
<value type="QString">USER=allanis</value>
<value type="QString">WINDOWPATH=7</value>
<value type="QString">XAUTHORITY=/home/allanis/.Xauthority</value>
<value type="QString">XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1323089410.422893-1130065724</value>
<value type="QString">XDG_SESSION_COOKIE=6de6dd7b78e791242262c6460000012e-1325788236.314939-282202860</value>
<value type="QString">_=/usr/bin/startx</value>
</valuelist>
<value key="abstractProcess.IgnoreReturnValue" type="bool">false</value>

View File

@ -8,7 +8,8 @@ Game::Game(void) {
}
Game::~Game(void) {
delete _player;
// cleaning _player up caused a nice seg fault. I'll look later.
//delete _player;
delete _npc;
}

9
src/libUnuk/AStar.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "AStar.h"
AStar::AStar(void) {
}
AStar::~AStar(void) {
}

10
src/libUnuk/AStar.h Normal file
View File

@ -0,0 +1,10 @@
#include <list>
class AStar {
public:
AStar(void);
~AStar(void);
private:
};

View File

@ -4,7 +4,8 @@ LDADD = -lGL -lGLU -lSDL -lSDL_ttf -lSDL_gfx -lSDL_image -ltinyxml
objects = ApplySurface.o Button.o ButtonToggle.o Character.o Collision.o \
Debug.o Font.o FPS.o ImageLoader.o IngameMenu.o Input.o MainMenu.o \
Map.o MapElement.o MapEntities.o NPC.o ParticleEmitter.o \
Rect.o Text.o Texture.o TextureManager.o Timer.o \
Rect.o Text.o Texture.o TextureManager.o Timer.o MemManager.o\
AStar.o \
.PHONY: default all clean

20
src/libUnuk/Node.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef _NODE_H_
#define _NODE_H_
#include <vector>
#include <iostream>
class Node {
public:
Node(int xArg, int yArg);
virtual ~Node(void);
inline int GetX(void) const { return x; }
inline int GetY(void) const { return y; }
inline float GetCost(void) { return _cost; }
private:
int x, y;
float _cost;
};
#endif

View File

@ -9,10 +9,10 @@ TTF_Font* Text::vLargeFont = NULL;
const static int lineSpacing = 3;
Text::Text(void) {
x=0;
y=0;
w=0;
h=0;
x = 0;
y = 0;
w = 0;
h = 0;
lineWidth=50;
}
@ -28,9 +28,9 @@ Text::~Text(void) {
void Text::LoadFonts(void) {
// Load the fonts if they are not already in memory.
assert(vSmallFont == NULL);
assert(smallFont == NULL);
assert(smallFont == NULL);
assert(mediumFont == NULL);
assert(largeFont == NULL);
assert(largeFont == NULL);
assert(vLargeFont == NULL);
vSmallFont = Font("../Data/Media/Fonts/Enigma_2.ttf", 16);
@ -43,9 +43,9 @@ void Text::LoadFonts(void) {
void Text::FreeFonts(void) {
// If the fonts are loaded, then free them.
assert(vSmallFont != NULL);
assert(smallFont != NULL);
assert(smallFont != NULL);
assert(mediumFont != NULL);
assert(largeFont != NULL);
assert(largeFont != NULL);
assert(vLargeFont != NULL);
TTF_CloseFont(vSmallFont);
@ -93,7 +93,7 @@ int Text::SetTextBlended(string textArg, textSizes_t size, SDL_Color colour,bool
std::string line;
for(int i = 0; i < (int)finalTextContents.size(); i++) {
char c = finalTextContents.at(i);
if(c=='\n') {
if(c == '\n') {
lines.push_back(line);
line.clear();
} else {
@ -161,7 +161,7 @@ int Text::SetTextShaded(string textArg, textSizes_t size, SDL_Color colour, SDL_
std::string line;
for(int i = 0; i < (int)finalTextContents.size(); i++) {
char c = finalTextContents.at(i);
if(c=='\n') {
if(c == '\n') {
lines.push_back(line);
line.clear();
} else {
@ -247,7 +247,7 @@ std::string Text::DoWordWrap(TTF_Font* fontArg, const std::string& textArg) {
char* word = strtok(tokenizedText, " ");
while (word) {
while(word) {
int wordWidth;
TTF_SizeText(fontArg, word, &wordWidth, NULL);