* create should return bool

This commit is contained in:
Phillip Stephens 2015-04-18 16:12:22 -07:00
parent 0d1fae7aae
commit fd3a3d7f25
5 changed files with 37 additions and 4 deletions

View File

@ -11,6 +11,9 @@ public:
CGLXContext();
virtual ~CGLXContext() {}
bool create();
void setMajorVersion(const int& maj) override;
void setMinVersion(const int& min) override;
const std::string version() const override;
const std::string name() const override;
int depthSize() const override;
@ -18,8 +21,10 @@ public:
int greenDepth() const override;
int blueDepth() const override;
private:
int m_minVersion;
int m_majVersion;
int m_minVersion;
Display* m_display;
};

View File

@ -7,10 +7,10 @@ class IContext
{
public:
virtual ~IContext() {}
virtual void setMinVersion (const int& min)=0;
virtual void setMajorVersion(const int& maj)=0;
virtual void create();
virtual bool create()=0;
virtual const std::string version() const=0;
virtual const std::string name() const=0;
virtual int depthSize() const=0;
@ -19,4 +19,4 @@ public:
virtual int blueDepth() const=0;
};
#endif // ICONTEXT_HPP
#endif // ICONTEXT_HPP

View File

@ -1,5 +1,8 @@
CONFIG -= Qt
CONFIG += app c++11
unix:CONFIG += link_pkgconfig
unix:PKGCONFIG += x11
include(libBoo.pri)
include(test/test.pri)

View File

@ -2,10 +2,28 @@
#include <iostream>
CGLXContext::CGLXContext()
: m_majVersion(3),
m_minVersion(3),
m_display(nullptr)
{
std::cout << "Hello from GLX" << std::endl;
}
bool CGLXContext::create()
{
return true;
}
void CGLXContext::setMinVersion(const int& min)
{
m_minVersion = min;
}
void CGLXContext::setMajorVersion(const int& maj)
{
m_majVersion = maj;
}
const std::string CGLXContext::version() const
{
return "Invalid version";

View File

@ -4,5 +4,12 @@
int main(int argc, char** argv)
{
IContext* ctx = new CContext;
if (ctx->create())
{
}
delete ctx;
return 0;
}