Skip to content

Commit

Permalink
Update for latest version of Idlib
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelheilmann committed Nov 21, 2017
1 parent 48327cf commit e5b58b8
Show file tree
Hide file tree
Showing 107 changed files with 594 additions and 3,764 deletions.
3 changes: 1 addition & 2 deletions cartman/src/cartman/cartman_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "cartman/cartman_typedef.h"
#include "cartman/cartman_math.h"
#include "egolib/Core/Singleton.hpp"

//--------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -77,7 +76,7 @@ inline uint32_t make_rgba(const std::shared_ptr<const SDL_Surface>& surface, con

extern camera_t cam;

struct Resources : Ego::Core::Singleton<Resources> {
struct Resources : id::singleton<Resources> {
std::shared_ptr<SDL_Surface> bmphitemap; // Heightmap image
std::shared_ptr<Ego::Texture> tx_point; // Vertex image
std::shared_ptr<Ego::Texture> tx_pointon; // Vertex image ( select_vertsed )
Expand Down
6 changes: 3 additions & 3 deletions cartman/src/cartman/cartman_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ struct Window {

namespace Cartman { namespace Gui {

struct Manager : public Ego::Core::Singleton<Manager> {
struct Manager : public id::singleton<Manager> {
protected:
friend struct Ego::Core::CreateFunctor<Manager>;
friend struct Ego::Core::DestroyFunctor<Manager>;
friend id::default_new_functor<Manager>;
friend id::default_delete_functor<Manager>;
Manager();
~Manager();
public:
Expand Down
6 changes: 3 additions & 3 deletions cartman/src/cartman/cartman_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ namespace Cartman

namespace Cartman
{
struct Input : Ego::Core::Singleton<Input>
struct Input : id::singleton<Input>
{
public:
Mouse _mouse;
Keyboard _keyboard;
private:
friend Ego::Core::Singleton<Input>::CreateFunctorType;
friend Ego::Core::Singleton<Input>::DestroyFunctorType;
friend id::default_new_functor<Input>;
friend id::default_delete_functor<Input>;
Input();
virtual ~Input();
public:
Expand Down
1 change: 0 additions & 1 deletion egolib/egolib-tests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<ClCompile Include="tests\egolib\Tests\math\enclose.cpp" />
<ClCompile Include="tests\egolib\Tests\math\is_intersecting.cpp" />
<ClCompile Include="tests\egolib\Tests\math\matrix_4f_4f.cpp" />
<ClCompile Include="tests\egolib\Tests\Singleton.cpp" />
<ClCompile Include="tests\egolib\Tests\QuadTree.cpp" />
<ClCompile Include="tests\egolib\Tests\StringUtilities.cpp" />
<ClCompile Include="tests\egolib\Tests\text\document-erase.cpp" />
Expand Down
3 changes: 0 additions & 3 deletions egolib/egolib-tests.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
<ClCompile Include="tests\egolib\Tests\StringUtilities.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tests\egolib\Tests\Singleton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tests\egolib\Tests\QuadTree.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
14 changes: 0 additions & 14 deletions egolib/egolib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -681,26 +681,22 @@
<ClInclude Include="src\egolib\Events\_Include.hpp" />
<ClInclude Include="src\egolib\Events\MouseMovedEventArgs.hpp" />
<ClInclude Include="src\egolib\Math\Functors\is_intersecting_axis_aligned_box_axis_aligned_cube.hpp" />
<ClInclude Include="src\egolib\Math\Discrete.hpp" />
<ClInclude Include="src\egolib\App.hpp" />
<ClInclude Include="src\egolib\Graphics\GraphicsWindow.hpp" />
<ClInclude Include="src\egolib\TrigonometricTable.hpp" />
<ClInclude Include="src\egolib\Math\Ray.hpp" />
<ClInclude Include="src\egolib\Graphics\IndexBuffer.hpp" />
<ClInclude Include="src\egolib\Graphics\IndexDescriptor.hpp" />
<ClInclude Include="src\egolib\Graphics\VertexDescriptor.hpp" />
<ClInclude Include="src\egolib\Math\VectorProjection.hpp" />
<ClInclude Include="src\egolib\Math\VectorRejection.hpp" />
<ClInclude Include="src\egolib\Profiles\GenderProfile.hpp" />
<ClInclude Include="src\egolib\Math\Line.hpp" />
<ClInclude Include="src\egolib\AI\AStar.hpp" />
<ClInclude Include="src\egolib\Graphics\Buffer.hpp" />
<ClInclude Include="src\egolib\Graphics\VertexElementDescriptor.hpp" />
<ClInclude Include="src\egolib\Graphics\GraphicsSystem.hpp" />
<ClInclude Include="src\egolib\Renderer\OpenGL\StencilBuffer.hpp" />
<ClInclude Include="src\egolib\Renderer\RendererInfo.hpp" />
<ClInclude Include="src\egolib\Graphics\ColourDepth.hpp" />
<ClInclude Include="src\egolib\Core\Singleton.hpp" />
<ClInclude Include="src\egolib\Logic\TreasureTables.hpp" />
<ClInclude Include="src\egolib\Logic\MissileTreatment.hpp" />
<ClInclude Include="src\egolib\Renderer\TextureSampler.hpp" />
Expand Down Expand Up @@ -730,24 +726,17 @@
<ClInclude Include="src\egolib\Graphics\Camera.hpp" />
<ClInclude Include="src\egolib\Math\Transform.hpp" />
<ClInclude Include="src\egolib\Math\Matrix.hpp" />
<ClInclude Include="src\egolib\Math\OrderedField.hpp" />
<ClInclude Include="src\egolib\Logic\Attribute.hpp" />
<ClInclude Include="src\egolib\Logic\Perk.hpp" />
<ClInclude Include="src\egolib\Logic\PerkHandler.hpp" />
<ClInclude Include="src\egolib\Renderer\DeferredTexture.hpp" />
<ClInclude Include="src\egolib\Math\OrderedRing.hpp" />
<ClInclude Include="src\egolib\Math\OrderedIntegralDomain.hpp" />
<ClInclude Include="src\egolib\Renderer\RasterizationMode.hpp" />
<ClInclude Include="src\egolib\Core\QuadTree.hpp" />
<ClInclude Include="src\egolib\Time\LocalTime.hpp" />
<ClInclude Include="src\egolib\Time\SlidingWindow.hpp" />
<ClInclude Include="src\egolib\Time\Stopwatch.hpp" />
<ClInclude Include="src\egolib\Math\VectorSpace.hpp" />
<ClInclude Include="src\egolib\Logic\Team.hpp" />
<ClInclude Include="src\egolib\Math\EuclideanSpace.hpp" />
<ClInclude Include="src\egolib\Math\Scalar.hpp" />
<ClInclude Include="src\egolib\Math\Standard.hpp" />
<ClInclude Include="src\egolib\Math\AxisAlignedBox.hpp" />
<ClInclude Include="src\egolib\VFS\VfsPath.hpp" />
<ClInclude Include="src\egolib\AI\WaypointList.h" />
<ClInclude Include="src\egolib\Graphics\ModelDescriptor.hpp" />
Expand Down Expand Up @@ -821,9 +810,6 @@
<ClInclude Include="src\egolib\Renderer\TextureFilter.hpp" />
<ClInclude Include="src\egolib\Renderer\OpenGL\Renderer.hpp" />
<ClInclude Include="src\egolib\Renderer\Renderer.hpp" />
<ClInclude Include="src\egolib\math\AxisAlignedCube.hpp" />
<ClInclude Include="src\egolib\math\Sphere.hpp" />
<ClInclude Include="src\egolib\math\Plane.hpp" />
<ClInclude Include="src\egolib\math\Random.hpp" />
<ClInclude Include="src\egolib\bbox.h" />
<ClInclude Include="src\egolib\Clock.hpp" />
Expand Down
42 changes: 0 additions & 42 deletions egolib/egolib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,6 @@
<ClInclude Include="src\egolib\Renderer\OpenGL\Renderer.hpp">
<Filter>Header Files\Renderer\OpenGL</Filter>
</ClInclude>
<ClInclude Include="src\egolib\math\Plane.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Renderer\TextureFilter.hpp">
<Filter>Header Files\Renderer</Filter>
</ClInclude>
Expand Down Expand Up @@ -911,18 +908,12 @@
<ClInclude Include="src\egolib\AI\WaypointList.h">
<Filter>Header Files\AI</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Scalar.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Standard.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Logic\Team.hpp">
<Filter>Header Files\Logic</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\VectorSpace.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Cone3.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
Expand Down Expand Up @@ -953,15 +944,6 @@
<ClInclude Include="src\egolib\Logic\PerkHandler.hpp">
<Filter>Header Files\Logic</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\OrderedIntegralDomain.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\OrderedRing.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\OrderedField.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Matrix.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
Expand Down Expand Up @@ -1055,9 +1037,6 @@
<ClInclude Include="src\egolib\Logic\TreasureTables.hpp">
<Filter>Header Files\Logic</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Core\Singleton.hpp">
<Filter>Header Files\Core</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Renderer\RendererInfo.hpp">
<Filter>Header Files\Renderer</Filter>
</ClInclude>
Expand All @@ -1076,9 +1055,6 @@
<ClInclude Include="src\egolib\AI\AStar.hpp">
<Filter>Header Files\AI</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Line.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Graphics\ColourDepth.hpp">
<Filter>Header Files\Graphics</Filter>
</ClInclude>
Expand All @@ -1091,9 +1067,6 @@
<ClInclude Include="src\egolib\Math\VectorRejection.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\EuclideanSpace.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Graphics\VertexDescriptor.hpp">
<Filter>Header Files\Graphics</Filter>
</ClInclude>
Expand All @@ -1103,30 +1076,15 @@
<ClInclude Include="src\egolib\Graphics\IndexBuffer.hpp">
<Filter>Header Files\Graphics</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Ray.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\TrigonometricTable.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\egolib\math\Sphere.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Graphics\GraphicsWindow.hpp">
<Filter>Header Files\Graphics</Filter>
</ClInclude>
<ClInclude Include="src\egolib\App.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\Discrete.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Math\AxisAlignedBox.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\math\AxisAlignedCube.hpp">
<Filter>Header Files\Math</Filter>
</ClInclude>
<ClInclude Include="src\egolib\Events\MouseMovedEventArgs.hpp">
<Filter>Header Files\Events</Filter>
</ClInclude>
Expand Down
4 changes: 2 additions & 2 deletions egolib/src/egolib/App.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "egolib/Core/Singleton.hpp"
#include "egolib/platform.h"

namespace Ego {

Expand All @@ -21,7 +21,7 @@ struct AppImpl final
/// Derive from this class for your own game, editor, tool, ...
/// The App class has lots of dependencies and uses the PIMPL pattern to avoid including headers into this header file.
template <typename T>
struct App : public Ego::Core::Singleton<T>
struct App : public id::singleton<T>
{
private:
/// @brief The PIMPL pointer.
Expand Down
6 changes: 6 additions & 0 deletions egolib/src/egolib/Audio/AudioSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#include "game/Module/Module.hpp"
#include "egolib/Entities/_Include.hpp"

AudioSystem *AudioSystemCreateFunctor::operator()() const
{ return new AudioSystem(); }

void AudioSystemDestroyFunctor::operator()(AudioSystem *p) const
{ delete p; }

//Compatability fix for older versions of SDL
#if SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL) < SDL_VERSIONNUM(1, 2, 12)
Mix_Music *Mix_LoadMUSType_RW(SDL_RWops *rw, Mix_MusicType, int freesrc) {
Expand Down
19 changes: 15 additions & 4 deletions egolib/src/egolib/Audio/AudioSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <SDL_mixer.h>
#include "egolib/egoboo_setup.h"
#include "egolib/Math/_Include.hpp"
#include "egolib/Core/Singleton.hpp"

typedef int MusicID;
typedef int SoundID;
Expand Down Expand Up @@ -100,7 +99,19 @@ enum GlobalSound : uint8_t
GSND_COUNT
};

class AudioSystem : public Ego::Core::Singleton<AudioSystem>
class AudioSystem;

struct AudioSystemCreateFunctor
{
AudioSystem *operator()() const;
};

struct AudioSystemDestroyFunctor
{
void operator()(AudioSystem *p) const;
};

class AudioSystem : public id::singleton<AudioSystem, AudioSystemCreateFunctor, AudioSystemDestroyFunctor>
{
public:
static constexpr int MIX_HIGH_QUALITY = 44100;
Expand All @@ -111,8 +122,8 @@ class AudioSystem : public Ego::Core::Singleton<AudioSystem>
static const float DEFAULT_MAX_DISTANCE; ///< Default max hearing distance (10 tiles)

protected:
friend Ego::Core::Singleton<AudioSystem>::CreateFunctorType;
friend Ego::Core::Singleton<AudioSystem>::DestroyFunctorType;
friend AudioSystemCreateFunctor;
friend AudioSystemDestroyFunctor;
AudioSystem();
virtual ~AudioSystem();

Expand Down
35 changes: 17 additions & 18 deletions egolib/src/egolib/Console/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ void Console::draw()
{
BufferScopedLock lock(vertexBuffer);
Vertex *vertex = lock.get<Vertex>();
vertex->x = rectangle.getMin().x(); vertex->y = rectangle.getMin().y(); ++vertex;
vertex->x = rectangle.getMax().x(); vertex->y = rectangle.getMin().y(); ++vertex;
vertex->x = rectangle.getMax().x(); vertex->y = rectangle.getMax().y(); ++vertex;
vertex->x = rectangle.getMin().x(); vertex->y = rectangle.getMax().y();
vertex->x = rectangle.get_min().x(); vertex->y = rectangle.get_min().y(); ++vertex;
vertex->x = rectangle.get_max().x(); vertex->y = rectangle.get_min().y(); ++vertex;
vertex->x = rectangle.get_max().x(); vertex->y = rectangle.get_max().y(); ++vertex;
vertex->x = rectangle.get_min().x(); vertex->y = rectangle.get_max().y();
}
renderer.render(vertexBuffer, vertexDescriptor, PrimitiveType::LineLoop, 0, 4);
renderer.setLineWidth(1);
Expand All @@ -287,12 +287,12 @@ void Console::draw()

// clip the viewport
renderer.setScissorTestEnabled(true);
renderer.setScissorRectangle(rectangle.getMin().x(),
windowHeight - rectangle.getMax().y(),
rectangle.getSize().x(),
rectangle.getSize().y());
renderer.setScissorRectangle(rectangle.get_min().x(),
windowHeight - rectangle.get_max().y(),
rectangle.get_size().x(),
rectangle.get_size().y());

height = rectangle.getSize().y();
height = rectangle.get_size().y();

char buffer[ConsoleSettings::InputSettings::Length];

Expand All @@ -305,7 +305,7 @@ void Console::draw()
int text_width, text_height;
this->pfont->getTextSize(buffer, &text_width, &text_height);
height -= text_height;
this->pfont->drawText(buffer, rectangle.getMin().x(), height - text_height, white);
this->pfont->drawText(buffer, rectangle.get_min().x(), height - text_height, white);

if (m_document.get_text().empty())
{
Expand Down Expand Up @@ -343,7 +343,7 @@ void Console::draw()
auto txt = temporary.substr(l.get_range().get_start(),
l.get_range().get_length());
height -= l.get_height();
this->pfont->drawText(txt, rectangle.getMin().x(), height - l.get_height(), white);
this->pfont->drawText(txt, rectangle.get_min().x(), height - l.get_height(), white);
}

renderer.setDepthTestEnabled(true);
Expand Down Expand Up @@ -406,13 +406,12 @@ void Console::hide()
}

ConsoleHistory& Console::getHistory()
{
return history;
}
{ return history; }

Console *CreateFunctor<Console>::operator()(const Rectangle2f& rectangle) const
{
return new Console(rectangle);
}
Console *ConsoleCreateFunctor::operator()(const Rectangle2f& rectangle) const
{ return new Console(rectangle); }

void ConsoleDestroyFunctor::operator()(Console *p) const
{ delete p; }

} } // namespace Ego::Core
Loading

0 comments on commit e5b58b8

Please sign in to comment.