diff --git a/Makefile.am b/Makefile.am index 1f8bbec..493f3aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,13 @@ +# Allow directory manangement of source AUTOMAKE_OPTIONS = subdir-objects +# Use m4 directory (modern best practice) +ACLOCAL_AMFLAGS = -I m4 --install bin_PROGRAMS = Game Game_SOURCES = \ - src/main.cpp + src/main.cpp \ + src/Error.h \ + src/Error.cpp Game_CPPFLAGS = @sdl2_CFLAGS@ @glew_CFLAGS@ @opengl_CFLAGS@ Game_LDFLAGS = @sdl2_LIBS@ @glew_LIBS@ @opengl_LIBS@ diff --git a/configure.ac b/configure.ac index c000e02..eb817fb 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ AC_INIT([Game], [0.0.1], [wytau@sdf.org]) AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_CONFIG_MACRO_DIR([m4]) # Checks for programs. AC_PROG_CXX diff --git a/src/Error.cpp b/src/Error.cpp new file mode 100644 index 0000000..19f3fb7 --- /dev/null +++ b/src/Error.cpp @@ -0,0 +1,4 @@ +#include "Error.h" +#include + +Error::Error(std::string location) { object = location; } diff --git a/src/Error.h b/src/Error.h new file mode 100644 index 0000000..d798030 --- /dev/null +++ b/src/Error.h @@ -0,0 +1,11 @@ +#pragma once +#include + +class Error { +private: + // this string gives us the name of the object the error occured in + std::string object; + +public: + Error(std::string location); +}; diff --git a/src/main.cpp b/src/main.cpp index 6ebc8c6..f9c8319 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,13 +14,20 @@ const char *fragmentShaderSource = " FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n" "}\0"; -//#include +// Include Config header generated by GNU autotools +#include "../config.h" #include // Make sure Glew is loaded first #include #include #include +// Include error class +#include "Error.h" +#include +// TODO: Remove check that error class was included properly +Error error("main"); + // TODO: Create Error handling class int main(int argc, char **argv) {