Skip to content

MapTile #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions database
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "sqlite3.h"
#include "iostream"

int DbConnectTest(int argc, char** argv)
{
sqlite3* DB;
int exit = 0;
exit = sqlite3_open("allDB.db" , &DB);

if (exit)
{
std::cerr << "Error open DB" << sqlite3_errmsg(DB) << std::endl;
return(-1);
}
else
std::cout << "Open Database Successfully!!!!" << std::endl;
sqlite3_close(DB);
return(0);


}
78 changes: 78 additions & 0 deletions maptile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <string>
#include <fstream>

const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

const int LEVEL_WIDTH = 1280;
const int LEVEL_WIDTH = 960;

const int TILE_WIDTH = 80;
const int TILE_HEIGHT = 80;
const int TOTAL_TILES = 192;
const int TOTAL_TILE_SPRITES = 12;



const int TILE_BROWN = 0;
const int TILE_GREEN = 1;
const int TILE_BLUE = 2;
const int TILE_WALL = 3;


class Tile
{
public:
Tile(int x, int y, int tileType);

void render(SDL_Rect & camera);

int getType();

SDL_Rect getBox();

private:
SDL_Rect mBox;

int mType;
};


bool init();

bool loadMedia(Tile* tiles[]);

void close(Tile* tiles[]);


bool setTiles(Tile *tiles[]);

Tile::Tile(int x, int y, int tileType)
{
mBox.x = x;
mBox.y = y;

mBox.w = TILE_WIDTH;
mBox.h = TILE_HEIGHT;

mType = tileType;

}

int Tile::getType()
{
return mType;

}

bool loadMedia(Tile* tiles[])
{
bool success = true;
if (!gTileTexture.loadFromFile("Imagens/tiletect.png"))
{
printf( "Failed to load tile set texture!!!\n")
}
}