Keep original end of line characters.
This commit is contained in:
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,6 +1,6 @@
|
|||||||
build-*
|
build-*
|
||||||
*.dll
|
*.dll
|
||||||
*.exe
|
*.exe
|
||||||
*.so
|
*.so
|
||||||
*.so.*
|
*.so.*
|
||||||
DIST/*
|
DIST/*
|
||||||
|
|||||||
312
Game/GameEnts.c
312
Game/GameEnts.c
@@ -1,156 +1,156 @@
|
|||||||
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "GameLib.h"
|
#include "GameLib.h"
|
||||||
extern int gamelib_debug;
|
extern int gamelib_debug;
|
||||||
|
|
||||||
#include "GameEnts.h"
|
#include "GameEnts.h"
|
||||||
|
|
||||||
DrawImg img_player;
|
DrawImg img_player;
|
||||||
DrawImg img_platform;
|
DrawImg img_platform;
|
||||||
DrawImg img_block;
|
DrawImg img_block;
|
||||||
|
|
||||||
Entity ent_Player;
|
Entity ent_Player;
|
||||||
Entity ent_Platform;
|
Entity ent_Platform;
|
||||||
Entity ent_Block;
|
Entity ent_Block;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int EntityApplyGravity(Entity e){
|
int EntityApplyGravity(Entity e){
|
||||||
float grav=10.0f;
|
float grav=10.0f;
|
||||||
float vTerminal=50.0f;
|
float vTerminal=50.0f;
|
||||||
vec2 vGrav;
|
vec2 vGrav;
|
||||||
|
|
||||||
// Only apply gravity to some entity types
|
// Only apply gravity to some entity types
|
||||||
if(!(
|
if(!(
|
||||||
e->type==Ent_Player ||
|
e->type==Ent_Player ||
|
||||||
0
|
0
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply gravity
|
// Apply gravity
|
||||||
vec2_set(vGrav,0.0f,grav);
|
vec2_set(vGrav,0.0f,grav);
|
||||||
Entity_AddVelLimit(e,vGrav,vTerminal);
|
Entity_AddVelLimit(e,vGrav,vTerminal);
|
||||||
|
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void player_proc(Entity e,int ft){
|
void player_proc(Entity e,int ft){
|
||||||
float acel=8.0f;
|
float acel=8.0f;
|
||||||
float maxVel=30.0f;
|
float maxVel=30.0f;
|
||||||
float jumpVel=50.0f;
|
float jumpVel=50.0f;
|
||||||
float shootVel=50.0f;
|
float shootVel=50.0f;
|
||||||
|
|
||||||
if(Input_GetKey(InputKey_Jump)==InputKey_Pressed ||
|
if(Input_GetKey(InputKey_Jump)==InputKey_Pressed ||
|
||||||
Input_GetKey(InputKey_Up)==InputKey_Pressed)
|
Input_GetKey(InputKey_Up)==InputKey_Pressed)
|
||||||
{
|
{
|
||||||
vec2 jump;
|
vec2 jump;
|
||||||
|
|
||||||
// Apply jump
|
// Apply jump
|
||||||
if(e->vel[1]>(-jumpVel)){
|
if(e->vel[1]>(-jumpVel)){
|
||||||
e->vel[1]=-jumpVel;
|
e->vel[1]=-jumpVel;
|
||||||
}
|
}
|
||||||
Entity_CalcBBox(e);
|
Entity_CalcBBox(e);
|
||||||
|
|
||||||
// FIXME: play sound
|
// FIXME: play sound
|
||||||
}
|
}
|
||||||
if(Input_GetKey(InputKey_Left)){
|
if(Input_GetKey(InputKey_Left)){
|
||||||
vec2 left;
|
vec2 left;
|
||||||
|
|
||||||
// Apply left movement
|
// Apply left movement
|
||||||
vec2_set(left,-acel,0.0f);
|
vec2_set(left,-acel,0.0f);
|
||||||
Entity_AddVelLimit(e,left,maxVel);
|
Entity_AddVelLimit(e,left,maxVel);
|
||||||
|
|
||||||
e->A=0;
|
e->A=0;
|
||||||
}
|
}
|
||||||
if(Input_GetKey(InputKey_Right)){
|
if(Input_GetKey(InputKey_Right)){
|
||||||
vec2 right;
|
vec2 right;
|
||||||
|
|
||||||
// Apply right movement
|
// Apply right movement
|
||||||
vec2_set(right,acel,0.0f)
|
vec2_set(right,acel,0.0f)
|
||||||
Entity_AddVelLimit(e,right,maxVel);
|
Entity_AddVelLimit(e,right,maxVel);
|
||||||
|
|
||||||
e->A=1;
|
e->A=1;
|
||||||
}
|
}
|
||||||
if(Input_GetKey(InputKey_Action1)==InputKey_Pressed ||
|
if(Input_GetKey(InputKey_Action1)==InputKey_Pressed ||
|
||||||
Input_GetKey(InputKey_Action2)==InputKey_Pressed)
|
Input_GetKey(InputKey_Action2)==InputKey_Pressed)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Scroll View
|
// Scroll View
|
||||||
//GameLib_MoveToPosH(e->pos,0.6f);
|
//GameLib_MoveToPosH(e->pos,0.6f);
|
||||||
GameLib_MoveToPos(e->pos,0.6f);
|
GameLib_MoveToPos(e->pos,0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GameEnts_Init(){
|
void GameEnts_Init(){
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Load and initialize media.
|
// Load and initialize media.
|
||||||
//
|
//
|
||||||
|
|
||||||
img_player=Draw_LoadImage("data/player.png");
|
img_player=Draw_LoadImage("data/player.png");
|
||||||
img_platform=Draw_LoadImage("data/platform.png");
|
img_platform=Draw_LoadImage("data/platform.png");
|
||||||
img_block=Draw_LoadImage("data/block.png");
|
img_block=Draw_LoadImage("data/block.png");
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Initialize entity types.
|
// Initialize entity types.
|
||||||
//
|
//
|
||||||
|
|
||||||
ent_Player=Entity_New();
|
ent_Player=Entity_New();
|
||||||
ent_Player->type=Ent_Player;
|
ent_Player->type=Ent_Player;
|
||||||
//ent_Player->flags=EntityFlag_Light;
|
//ent_Player->flags=EntityFlag_Light;
|
||||||
//Entity_SetLight(ent_Player,.2,.2,.2,200);
|
//Entity_SetLight(ent_Player,.2,.2,.2,200);
|
||||||
ent_Player->flags=EntityFlag_Collision|EntityFlag_Overlap;
|
ent_Player->flags=EntityFlag_Collision|EntityFlag_Overlap;
|
||||||
ent_Player->zorder=0;
|
ent_Player->zorder=0;
|
||||||
AnimPlay_SetImg(&ent_Player->anim,img_player);
|
AnimPlay_SetImg(&ent_Player->anim,img_player);
|
||||||
ent_Player->proc=player_proc;
|
ent_Player->proc=player_proc;
|
||||||
ent_Player->mass=1.0f;
|
ent_Player->mass=1.0f;
|
||||||
ent_Player->radius=12;
|
ent_Player->radius=12;
|
||||||
ent_Player->width=24;
|
ent_Player->width=24;
|
||||||
ent_Player->height=24;
|
ent_Player->height=24;
|
||||||
ent_Player->fric_static=0.0f;
|
ent_Player->fric_static=0.0f;
|
||||||
ent_Player->fric_dynamic=0.2f;
|
ent_Player->fric_dynamic=0.2f;
|
||||||
|
|
||||||
ent_Platform=Entity_New();
|
ent_Platform=Entity_New();
|
||||||
ent_Platform->type=Ent_Platform;
|
ent_Platform->type=Ent_Platform;
|
||||||
ent_Platform->flags=EntityFlag_PlatformCollision;
|
ent_Platform->flags=EntityFlag_PlatformCollision;
|
||||||
ent_Platform->zorder=-1;
|
ent_Platform->zorder=-1;
|
||||||
AnimPlay_SetImg(&ent_Platform->anim,img_platform);
|
AnimPlay_SetImg(&ent_Platform->anim,img_platform);
|
||||||
ent_Platform->mass=0.0f;
|
ent_Platform->mass=0.0f;
|
||||||
ent_Platform->radius=12;
|
ent_Platform->radius=12;
|
||||||
ent_Platform->width=64;
|
ent_Platform->width=64;
|
||||||
ent_Platform->height=16;
|
ent_Platform->height=16;
|
||||||
ent_Platform->fric_static=0.0f;
|
ent_Platform->fric_static=0.0f;
|
||||||
ent_Platform->fric_dynamic=0.2f;
|
ent_Platform->fric_dynamic=0.2f;
|
||||||
|
|
||||||
ent_Block=Entity_New();
|
ent_Block=Entity_New();
|
||||||
ent_Block->type=Ent_Block;
|
ent_Block->type=Ent_Block;
|
||||||
ent_Block->flags=EntityFlag_BlockCollision;
|
ent_Block->flags=EntityFlag_BlockCollision;
|
||||||
ent_Block->zorder=-1;
|
ent_Block->zorder=-1;
|
||||||
AnimPlay_SetImg(&ent_Block->anim,img_block);
|
AnimPlay_SetImg(&ent_Block->anim,img_block);
|
||||||
ent_Block->mass=0.0f;
|
ent_Block->mass=0.0f;
|
||||||
ent_Block->radius=32;
|
ent_Block->radius=32;
|
||||||
ent_Block->width=64;
|
ent_Block->width=64;
|
||||||
ent_Block->height=64;
|
ent_Block->height=64;
|
||||||
ent_Block->fric_static=0.0f;
|
ent_Block->fric_static=0.0f;
|
||||||
ent_Block->fric_dynamic=0.2f;
|
ent_Block->fric_dynamic=0.2f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
||||||
|
|
||||||
#ifndef _GAMEENTS_H_
|
#ifndef _GAMEENTS_H_
|
||||||
#define _GAMEENTS_H_
|
#define _GAMEENTS_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Ent_Player,
|
Ent_Player,
|
||||||
Ent_Platform,
|
Ent_Platform,
|
||||||
Ent_Block,
|
Ent_Block,
|
||||||
|
|
||||||
Ent_Last
|
Ent_Last
|
||||||
} EntityType;
|
} EntityType;
|
||||||
|
|
||||||
extern Entity ent_Player;
|
extern Entity ent_Player;
|
||||||
extern Entity ent_Platform;
|
extern Entity ent_Platform;
|
||||||
extern Entity ent_Block;
|
extern Entity ent_Block;
|
||||||
|
|
||||||
int EntityApplyGravity(Entity e);
|
int EntityApplyGravity(Entity e);
|
||||||
|
|
||||||
void GameEnts_Init();
|
void GameEnts_Init();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
254
Game/GameMap.c
254
Game/GameMap.c
@@ -1,128 +1,128 @@
|
|||||||
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "GameLib.h"
|
#include "GameLib.h"
|
||||||
|
|
||||||
#include "GameEnts.h"
|
#include "GameEnts.h"
|
||||||
#include "GameMap.h"
|
#include "GameMap.h"
|
||||||
|
|
||||||
|
|
||||||
int ReadLine(FILE *f,char *line,int max){
|
int ReadLine(FILE *f,char *line,int max){
|
||||||
int c;
|
int c;
|
||||||
int i=0;
|
int i=0;
|
||||||
while(i<(max-1)){
|
while(i<(max-1)){
|
||||||
c=fgetc(f);
|
c=fgetc(f);
|
||||||
if(c==EOF){
|
if(c==EOF){
|
||||||
line[i]=0;
|
line[i]=0;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
if(c=='\r'){
|
if(c=='\r'){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(c=='\n'){
|
if(c=='\n'){
|
||||||
line[i]=0;
|
line[i]=0;
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
line[i]=c;
|
line[i]=c;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
line[i]=0;
|
line[i]=0;
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entity GameMapAux_CreateEnt(Entity ent,int i,int j,int res){
|
Entity GameMapAux_CreateEnt(Entity ent,int i,int j,int res){
|
||||||
Entity e;
|
Entity e;
|
||||||
vec2 pos;
|
vec2 pos;
|
||||||
e=Entity_Copy(ent);
|
e=Entity_Copy(ent);
|
||||||
vec2_set(pos,(res/2)+i*res,(res/2)+j*res);
|
vec2_set(pos,(res/2)+i*res,(res/2)+j*res);
|
||||||
vec2_plus(e->pos,e->pos,pos);
|
vec2_plus(e->pos,e->pos,pos);
|
||||||
Entity_CalcBBox(e);
|
Entity_CalcBBox(e);
|
||||||
GameLib_AddEntity(e);
|
GameLib_AddEntity(e);
|
||||||
return(e);
|
return(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MaxLineLen 1024
|
#define MaxLineLen 1024
|
||||||
|
|
||||||
int GameMap_LoadLevel(char *filename,int res){
|
int GameMap_LoadLevel(char *filename,int res){
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char line[MaxLineLen];
|
char line[MaxLineLen];
|
||||||
int len,i,j;
|
int len,i,j;
|
||||||
int width,height;
|
int width,height;
|
||||||
char *map;
|
char *map;
|
||||||
|
|
||||||
|
|
||||||
// Open the file
|
// Open the file
|
||||||
file=fopen(filename,"rb");
|
file=fopen(filename,"rb");
|
||||||
if(!file){
|
if(!file){
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the file to determine sizes
|
// Read the file to determine sizes
|
||||||
width=0;
|
width=0;
|
||||||
height=0;
|
height=0;
|
||||||
do{
|
do{
|
||||||
len=ReadLine(file,line,MaxLineLen);
|
len=ReadLine(file,line,MaxLineLen);
|
||||||
if(len>-1){
|
if(len>-1){
|
||||||
if(len>height){
|
if(len>height){
|
||||||
height=len;
|
height=len;
|
||||||
}
|
}
|
||||||
width++;
|
width++;
|
||||||
}
|
}
|
||||||
}while(len>-1);
|
}while(len>-1);
|
||||||
fseek(file,0,SEEK_SET);
|
fseek(file,0,SEEK_SET);
|
||||||
|
|
||||||
|
|
||||||
// Build the map
|
// Build the map
|
||||||
map=malloc(sizeof(char)*width*height);
|
map=malloc(sizeof(char)*width*height);
|
||||||
memset(map,0,width*height);
|
memset(map,0,width*height);
|
||||||
#define MAP(x,y) map[(x)+((y)*width)]
|
#define MAP(x,y) map[(x)+((y)*width)]
|
||||||
j=0;
|
j=0;
|
||||||
do{
|
do{
|
||||||
len=ReadLine(file,line,MaxLineLen);
|
len=ReadLine(file,line,MaxLineLen);
|
||||||
for(i=0;i<len;i++){
|
for(i=0;i<len;i++){
|
||||||
MAP(j,(height-1)-i)=line[i];
|
MAP(j,(height-1)-i)=line[i];
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}while(len>-1);
|
}while(len>-1);
|
||||||
|
|
||||||
|
|
||||||
// Close the file
|
// Close the file
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
|
|
||||||
// Parse the map
|
// Parse the map
|
||||||
for(j=0;j<height;j++){
|
for(j=0;j<height;j++){
|
||||||
for(i=0;i<width;i++){
|
for(i=0;i<width;i++){
|
||||||
Entity ent;
|
Entity ent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(MAP(i,j)=='P'){
|
if(MAP(i,j)=='P'){
|
||||||
// Player
|
// Player
|
||||||
GameMapAux_CreateEnt(ent_Player,i,j,res);
|
GameMapAux_CreateEnt(ent_Player,i,j,res);
|
||||||
}
|
}
|
||||||
if(MAP(i,j)=='#'){
|
if(MAP(i,j)=='#'){
|
||||||
// Block
|
// Block
|
||||||
ent=GameMapAux_CreateEnt(ent_Block,i,j,res);
|
ent=GameMapAux_CreateEnt(ent_Block,i,j,res);
|
||||||
}
|
}
|
||||||
if(MAP(i,j)=='|'){
|
if(MAP(i,j)=='|'){
|
||||||
// Platform
|
// Platform
|
||||||
ent=GameMapAux_CreateEnt(ent_Platform,i,j,res);
|
ent=GameMapAux_CreateEnt(ent_Platform,i,j,res);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
free(map);
|
free(map);
|
||||||
#undef MAP
|
#undef MAP
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
||||||
#ifndef _GAMEMAP_H_
|
#ifndef _GAMEMAP_H_
|
||||||
#define _GAMEMAP_H_
|
#define _GAMEMAP_H_
|
||||||
|
|
||||||
int GameMap_LoadLevel(char *filename,int res);
|
int GameMap_LoadLevel(char *filename,int res);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
140
Game/main.c
140
Game/main.c
@@ -1,71 +1,71 @@
|
|||||||
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
// Copyright (C) 2012 Valeriano Alfonso Rodriguez (Kableado)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "GameLib.h"
|
#include "GameLib.h"
|
||||||
extern int gamelib_debug;
|
extern int gamelib_debug;
|
||||||
|
|
||||||
#include "GameEnts.h"
|
#include "GameEnts.h"
|
||||||
#include "GameMap.h"
|
#include "GameMap.h"
|
||||||
|
|
||||||
|
|
||||||
DrawFnt font;
|
DrawFnt font;
|
||||||
DrawFnt font_shad;
|
DrawFnt font_shad;
|
||||||
|
|
||||||
void ProcGame(){
|
void ProcGame(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcGame(){
|
void PostProcGame(){
|
||||||
// Apply gravity to every entity
|
// Apply gravity to every entity
|
||||||
GameLib_ForEachEnt(EntityApplyGravity);
|
GameLib_ForEachEnt(EntityApplyGravity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc,char *argv[]){
|
int main(int argc,char *argv[]){
|
||||||
int i,j;
|
int i,j;
|
||||||
Entity *e;
|
Entity *e;
|
||||||
|
|
||||||
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
if (argc>1) {
|
if (argc>1) {
|
||||||
if (!strcmp(argv[1],"debug")) {
|
if (!strcmp(argv[1],"debug")) {
|
||||||
gamelib_debug=1;
|
gamelib_debug=1;
|
||||||
printf("Debug Mode Activated!\n");
|
printf("Debug Mode Activated!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib_Init(640,480,"Game",20,60);
|
GameLib_Init(640,480,"Game",20,60);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Load and initialize media.
|
// Load and initialize media.
|
||||||
//
|
//
|
||||||
font=Draw_DefaultFont(255,255,255,255);
|
font=Draw_DefaultFont(255,255,255,255);
|
||||||
font_shad=Draw_DefaultFont(0,0,0,127);
|
font_shad=Draw_DefaultFont(0,0,0,127);
|
||||||
|
|
||||||
GameEnts_Init();
|
GameEnts_Init();
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Initialize world.
|
// Initialize world.
|
||||||
//
|
//
|
||||||
GameLib_DelEnts();
|
GameLib_DelEnts();
|
||||||
GameMap_LoadLevel("data/level_01.txt",64);
|
GameMap_LoadLevel("data/level_01.txt",64);
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Run the world.
|
// Run the world.
|
||||||
//
|
//
|
||||||
|
|
||||||
GameLib_Loop(ProcGame,PostProcGame,NULL,NULL);
|
GameLib_Loop(ProcGame,PostProcGame,NULL,NULL);
|
||||||
|
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
214
Makefile.common
214
Makefile.common
@@ -1,107 +1,107 @@
|
|||||||
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
# GameLib Declarations #
|
# GameLib Declarations #
|
||||||
########################
|
########################
|
||||||
CFLAGS += -IGameLib
|
CFLAGS += -IGameLib
|
||||||
GAMELIB_HEADS = \
|
GAMELIB_HEADS = \
|
||||||
GameLib/Time.h \
|
GameLib/Time.h \
|
||||||
GameLib/Util.h \
|
GameLib/Util.h \
|
||||||
GameLib/QuadArray2D.h \
|
GameLib/QuadArray2D.h \
|
||||||
GameLib/Draw.h \
|
GameLib/Draw.h \
|
||||||
GameLib/Input.h \
|
GameLib/Input.h \
|
||||||
GameLib/Audio.h \
|
GameLib/Audio.h \
|
||||||
GameLib/Anim.h \
|
GameLib/Anim.h \
|
||||||
GameLib/Entity.h \
|
GameLib/Entity.h \
|
||||||
GameLib/GameLib.h
|
GameLib/GameLib.h
|
||||||
GAMELIBS_OBJS = \
|
GAMELIBS_OBJS = \
|
||||||
$(BUILDDIR)/GameLib/Time.o \
|
$(BUILDDIR)/GameLib/Time.o \
|
||||||
$(BUILDDIR)/GameLib/Util.o \
|
$(BUILDDIR)/GameLib/Util.o \
|
||||||
$(BUILDDIR)/GameLib/QuadArray2D.o \
|
$(BUILDDIR)/GameLib/QuadArray2D.o \
|
||||||
$(BUILDDIR)/GameLib/Draw.o \
|
$(BUILDDIR)/GameLib/Draw.o \
|
||||||
$(BUILDDIR)/GameLib/Input.o \
|
$(BUILDDIR)/GameLib/Input.o \
|
||||||
$(BUILDDIR)/GameLib/Audio.o \
|
$(BUILDDIR)/GameLib/Audio.o \
|
||||||
$(BUILDDIR)/GameLib/Anim.o \
|
$(BUILDDIR)/GameLib/Anim.o \
|
||||||
$(BUILDDIR)/GameLib/Entity.o \
|
$(BUILDDIR)/GameLib/Entity.o \
|
||||||
$(BUILDDIR)/GameLib/GameLib.o
|
$(BUILDDIR)/GameLib/GameLib.o
|
||||||
RES_GAMELIB_OUT = $(BUILDDIR)/$(RES_GAMELIB)
|
RES_GAMELIB_OUT = $(BUILDDIR)/$(RES_GAMELIB)
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Game Declarations #
|
# Game Declarations #
|
||||||
#####################
|
#####################
|
||||||
GAME_HEADS = $(GAMELIB_HEADS) Game/GameEnts.h Game/GameMap.h
|
GAME_HEADS = $(GAMELIB_HEADS) Game/GameEnts.h Game/GameMap.h
|
||||||
GAME_OBJS = \
|
GAME_OBJS = \
|
||||||
$(BUILDDIR)/Game/GameEnts.o \
|
$(BUILDDIR)/Game/GameEnts.o \
|
||||||
$(BUILDDIR)/Game/GameMap.o \
|
$(BUILDDIR)/Game/GameMap.o \
|
||||||
$(BUILDDIR)/Game/main.o
|
$(BUILDDIR)/Game/main.o
|
||||||
RES_GAME_OUT = $(BUILDDIR)/$(RES_GAME)
|
RES_GAME_OUT = $(BUILDDIR)/$(RES_GAME)
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# General Rules #
|
# General Rules #
|
||||||
#################
|
#################
|
||||||
all: $(BUILDDIR) $(RES_GAME_OUT)
|
all: $(BUILDDIR) $(RES_GAME_OUT)
|
||||||
|
|
||||||
$(BUILDDIR):
|
$(BUILDDIR):
|
||||||
$(MKDIR) $(BUILDDIR)
|
$(MKDIR) $(BUILDDIR)
|
||||||
$(MKDIR) $(BUILDDIR)/GameLib
|
$(MKDIR) $(BUILDDIR)/GameLib
|
||||||
$(MKDIR) $(BUILDDIR)/Game
|
$(MKDIR) $(BUILDDIR)/Game
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(GAMELIBS_OBJS) $(RES_GAMELIB_OUT) $(GAME_OBJS) $(RES_GAME_OUT)
|
$(RM) $(GAMELIBS_OBJS) $(RES_GAMELIB_OUT) $(GAME_OBJS) $(RES_GAME_OUT)
|
||||||
|
|
||||||
run: $(BUILDDIR) $(RES_GAME_OUT)
|
run: $(BUILDDIR) $(RES_GAME_OUT)
|
||||||
$(LAUNCHER) ./$(RES_GAME_OUT) debug
|
$(LAUNCHER) ./$(RES_GAME_OUT) debug
|
||||||
|
|
||||||
rebuild: clean all
|
rebuild: clean all
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# GameLib Rules #
|
# GameLib Rules #
|
||||||
#################
|
#################
|
||||||
$(BUILDDIR)/GameLib/Time.o: GameLib/Time.c $(HEADS)
|
$(BUILDDIR)/GameLib/Time.o: GameLib/Time.c $(HEADS)
|
||||||
$(CC) -c GameLib/Time.c -o $(BUILDDIR)/GameLib/Time.o $(CFLAGS)
|
$(CC) -c GameLib/Time.c -o $(BUILDDIR)/GameLib/Time.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/Util.o: GameLib/Util.c $(HEADS)
|
$(BUILDDIR)/GameLib/Util.o: GameLib/Util.c $(HEADS)
|
||||||
$(CC) -c GameLib/Util.c -o $(BUILDDIR)/GameLib/Util.o $(CFLAGS)
|
$(CC) -c GameLib/Util.c -o $(BUILDDIR)/GameLib/Util.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/QuadArray2D.o: GameLib/QuadArray2D.c $(HEADS)
|
$(BUILDDIR)/GameLib/QuadArray2D.o: GameLib/QuadArray2D.c $(HEADS)
|
||||||
$(CC) -c GameLib/QuadArray2D.c -o $(BUILDDIR)/GameLib/QuadArray2D.o $(CFLAGS)
|
$(CC) -c GameLib/QuadArray2D.c -o $(BUILDDIR)/GameLib/QuadArray2D.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/Draw.o: GameLib/Draw.c $(HEADS)
|
$(BUILDDIR)/GameLib/Draw.o: GameLib/Draw.c $(HEADS)
|
||||||
$(CC) -c GameLib/Draw.c -o $(BUILDDIR)/GameLib/Draw.o $(CFLAGS)
|
$(CC) -c GameLib/Draw.c -o $(BUILDDIR)/GameLib/Draw.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/Input.o: GameLib/Input.c $(HEADS)
|
$(BUILDDIR)/GameLib/Input.o: GameLib/Input.c $(HEADS)
|
||||||
$(CC) -c GameLib/Input.c -o $(BUILDDIR)/GameLib/Input.o $(CFLAGS)
|
$(CC) -c GameLib/Input.c -o $(BUILDDIR)/GameLib/Input.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/Audio.o: GameLib/Audio.c $(HEADS)
|
$(BUILDDIR)/GameLib/Audio.o: GameLib/Audio.c $(HEADS)
|
||||||
$(CC) -c GameLib/Audio.c -o $(BUILDDIR)/GameLib/Audio.o $(CFLAGS)
|
$(CC) -c GameLib/Audio.c -o $(BUILDDIR)/GameLib/Audio.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/Entity.o: GameLib/Entity.c $(HEADS)
|
$(BUILDDIR)/GameLib/Entity.o: GameLib/Entity.c $(HEADS)
|
||||||
$(CC) -c GameLib/Entity.c -o $(BUILDDIR)/GameLib/Entity.o $(CFLAGS)
|
$(CC) -c GameLib/Entity.c -o $(BUILDDIR)/GameLib/Entity.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/Anim.o: GameLib/Anim.c $(HEADS)
|
$(BUILDDIR)/GameLib/Anim.o: GameLib/Anim.c $(HEADS)
|
||||||
$(CC) -c GameLib/Anim.c -o $(BUILDDIR)/GameLib/Anim.o $(CFLAGS)
|
$(CC) -c GameLib/Anim.c -o $(BUILDDIR)/GameLib/Anim.o $(CFLAGS)
|
||||||
$(BUILDDIR)/GameLib/GameLib.o: GameLib/GameLib.c $(HEADS)
|
$(BUILDDIR)/GameLib/GameLib.o: GameLib/GameLib.c $(HEADS)
|
||||||
$(CC) -c GameLib/GameLib.c -o $(BUILDDIR)/GameLib/GameLib.o $(CFLAGS)
|
$(CC) -c GameLib/GameLib.c -o $(BUILDDIR)/GameLib/GameLib.o $(CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Game Rules #
|
# Game Rules #
|
||||||
##############
|
##############
|
||||||
|
|
||||||
$(BUILDDIR)/Game/GameEnts.o: Game/GameEnts.c $(HEADS)
|
$(BUILDDIR)/Game/GameEnts.o: Game/GameEnts.c $(HEADS)
|
||||||
$(CC) -c Game/GameEnts.c -o $(BUILDDIR)/Game/GameEnts.o $(CFLAGS)
|
$(CC) -c Game/GameEnts.c -o $(BUILDDIR)/Game/GameEnts.o $(CFLAGS)
|
||||||
|
|
||||||
$(BUILDDIR)/Game/GameMap.o: Game/GameMap.c $(HEADS)
|
$(BUILDDIR)/Game/GameMap.o: Game/GameMap.c $(HEADS)
|
||||||
$(CC) -c Game/GameMap.c -o $(BUILDDIR)/Game/GameMap.o $(CFLAGS)
|
$(CC) -c Game/GameMap.c -o $(BUILDDIR)/Game/GameMap.o $(CFLAGS)
|
||||||
|
|
||||||
$(BUILDDIR)/Game/main.o: Game/main.c $(HEADS)
|
$(BUILDDIR)/Game/main.o: Game/main.c $(HEADS)
|
||||||
$(CC) -c Game/main.c -o $(BUILDDIR)/Game/main.o $(CFLAGS)
|
$(CC) -c Game/main.c -o $(BUILDDIR)/Game/main.o $(CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# Result Rules #
|
# Result Rules #
|
||||||
################
|
################
|
||||||
|
|
||||||
$(RES_GAMELIB_OUT): $(GAMELIBS_OBJS)
|
$(RES_GAMELIB_OUT): $(GAMELIBS_OBJS)
|
||||||
$(AR) rcs $(RES_GAMELIB_OUT) $(GAMELIBS_OBJS)
|
$(AR) rcs $(RES_GAMELIB_OUT) $(GAMELIBS_OBJS)
|
||||||
|
|
||||||
$(RES_GAME_OUT): $(RES_GAMELIB_OUT) $(GAME_OBJS)
|
$(RES_GAME_OUT): $(RES_GAMELIB_OUT) $(GAME_OBJS)
|
||||||
$(CC) $(GAME_OBJS) $(RES_GAMELIB_OUT) -o $(RES_GAME_OUT) $(LIBS) $(CFLAGS) $(LDFLAGS)
|
$(CC) $(GAME_OBJS) $(RES_GAMELIB_OUT) -o $(RES_GAME_OUT) $(LIBS) $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +1,63 @@
|
|||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
################## ##
|
################## ##
|
||||||
###############
|
###############
|
||||||
#############
|
#############
|
||||||
#############
|
#############
|
||||||
##############
|
##############
|
||||||
########## ###
|
########## ###
|
||||||
######### ###
|
######### ###
|
||||||
######## P ##
|
######## P ##
|
||||||
######## ##
|
######## ##
|
||||||
######## ## |||||
|
######## ## |||||
|
||||||
########
|
########
|
||||||
#########
|
#########
|
||||||
##########
|
##########
|
||||||
###########
|
###########
|
||||||
############
|
############
|
||||||
#############
|
#############
|
||||||
######## ## #
|
######## ## #
|
||||||
######### ###
|
######### ###
|
||||||
######## ## #
|
######## ## #
|
||||||
#############
|
#############
|
||||||
#############
|
#############
|
||||||
########
|
########
|
||||||
##########
|
##########
|
||||||
########
|
########
|
||||||
###########
|
###########
|
||||||
########
|
########
|
||||||
########
|
########
|
||||||
############
|
############
|
||||||
########
|
########
|
||||||
#############
|
#############
|
||||||
########
|
########
|
||||||
########
|
########
|
||||||
######## #
|
######## #
|
||||||
######## #
|
######## #
|
||||||
########
|
########
|
||||||
########
|
########
|
||||||
########
|
########
|
||||||
########
|
########
|
||||||
#########
|
#########
|
||||||
########
|
########
|
||||||
########
|
########
|
||||||
#########
|
#########
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
######################
|
######################
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ case "$uname" in
|
|||||||
cflags="-Dmain=SDL_main -lmingw32 -lSDLmain -lSDL -mwindows -g"
|
cflags="-Dmain=SDL_main -lmingw32 -lSDLmain -lSDL -mwindows -g"
|
||||||
builddir="build-mingw"
|
builddir="build-mingw"
|
||||||
platform="win32"
|
platform="win32"
|
||||||
|
exeextension=".exe"
|
||||||
;;
|
;;
|
||||||
*EMSCRIPTEN*)
|
*EMSCRIPTEN*)
|
||||||
# Configuracion de Emscripten
|
# Configuracion de Emscripten
|
||||||
@@ -27,6 +28,7 @@ case "$uname" in
|
|||||||
cflags="-s FULL_ES2=1 -s ASM_JS=1 -Wno-implicit-function-declaration"
|
cflags="-s FULL_ES2=1 -s ASM_JS=1 -Wno-implicit-function-declaration"
|
||||||
builddir="build-emscripten"
|
builddir="build-emscripten"
|
||||||
platform="emscripten"
|
platform="emscripten"
|
||||||
|
exeextension=".html"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Configuracion de Linux
|
# Configuracion de Linux
|
||||||
@@ -34,6 +36,7 @@ case "$uname" in
|
|||||||
cflags="-Wall -g -I/usr/include/ -I/usr/include/SDL/ -I/usr/X11R6/include/"
|
cflags="-Wall -g -I/usr/include/ -I/usr/include/SDL/ -I/usr/X11R6/include/"
|
||||||
builddir="build-linux-$unamem"
|
builddir="build-linux-$unamem"
|
||||||
platform="linux-$unamem"
|
platform="linux-$unamem"
|
||||||
|
exeextension=""
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -63,6 +66,9 @@ while test $# -gt 0; do
|
|||||||
--platform)
|
--platform)
|
||||||
echo "$platform"
|
echo "$platform"
|
||||||
;;
|
;;
|
||||||
|
--exe-extension)
|
||||||
|
echo "$exeextension"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "${usage}" 1>&2
|
echo "${usage}" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user