Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

game-of-spiders - Game of Life implementation #77

Open
wants to merge 15 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
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Base directories
/bin
/lib
/build
/work

# prepend '__' to create temp files/dirs
__*

Expand All @@ -16,6 +10,7 @@ __*
.#*
notes*
TAGS
*.swp

# Haskell-related #
###################
Expand Down
1 change: 1 addition & 0 deletions Authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ The Red Spider Project -- Authors.txt

(Please add your name at the top.)

Charles Mita
Harry Gilles
Julian Gonggrijp
3 changes: 3 additions & 0 deletions bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Ignore this directory except this file
*
!.gitignore
3 changes: 3 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Ignore this directory except this file
*
!.gitignore
37 changes: 37 additions & 0 deletions include/rsTerminal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef RS_TERMINAL_H
#define RS_TERMINAL_H
#include "rsTypes.h"
#ifdef _WIN32
#include <Windows.h>
#endif


enum terminalColours_t {
COLOUR_DEFAULT = 0,
COLOUR_BLUE = 1,
COLOUR_GREEN = 2,
COLOUR_RED = 4,
COLOUR_WHITE = 8
};

class rsTerminal
{
public:
rsTerminal();
~rsTerminal();
void ClearTerminal();
void SetCursorPosition( rsCOORD_t pos );
void SetTextColour( int terminalColour );
//void PrintText( const char * text );
void SetToDefault();
void HideCursor();
void ShowCursor();
private:
#ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO defaultBufferInfo;
HANDLE hStdOut;
#endif

};

#endif
9 changes: 9 additions & 0 deletions include/rsTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef RS_TYPES_H
#define RS_TYPES_H

struct rsCOORD_t {
int x;
int y;
};

#endif
3 changes: 3 additions & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Ignore this directory except this file
*
!.gitignore
23 changes: 23 additions & 0 deletions src/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CC=g++
CFLAGS=-O3 -I../include -std=c++11 -pthread

IDIR = ../include
ODIR = ../build
BDIR = ../bin

_DEPS = rsTypes.h rsTerminal.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = rsGameOfLife.o rsTerminal.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

$(ODIR)/%.o: %.cpp $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

gameofspiders: $(OBJ)
$(CC) -o $(BDIR)/$@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~d
Loading