summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-01-10 18:39:27 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-01-10 18:39:27 +0100
commitbdce9a52170f1a3535c290a379e4cb9f509614ec (patch)
tree8791a6c18770b9027d172b68811b1af8a5b2f4c5
parent66da4ff4d64af1a06110fa3c6c26af14724c419c (diff)
downloadtermgl-bdce9a52170f1a3535c290a379e4cb9f509614ec.tar.gz
Makefile generates version.h
-rw-r--r--.gitignore1
-rw-r--r--Makefile16
-rw-r--r--main.cpp13
3 files changed, 28 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index bd1caef..d1b97a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*.o
build/*
bin/*
+version.h
diff --git a/Makefile b/Makefile
index 7bc7774..c31e565 100644
--- a/Makefile
+++ b/Makefile
@@ -3,10 +3,13 @@ CFLAGS = -Wall -g -std=c++11 -Werror=missing-prototypes
LDFLAGS =
OUTPUT = Engine
BUILDDIR = build
+#VERSION
+VERSION = 0
+PATCHLEVEL = 1
OBJ = main.o cObject.o cObjectHandler.o cRender.o cInput.o
-debug: $(OBJ)
+debug: genversion $(OBJ)
mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -o $(BUILDDIR)/$(OUTPUT) $(OBJ) $(LDFLAGS)
@@ -22,7 +25,16 @@ all: clean debug
.PHONY: clean
clean:
- rm -df $(BUILDDIR)/$(OUTPUT) *.o
+ rm -df $(BUILDDIR)/$(OUTPUT) *.o version.h
run: debug
./$(BUILDDIR)/$(OUTPUT)
+
+genversion:
+ @echo Building Version
+ @echo "//Generated my MAKEFILE. DO NOT Edit." > version.h
+ @echo "#pragma once" >> version.h
+ @echo "#define VERSION $(VERSION)" >> version.h
+ @echo "#define PATCHLEVEL $(PATCHLEVEL)" >> version.h
+ @echo "#define DATE \"`date +'%d.%m.20%y'`\"" >> version.h
+ @echo "#define TIME \"`date +'%H:%M:%S'`\"" >> version.h
diff --git a/main.cpp b/main.cpp
index 94f834c..71e893d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,4 +1,7 @@
#include <unistd.h>
+#include <string>
+
+#include "version.h"
#include "cRender.h"
#include "cObject.h"
@@ -11,7 +14,9 @@ int main()
{
cRender render(' ', _COL_DEFAULT, 30,30);
cObjectHandler handler(&render);
+ cObject ver(30,1);
testobject obj;
+
cInput input;
render.render();
@@ -19,6 +24,14 @@ int main()
int iobj = handler.createObject((cObject*)&obj);
handler.moveObject(iobj, {10,10}, _MOVE_ABSOLUTE);
+ ver.drawPoint('v', {0,0}, true, _COL_WHITE);
+ ver.drawPoint(VERSION + 48, {1,0}, true, _COL_WHITE);
+ ver.drawPoint('.', {2,0}, true, _COL_WHITE);
+ ver.drawPoint(PATCHLEVEL + 48, {3,0}, true, _COL_WHITE);
+ ver.drawText(DATE, {5,0}, _COL_WHITE);
+ int iver = handler.createObject(&ver);
+ handler.moveObject(iver, {0,0}, _MOVE_ABSOLUTE);
+
while(1)
{
sInputEvent ie = input.poll();