Include C++ building for olcGameEngine

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
sigonasr2 2022-08-21 21:45:06 -05:00
parent ba6af6dad3
commit f512eb5f67
9 changed files with 6260 additions and 10 deletions

7
C++/scripts/build.sh Executable file
View File

@ -0,0 +1,7 @@
#Compiles the entire program then runs it, producing an executable.
#C
printf "Running program...\n\n\n"
if g++ $(find . -type f -name "*.cpp") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
./${PROJECT_NAME} "$@"
fi
printf "\n\n"

20
C++/scripts/commit.sh Executable file
View File

@ -0,0 +1,20 @@
#Adds a commit message and pushes project to github repository.
#C
COMMIT_MESSAGE="$*"
FIRST_LINE=true
while IFS= read -r line
do
if [ "$FIRST_LINE" = true ]; then
COMMIT_MESSAGE+="
Co-authored-by: $line"
FIRST_LINE=false
else
COMMIT_MESSAGE+="
Co-authored-by: $line"
fi
done < utils/.coauthors
git add -u
git add *
git commit -m "$COMMIT_MESSAGE"
git push

Binary file not shown.

5
main.c
View File

@ -1,5 +0,0 @@
#include <stdio.h>
int main(int argc,char**argv) {
printf("Hello World!");
}

37
main.cpp Normal file
View File

@ -0,0 +1,37 @@
#define OLC_PGE_APPLICATION
#include "pixelGameEngine.h"
class Example : public olc::PixelGameEngine
{
public:
Example()
{
sAppName = "Example";
}
public:
bool OnUserCreate() override
{
// Called once at the start, so create things here
return true;
}
bool OnUserUpdate(float fElapsedTime) override
{
// called once per frame
for (int x = 0; x < ScreenWidth(); x++)
for (int y = 0; y < ScreenHeight(); y++)
Draw(x, y, olc::Pixel(rand() % 255, rand() % 255, rand()% 255));
return true;
}
};
int main()
{
Example demo;
if (demo.Construct(256, 240, 4, 4))
demo.Start();
return 0;
}

6191
pixelGameEngine.h Normal file

File diff suppressed because it is too large Load Diff

4
sig
View File

@ -3,7 +3,7 @@ export AUTO_UPDATE=true
source utils/define.sh
define PROJECT_NAME "CProjectTemplate"
define CUSTOM_PARAMS "-lncurses"
define LANGUAGE "C"
define CUSTOM_PARAMS "-lpng -lGL -lX11"
define LANGUAGE "C++"
source utils/main.sh

View File

@ -25,4 +25,4 @@ if [ -z "$1" ]
exit
fi
./$LANGUAGE/scripts/$1.sh "${*:2}"
./$LANGUAGE/scripts/$1.sh "${@:2}"

View File

@ -1,4 +1,4 @@
define.sh:3ecab0dffe2adfb950f3eb7c7061b750 -
main.sh:d3d1bd0b56d8114eb7479964227f8576 -
search.sh:81d08f5ff48e8a44b5f68387d426da05 -
main.sh:4e6e9f0650ec790ce2c4364db94f0caa -
search.sh:30e1842e9a13452ea883bb6516d28e1c -
.updateDirectories:fa5e95db12be22ae8aed7ecbc560e38c -