Subversion Repositories sssnakesss

Compare Revisions

Ignore whitespace Rev 10 → Rev 9

/include/point.hpp
1,13 → 1,9
#ifndef POINT_HPP
#define POINT_HPP
 
class Point
{
public:
Point(int x, int y);
 
int X;
int Y;
};
 
#endif // POINT_HPP
struct point
{
public:
point(int x, int y);
~point();
 
int X;
int Y;
}
/include/snake.hpp
1,20 → 1,17
#ifndef SNAKE_HPP
#define SNAKE_HPP
 
class Snake
{
public:
Snake();
void nextPoint(Point newPoint);
 
// Stuff that should be private
vector<Point> points; // list of points snake occupies
 
// Colour Values
int R;
int G;
int B;
};
 
#endif // SNAKE_HPP
#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;
};
/include/sssnakesss.hpp
1,6 → 1,8
#ifndef SSSNAKESSS_HPP
#define SSSNAKESSS_HPP
 
struct SDL_Surface;
 
class SSSNAKESSS
{
public:
27,7 → 29,6
SDL_Surface *screen;
map<string, Texture *> textures;
Snake *snake;
};
 
#endif // SSSNAKESSS_HPP
/src/snake.cpp
1,15 → 1,6
#include <vector>
 
using namespace std;
 
#include "point.hpp"
#include "snake.hpp"
 
Snake::Snake()
void snake::nextPoint(point newPoint)
{
}
 
void Snake::nextPoint(Point newPoint)
{
points.push_back(newPoint);
}
}
/src/point.cpp
1,7 → 1,7
#include "point.hpp"
 
Point::Point(int x, int y)
{
X = x;
Y = y;
}
#include "point.hpp"
 
point::point(int x, int y)
{
X = x;
Y = y;
}
/src/sssnakesss.cpp
9,8 → 9,6
 
using namespace std;
 
#include "point.hpp"
#include "snake.hpp"
#include "texture.hpp"
#include "sssnakesss.hpp"
 
38,8 → 36,6
initData();
snake = new Snake;
return true;
}
 
132,13 → 128,11
 
void SSSNAKESSS::draw()
{
//drawTexture(textures["food.png"], 20, 20);
//drawTexture(textures["thing.png", 0, 0);
}
 
void SSSNAKESSS::end()
{
delete snake;
SDL_FreeSurface(screen);
SDL_Quit();
}
/src/texture.cpp
11,7 → 11,7
{
loaded = false;
GLenum textureFormat = GL_RGBA;
GLenum textureFormat = GL_RGB;
SDL_Surface *surface = IMG_Load(filename.c_str());
if (surface)
/src/main.cpp
1,17 → 1,3
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_opengl.h"
 
#include <dirent.h>
#include <iostream>
#include <vector>
#include <map>
 
using namespace std;
 
#include "point.hpp"
#include "snake.hpp"
#include "texture.hpp"
#include "sssnakesss.hpp"
 
int main(int argc, char *argv[])
/tmake.lua
2,7 → 2,7
Language("C++")
 
function build()
Set("Sources", Srcs("main.cpp", "sssnakesss.cpp", "texture.cpp", "point.cpp", "snake.cpp"))
Set("Sources", Srcs("main.cpp", "sssnakesss.cpp", "texture.cpp"))
Set("Libraries", Libs("SDL", "SDL_image", "SDL_mixer", "SDL_ttf", "GL"))
Set("Includes", Incs("SDL", "SDL_image", "SDL_mixer", "SDL_ttf"))