/history.txt |
---|
0,0 → 1,0 |
18/24/10 23:29 - Freddie: I think a point struct is needed, so I made one (sort of). Rather than building the sname properties into sssnakesss.cpp I think we should have a vector of class snake. I'm happy to write this class entirley, just want a Go-Ahead. In other news, if I am creating an instance class/struct, do you use class_name::func_name or class_name.func_name? From your code I get the impression it is the same as Static, but this seems wrong/silly. Enjoy. Oh, yeah - lets keep this going, so we know what is happening easily and can explainface stuffs. |
/include/point.hpp |
---|
0,0 → 1,9 |
struct point |
{ |
public: |
point(int x, int y); |
~point(); |
int X; |
int Y; |
} |
/include/snake.hpp |
---|
0,0 → 1,17 |
#include "point.hpp" |
#include <vector> |
class snake |
{ |
public: |
snake(); |
~snake(); |
nextPoint(point newPoint); |
vector<point> points; // list of points snake occupies |
// colour |
int R; |
int G; |
int B; |
}; |
/src/snake.cpp |
---|
0,0 → 1,6 |
#include "snake.hpp" |
void snake::nextPoint(point newPoint) |
{ |
} |
/src/point.cpp |
---|
0,0 → 1,7 |
#include "point.hpp" |
point::point(int x, int y) |
{ |
X = x; |
Y = y; |
} |
/src/sssnakesss.cpp |
---|
2,6 → 2,7 |
#include "SDL/SDL_image.h" |
#include "SDL/SDL_opengl.h" |
#include <dirent.h> |
#include <iostream> |
#include <vector> |
#include <map> |
101,6 → 102,8 |
checkEvents(); |
update(); |
draw(); |
SDL_GL_SwapBuffers(); |
} |
} |
125,15 → 128,34 |
void SSSNAKESSS::draw() |
{ |
//drawTexture(textures["thing.png", 0, 0); |
} |
void SSSNAKESSS::end() |
{ |
SDL_FreeSurface(screen); |
SDL_Quit(); |
} |
vector<string> SSSNAKESSS::listDir(string dir) |
vector<string> SSSNAKESSS::listDir(string dirName) |
{ |
vector<string> list; |
vector<string> files; |
return list; |
DIR *dp = opendir(dirName.c_str()); |
if (dp != NULL) |
{ |
dirent *ep; |
while ((ep = readdir(dp))) |
{ |
string n = ep->d_name; |
if (n != "." && n != "..") |
{ |
files.push_back(n); |
} |
} |
closedir(dp); |
} |
return files; |
} |