added error class. (need better method of class discovery)
This commit is contained in:
parent
16d54ea956
commit
b091a1a637
5 changed files with 30 additions and 2 deletions
|
|
@ -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@
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
4
src/Error.cpp
Normal file
4
src/Error.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#include "Error.h"
|
||||
#include <string>
|
||||
|
||||
Error::Error(std::string location) { object = location; }
|
||||
11
src/Error.h
Normal file
11
src/Error.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Error {
|
||||
private:
|
||||
// this string gives us the name of the object the error occured in
|
||||
std::string object;
|
||||
|
||||
public:
|
||||
Error(std::string location);
|
||||
};
|
||||
|
|
@ -14,13 +14,20 @@ const char *fragmentShaderSource =
|
|||
" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
|
||||
"}\0";
|
||||
|
||||
//#include <iostream>
|
||||
// Include Config header generated by GNU autotools
|
||||
#include "../config.h"
|
||||
#include <GL/glew.h>
|
||||
// Make sure Glew is loaded first
|
||||
#include <GL/gl.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_opengl.h>
|
||||
|
||||
// Include error class
|
||||
#include "Error.h"
|
||||
#include <string>
|
||||
// TODO: Remove check that error class was included properly
|
||||
Error error("main");
|
||||
|
||||
// TODO: Create Error handling class
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue