Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation errors #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ set(CMAKE_MODULE_PATH "${opendf_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")

include(CheckCXXCompilerFlag)

check_cxx_compiler_flag(-std=c++11 HAVE_STD_CXX11)
if(HAVE_STD_CXX11)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
check_cxx_compiler_flag(-std=c++17 HAVE_STD_CXX17)
if(HAVE_STD_CXX17)
set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
endif()

if(MSVC)
Expand Down
1 change: 1 addition & 0 deletions src/bsatool/bsatool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <iomanip>
#include <cstring>
#include <array>
#include <cstddef>

#include "components/archives/bsaarchive.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/components/archives/bsaarchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <sstream>
#include <fstream>
#include <cstddef>


namespace Archives
Expand Down
1 change: 1 addition & 0 deletions src/components/dfosg/meshloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "meshloader.hpp"

#include <algorithm>
#include <cstddef>

#include <osg/Geode>
#include <osg/Billboard>
Expand Down
2 changes: 2 additions & 0 deletions src/components/dfosg/meshloader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <vector>
#include <map>
#include <cstdint>
#include <istream>
#include <cstddef>


namespace osg
Expand Down
1 change: 1 addition & 0 deletions src/components/dfosg/texloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <sstream>
#include <iomanip>
#include <cstddef>

#include <osg/Image>

Expand Down
8 changes: 4 additions & 4 deletions src/components/mygui_osg/datamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DataStream : public MyGUI::IDataStream {
namespace MyGUI_OSG
{

MyGUI::IDataStream *DataManager::getData(const std::string &_name)
MyGUI::IDataStream *DataManager::getData(const std::string &_name) const
{
VFS::IStreamPtr stream = VFS::Manager::get().open(_name.c_str());
if(!stream) return nullptr;
Expand All @@ -68,12 +68,12 @@ void DataManager::freeData(MyGUI::IDataStream *_data)
delete _data;
}

bool DataManager::isDataExist(const std::string &_name)
bool DataManager::isDataExist(const std::string &_name) const
{
return VFS::Manager::get().exists(_name.c_str());
}

const MyGUI::VectorString &DataManager::getDataListNames(const std::string &_pattern)
const MyGUI::VectorString &DataManager::getDataListNames(const std::string &_pattern) const
{
static MyGUI::VectorString namelist;

Expand All @@ -84,7 +84,7 @@ const MyGUI::VectorString &DataManager::getDataListNames(const std::string &_pat
return namelist;
}

const std::string &DataManager::getDataPath(const std::string &_name)
const std::string &DataManager::getDataPath(const std::string &_name) const
{
static std::string path;

Expand Down
13 changes: 8 additions & 5 deletions src/components/mygui_osg/datamanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,35 @@ namespace MyGUI_OSG
class DataManager : public MyGUI::DataManager {
public:

DataManager() {};
virtual ~DataManager() {};

/** Get data stream from specified resource name.
@param _name Resource name (usually file name).
*/
virtual MyGUI::IDataStream* getData(const std::string &_name) final;
virtual MyGUI::IDataStream* getData(const std::string& _name) const;

/** Free data stream.
@param _data Data stream.
*/
virtual void freeData(MyGUI::IDataStream *_data) final;
virtual void freeData(MyGUI::IDataStream* _data);

/** Is data with specified name exist.
@param _name Resource name.
*/
virtual bool isDataExist(const std::string &_name) final;
virtual bool isDataExist(const std::string& _name) const;

/** Get all data names with names that matches pattern.
@param _pattern Pattern to match (for example "*.layout").
*/
virtual const MyGUI::VectorString &getDataListNames(const std::string &_pattern) final;
virtual const MyGUI::VectorString& getDataListNames(const std::string& _pattern) const;

/** Get full path to data.
@param _name Resource name.
@return Return full path to specified data.
For example getDataPath("My.layout") might return "C:\path\to\project\data\My.layout"
*/
virtual const std::string &getDataPath(const std::string &_name) final;
virtual const std::string& getDataPath(const std::string& _name) const;
};

} // namespace MyGUI_OSG
Expand Down
2 changes: 0 additions & 2 deletions src/components/mygui_osg/diagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#define MYGUI_PLATFORM_EXCEPT(dest) do { \
MYGUI_PLATFORM_LOG(Critical, dest); \
MYGUI_DBG_BREAK;\
std::ostringstream stream; \
stream << dest << "\n"; \
MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \
Expand All @@ -25,7 +24,6 @@
if ( ! (exp) ) \
{ \
MYGUI_PLATFORM_LOG(Critical, dest); \
MYGUI_DBG_BREAK;\
std::ostringstream stream; \
stream << dest << "\n"; \
MYGUI_BASE_EXCEPT(stream.str().c_str(), "MyGUI"); \
Expand Down
13 changes: 10 additions & 3 deletions src/components/mygui_osg/rendermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget
virtual const MyGUI::IntSize& getViewSize() const { return mViewSize; }

/** @see RenderManager::getVertexFormat */
virtual MyGUI::VertexColourType getVertexFormat() { return mVertexFormat; }
virtual MyGUI::VertexColourType getVertexFormat() const { return mVertexFormat; }

/** @see RenderManager::isFormatSupported */
virtual bool isFormatSupported(MyGUI::PixelFormat format, MyGUI::TextureUsage usage);
Expand All @@ -82,11 +82,18 @@ class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget
/** @see IRenderTarget::doRender */
virtual void doRender(MyGUI::IVertexBuffer *buffer, MyGUI::ITexture *texture, size_t count);
/** @see IRenderTarget::getInfo */
virtual const MyGUI::RenderTargetInfo& getInfo() { return mInfo; }
virtual const MyGUI::RenderTargetInfo& getInfo() const { return mInfo; }

/*internal:*/
void drawFrame(osg::RenderInfo &renderInfo);
void setViewSize(int width, int height);
virtual void setViewSize(int width, int height);


// Fake
virtual void registerShader(
const std::string& _shaderName,
const std::string& _vertexProgramFile,
const std::string& _fragmentProgramFile) {};
};

} // namespace MyGUI_OSG
Expand Down
6 changes: 3 additions & 3 deletions src/components/mygui_osg/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void Texture::saveToFile(const std::string &fname)
}


int Texture::getWidth()
int Texture::getWidth() const
{
if(!mTexture.valid())
return 0;
Expand All @@ -142,7 +142,7 @@ int Texture::getWidth()
return mTexture->getTextureWidth();
}

int Texture::getHeight()
int Texture::getHeight() const
{
if(!mTexture.valid())
return 0;
Expand Down Expand Up @@ -182,7 +182,7 @@ void Texture::unlock()
mLockedImage = nullptr;
}

bool Texture::isLocked()
bool Texture::isLocked() const
{
return mLockedImage.valid();
}
Expand Down
16 changes: 10 additions & 6 deletions src/components/mygui_osg/texture.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef COMPONENTS_MYGUI_OSG_TEXTURE_H
#define COMPONENTS_MYGUI_OSG_TEXTURE_H

#include <cstddef>
#include <MYGUI/MyGUI_ITexture.h>

#include <osg/ref_ptr>
Expand Down Expand Up @@ -37,19 +38,22 @@ class Texture : public MyGUI::ITexture {

virtual void* lock(MyGUI::TextureUsage access);
virtual void unlock();
virtual bool isLocked();
virtual bool isLocked() const;

virtual int getWidth();
virtual int getHeight();
virtual int getWidth() const;
virtual int getHeight() const;

virtual MyGUI::PixelFormat getFormat() { return mFormat; }
virtual MyGUI::TextureUsage getUsage() { return mUsage; }
virtual size_t getNumElemBytes() { return mNumElemBytes; }
virtual MyGUI::PixelFormat getFormat() const { return mFormat; }
virtual MyGUI::TextureUsage getUsage() const { return mUsage; }
virtual size_t getNumElemBytes() const { return mNumElemBytes; }

virtual MyGUI::IRenderTarget *getRenderTarget();

/*internal:*/
osg::Texture2D *getTexture() const { return mTexture.get(); }

//fake
virtual void setShader(const std::string& _shaderName) {};
};

} // namespace MyGUI_OSG
Expand Down
2 changes: 1 addition & 1 deletion src/components/mygui_osg/vertexbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void VertexBuffer::setVertexCount(size_t count)
create();
}

size_t VertexBuffer::getVertexCount()
size_t VertexBuffer::getVertexCount() const
{
return mNeedVertexCount;
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/mygui_osg/vertexbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define COMPONENTS_MYGUI_OSG_VERTEXBUFFER_H

#include <vector>
#include <cstddef>

#include <MYGUI/MyGUI_IVertexBuffer.h>

Expand All @@ -27,7 +28,7 @@ class VertexBuffer : public MyGUI::IVertexBuffer {
virtual ~VertexBuffer();

virtual void setVertexCount(size_t count);
virtual size_t getVertexCount();
virtual size_t getVertexCount() const;

virtual MyGUI::Vertex *lock();
virtual void unlock();
Expand Down
2 changes: 2 additions & 0 deletions src/components/resource/meshmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define COMPONENTS_RESOURCE_MESHMANAGER_HPP

#include <map>
#include <cstddef>


#include <osg/ref_ptr>

Expand Down
1 change: 1 addition & 0 deletions src/components/resource/texturemanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <array>
#include <map>
#include <cstdint>
#include <cstddef>

#include <osg/ref_ptr>
#include <osg/observer_ptr>
Expand Down
5 changes: 1 addition & 4 deletions src/components/sdlutil/graphicswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,6 @@ class SDL2WindowingSystemInterface : public osg::GraphicsContext::WindowingSyste
};

// declare C entry point for static compilation.
extern "C" void graphicswindow_SDL2(void)
{
osg::GraphicsContext::setWindowingSystemInterface(new SDL2WindowingSystemInterface);
}
REGISTER_WINDOWINGSYSTEMINTERFACE(SDL2, SDL2WindowingSystemInterface);

}