1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
#include "AppConfiguration.h"
#include "../Main.h"
#include <Containers/StringConcatenable.h>
#include <IO/FileSystem.h>
#include <Utf8.h>
using namespace Death::Containers::Literals;
using namespace Death::IO;
namespace nCine
{
AppConfiguration::AppConfiguration()
:
frameTimerLogInterval(5.0f),
resolution(0, 0),
fullscreen(false),
windowPosition(WindowPositionIgnore, WindowPositionIgnore),
resizable(true),
windowScaling(true),
frameLimit(0),
useBufferMapping(false),
#if defined(WITH_FIXED_BATCH_SIZE) && WITH_FIXED_BATCH_SIZE > 0
fixedBatchSize(WITH_FIXED_BATCH_SIZE),
#elif defined(DEATH_TARGET_WINDOWS_RT)
fixedBatchSize(24),
#elif defined(DEATH_TARGET_EMSCRIPTEN) || defined(WITH_ANGLE)
fixedBatchSize(10),
#else
fixedBatchSize(0),
#endif
#if defined(WITH_IMGUI)
vboSize(512 * 1024),
iboSize(128 * 1024),
#else
vboSize(64 * 1024),
iboSize(8 * 1024),
#endif
vaoPoolSize(16),
renderCommandPoolSize(32),
#if defined(WITH_IMGUI)
withDebugOverlay(false),
#endif
withAudio(true),
withGraphics(true),
withScenegraph(true),
withThreads(false),
withVSync(true),
withGlDebugContext(false),
// Compile-time variables
glCoreProfile_(true),
glForwardCompatible_(true),
#if defined(WITH_OPENGLES) || defined(DEATH_TARGET_EMSCRIPTEN)
glMajorVersion_(3),
glMinorVersion_(0),
#else
glMajorVersion_(3),
glMinorVersion_(3),
#endif
argv_(nullptr)
{
#if defined(DEATH_TARGET_ANDROID)
dataPath() = "assets:/"_s;
#elif defined(DEATH_TARGET_EMSCRIPTEN)
dataPath() = fs::PathSeparator;
// Always disable mapping on Emscripten as it is not supported by WebGL 2
useBufferMapping = false;
#else
dataPath() = "Content"_s + fs::PathSeparator;
#endif
#if defined(DEATH_TARGET_UNIX) && defined(WITH_SDL)
// DPI queries do not seem to work reliably on X11 with SDL2
windowScaling = false;
#endif
}
const String& AppConfiguration::dataPath() const
{
return dataPath_;
}
String& AppConfiguration::dataPath()
{
return dataPath_;
}
const StringView AppConfiguration::argv(std::size_t index) const
{
return argv_[index];
}
}
|