diff --git a/CGLXContext.cpp b/CGLXContext.cpp new file mode 100644 index 0000000..59fed1b --- /dev/null +++ b/CGLXContext.cpp @@ -0,0 +1,37 @@ +#include "CGLXContext.hpp" +#include + +CGLXContext::CGLXContext() +{ + std::cout << "Hello from GLX" << std::endl; +} + +const std::string CGLXContext::version() const +{ + return "Invalid version"; +} + +const std::string CGLXContext::name() const +{ + return "GLX Context"; +} + +int CGLXContext::depthSize() const +{ + return -1; +} + +int CGLXContext::redDepth() const +{ + return -1; +} + +int CGLXContext::greenDepth() const +{ + return -1; +} + +int CGLXContext::blueDepth() const +{ + return -1; +} diff --git a/CGLXContext.hpp b/CGLXContext.hpp new file mode 100644 index 0000000..7375267 --- /dev/null +++ b/CGLXContext.hpp @@ -0,0 +1,24 @@ +#ifndef CGLXCONTEXT_HPP +#define CGLXCONTEXT_HPP + +#include + +#include + +class CGLXContext : public IContext +{ +public: + CGLXContext(); + virtual ~CGLXContext() {} + + const std::string version() const override; + const std::string name() const override; + int depthSize() const override; + int redDepth() const override; + int greenDepth() const override; + int blueDepth() const override; +}; + + + +#endif // CGLXCONTEXT_HPP diff --git a/IContext.cpp b/IContext.cpp deleted file mode 100644 index ac6820a..0000000 --- a/IContext.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "CContext.hpp" - -CContext::CContext() -{ - -} - -CContext::~CContext() -{ - -} - diff --git a/IContext.hpp b/IContext.hpp index 76d1064..35c9f50 100644 --- a/IContext.hpp +++ b/IContext.hpp @@ -1,12 +1,19 @@ #ifndef ICONTEXT_HPP #define ICONTEXT_HPP +#include class IContext { public: - IContext(); - ~IContext(); + virtual ~IContext() {} + + virtual const std::string version() const=0; + virtual const std::string name() const=0; + virtual int depthSize() const=0; + virtual int redDepth() const=0; + virtual int greenDepth() const=0; + virtual int blueDepth() const=0; }; #endif // ICONTEXT_HPP diff --git a/libBoo.hpp b/libBoo.hpp new file mode 100644 index 0000000..76d1ae7 --- /dev/null +++ b/libBoo.hpp @@ -0,0 +1,16 @@ +#ifndef LIBBOO_HPP +#define LIBBOO_HPP + +#include "IContext.hpp" + +#if defined(_WIN32) +#error "No support for WGL" +#elif defined(__APPLE__) +#error "No support for Apple GL" +#elif __linux__ +#include "CGLXContext.hpp" +typedef CGLXContext CContext; +#endif + +#endif // LIBBOO_HPP + diff --git a/libBoo.pro b/libBoo.pro index 81532a4..1c3df2d 100644 --- a/libBoo.pro +++ b/libBoo.pro @@ -1,5 +1,11 @@ +CONFIG -= Qt +CONFIG += app c++11 + HEADERS += \ - IContext.hpp + IContext.hpp \ + CGLXContext.hpp \ + libBoo.hpp SOURCES += \ - IContext.cpp + CGLXContext.cpp \ + main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..214c9d3 --- /dev/null +++ b/main.cpp @@ -0,0 +1,12 @@ +#include "libBoo.hpp" +#include + +int main(int argc, char* argv[]) +{ + IContext* context = new CContext(); + + std::cout << context->name() << std::endl; + std::cout << context->version() << std::endl; + std::cout << context->depthSize() << std::endl; + delete context; +}