mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-13 21:02:34 +08:00
chore: cleanup typing issues and various other warnings here and there
This commit is contained in:
parent
8a8741dbff
commit
d652691088
@ -41,7 +41,7 @@ std::filesystem::path CCombinedContainer::resolveRealFile (const std::string& fi
|
||||
throw CAssetLoadException (filename, "Cannot resolve file in any of the containers");
|
||||
}
|
||||
|
||||
const void* CCombinedContainer::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const uint8_t* CCombinedContainer::readFile (const std::string& filename, uint32_t* length) const {
|
||||
for (const auto cur : this->m_containers) {
|
||||
try {
|
||||
// try to read the file on the current container, if the file doesn't exists
|
||||
|
@ -30,7 +30,7 @@ class CCombinedContainer final : public CContainer {
|
||||
/** @inheritdoc */
|
||||
[[nodiscard]] std::filesystem::path resolveRealFile (const std::string& filename) const override;
|
||||
/** @inheritdoc */
|
||||
[[nodiscard]] const void* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
[[nodiscard]] const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
|
||||
private:
|
||||
/** The list of containers to search files off from */
|
||||
|
@ -70,7 +70,7 @@ std::string CContainer::readFileAsString (const std::string& filename) const {
|
||||
uint32_t length = 0;
|
||||
|
||||
// read file contents and allocate a buffer for a string
|
||||
const void* contents = this->readFile (std::move (filename), &length);
|
||||
const uint8_t* contents = this->readFile (filename, &length);
|
||||
char* buffer = new char [length + 1];
|
||||
|
||||
// ensure there's a 0 at the end
|
||||
|
@ -30,7 +30,7 @@ class CContainer {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]] virtual const void* readFile (const std::string& filename, uint32_t* length) const = 0;
|
||||
[[nodiscard]] virtual const uint8_t* readFile (const std::string& filename, uint32_t* length) const = 0;
|
||||
|
||||
/**
|
||||
* Wrapper for readFile, appends the texture extension at the end of the filename
|
||||
|
@ -23,7 +23,7 @@ std::filesystem::path CDirectory::resolveRealFile (const std::string& filename)
|
||||
return std::filesystem::path (this->m_basepath) / filename;
|
||||
}
|
||||
|
||||
const void* CDirectory::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const uint8_t* CDirectory::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const std::filesystem::path final = std::filesystem::path (this->m_basepath) / filename;
|
||||
|
||||
// first check the cache, if the file is there already just return the data in there
|
||||
@ -47,7 +47,7 @@ const void* CDirectory::readFile (const std::string& filename, uint32_t* length)
|
||||
fseek (fp, 0, SEEK_SET);
|
||||
|
||||
// now read the whole file
|
||||
auto* contents = new char [size];
|
||||
auto* contents = new uint8_t [size];
|
||||
|
||||
if (fread (contents, size, 1, fp) != 1) {
|
||||
delete [] contents;
|
||||
|
@ -19,7 +19,7 @@ class CDirectory final : public CContainer {
|
||||
/** @inheritdoc */
|
||||
[[nodiscard]] std::filesystem::path resolveRealFile (const std::string& filename) const override;
|
||||
/** @inheritdoc */
|
||||
[[nodiscard]] const void* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
[[nodiscard]] const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
|
||||
private:
|
||||
/** The basepath for the directory */
|
||||
|
@ -8,14 +8,14 @@ namespace WallpaperEngine::Assets {
|
||||
*/
|
||||
class CFileEntry {
|
||||
public:
|
||||
CFileEntry (const char* address, uint32_t length) : address (address), length (length) {}
|
||||
CFileEntry (const uint8_t* address, uint32_t length) : address (address), length (length) {}
|
||||
|
||||
~CFileEntry () {
|
||||
delete [] address;
|
||||
}
|
||||
|
||||
/** File contents */
|
||||
const char* address;
|
||||
const uint8_t* address;
|
||||
/** File length */
|
||||
uint32_t length;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ CPackage::CPackage (std::filesystem::path path) : m_path (std::move (path)) {
|
||||
this->init ();
|
||||
}
|
||||
|
||||
const void* CPackage::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const uint8_t* CPackage::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const auto it = this->m_contents.find (filename);
|
||||
|
||||
if (it == this->m_contents.end ())
|
||||
@ -35,7 +35,7 @@ const void* CPackage::readFile (const std::string& filename, uint32_t* length) c
|
||||
*length = it->second->length;
|
||||
|
||||
// clone original first
|
||||
auto* result = new char [it->second->length];
|
||||
auto* result = new uint8_t [it->second->length];
|
||||
|
||||
memcpy (result, it->second->address, it->second->length);
|
||||
|
||||
@ -128,7 +128,7 @@ void CPackage::loadFiles (FILE* fp) {
|
||||
sLog.exception ("Cannot find file ", cur.filename, " from package ", this->m_path);
|
||||
|
||||
// allocate memory for the file's contents and read it from the file
|
||||
char* fileContents = new char [cur.length];
|
||||
auto* fileContents = new uint8_t [cur.length];
|
||||
|
||||
if (fread (fileContents, cur.length, 1, fp) != 1) {
|
||||
delete [] fileContents;
|
||||
|
@ -20,7 +20,7 @@ class CPackage final : public CContainer {
|
||||
public:
|
||||
explicit CPackage (std::filesystem::path path);
|
||||
|
||||
[[nodiscard]] const void* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
[[nodiscard]] const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
using namespace WallpaperEngine::Assets;
|
||||
|
||||
void CVirtualContainer::add (const std::string& filename, const char* contents, uint32_t length) {
|
||||
void CVirtualContainer::add (const std::string& filename, const uint8_t* contents, uint32_t length) {
|
||||
this->m_virtualFiles.insert (std::make_pair (filename, new CFileEntry (contents, length)));
|
||||
}
|
||||
|
||||
void CVirtualContainer::add (const std::string& filename, const std::string& contents) {
|
||||
char* copy = new char [contents.length () + 1];
|
||||
auto* copy = new uint8_t [contents.length () + 1];
|
||||
|
||||
// copy the text AND the \0
|
||||
memcpy (copy, contents.c_str (), contents.length () + 1);
|
||||
@ -19,7 +19,7 @@ void CVirtualContainer::add (const std::string& filename, const std::string& con
|
||||
this->add (filename, copy, contents.length () + 1);
|
||||
}
|
||||
|
||||
const void* CVirtualContainer::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const uint8_t* CVirtualContainer::readFile (const std::string& filename, uint32_t* length) const {
|
||||
const auto cur = this->m_virtualFiles.find (filename);
|
||||
|
||||
if (cur == this->m_virtualFiles.end ())
|
||||
@ -29,7 +29,7 @@ const void* CVirtualContainer::readFile (const std::string& filename, uint32_t*
|
||||
*length = cur->second->length;
|
||||
|
||||
// clone original first
|
||||
char* result = new char [cur->second->length];
|
||||
auto* result = new uint8_t [cur->second->length];
|
||||
|
||||
memcpy (result, cur->second->address, cur->second->length);
|
||||
|
||||
|
@ -19,7 +19,7 @@ class CVirtualContainer final : public CContainer {
|
||||
* @param contents
|
||||
* @param length
|
||||
*/
|
||||
void add (const std::string& filename, const char* contents, uint32_t length);
|
||||
void add (const std::string& filename, const uint8_t* contents, uint32_t length);
|
||||
|
||||
/**
|
||||
* Adds a new file to the virtual container
|
||||
@ -29,7 +29,7 @@ class CVirtualContainer final : public CContainer {
|
||||
*/
|
||||
void add (const std::string& filename, const std::string& contents);
|
||||
/** @inheritdoc */
|
||||
const void* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
const uint8_t* readFile (const std::string& filename, uint32_t* length) const override;
|
||||
|
||||
private:
|
||||
/** The recorded files in this virtual container */
|
||||
|
@ -95,7 +95,7 @@ CAudioStream::CAudioStream (CAudioContext& context, const std::string& filename)
|
||||
this->loadCustomContent (filename.c_str ());
|
||||
}
|
||||
|
||||
CAudioStream::CAudioStream (CAudioContext& context, const void* buffer, int length) :
|
||||
CAudioStream::CAudioStream (CAudioContext& context, const uint8_t* buffer, uint32_t length) :
|
||||
m_audioContext (context),
|
||||
m_swrctx (nullptr) {
|
||||
// setup a custom context first
|
||||
@ -142,13 +142,17 @@ void CAudioStream::loadCustomContent (const char* filename) {
|
||||
if (avformat_find_stream_info (this->m_formatContext, nullptr) < 0)
|
||||
sLog.exception ("Cannot determine file format: ", filename);
|
||||
|
||||
bool hasAudioStream = false;
|
||||
|
||||
// find the audio stream
|
||||
for (int i = 0; i < this->m_formatContext->nb_streams; i++) {
|
||||
if (this->m_formatContext->streams [i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && this->m_audioStream < 0)
|
||||
for (unsigned int i = 0; i < this->m_formatContext->nb_streams; i++) {
|
||||
if (this->m_formatContext->streams [i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && hasAudioStream == false) {
|
||||
hasAudioStream = true;
|
||||
this->m_audioStream = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_audioStream == -1)
|
||||
if (!hasAudioStream)
|
||||
sLog.exception ("Cannot find an audio stream in file ", filename);
|
||||
|
||||
// get the decoder for it and alloc the required context
|
||||
@ -308,11 +312,11 @@ AVFormatContext* CAudioStream::getFormatContext () {
|
||||
return this->m_formatContext;
|
||||
}
|
||||
|
||||
int CAudioStream::getAudioStream () {
|
||||
unsigned int CAudioStream::getAudioStream () const {
|
||||
return this->m_audioStream;
|
||||
}
|
||||
|
||||
bool CAudioStream::isInitialized () {
|
||||
bool CAudioStream::isInitialized () const {
|
||||
return this->m_initialized;
|
||||
}
|
||||
|
||||
@ -320,23 +324,23 @@ void CAudioStream::setRepeat (bool newRepeat) {
|
||||
this->m_repeat = newRepeat;
|
||||
}
|
||||
|
||||
bool CAudioStream::isRepeat () {
|
||||
bool CAudioStream::isRepeat () const {
|
||||
return this->m_repeat;
|
||||
}
|
||||
|
||||
const void* CAudioStream::getBuffer () {
|
||||
const uint8_t* CAudioStream::getBuffer () {
|
||||
return this->m_buffer;
|
||||
}
|
||||
|
||||
int CAudioStream::getLength () {
|
||||
uint32_t CAudioStream::getLength () const {
|
||||
return this->m_length;
|
||||
}
|
||||
|
||||
int CAudioStream::getPosition () {
|
||||
uint32_t CAudioStream::getPosition () const {
|
||||
return this->m_position;
|
||||
}
|
||||
|
||||
void CAudioStream::setPosition (int current) {
|
||||
void CAudioStream::setPosition (uint32_t current) {
|
||||
this->m_position = current;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ class CAudioContext;
|
||||
class CAudioStream {
|
||||
public:
|
||||
CAudioStream (CAudioContext& context, const std::string& filename);
|
||||
CAudioStream (CAudioContext& context, const void* buffer, int length);
|
||||
CAudioStream (CAudioContext& context, const uint8_t* buffer, uint32_t length);
|
||||
CAudioStream (CAudioContext& audioContext, AVCodecContext* context);
|
||||
~CAudioStream ();
|
||||
|
||||
@ -56,11 +56,11 @@ class CAudioStream {
|
||||
/**
|
||||
* @return The audio stream index of the given file
|
||||
*/
|
||||
int getAudioStream ();
|
||||
[[nodiscard]] unsigned int getAudioStream () const;
|
||||
/**
|
||||
* @return If the audio stream can be played or not
|
||||
*/
|
||||
bool isInitialized ();
|
||||
[[nodiscard]] bool isInitialized () const;
|
||||
/**
|
||||
* @param newRepeat true = repeat, false = no repeat
|
||||
*/
|
||||
@ -68,7 +68,7 @@ class CAudioStream {
|
||||
/**
|
||||
* @return If the stream is to be repeated at the end or not
|
||||
*/
|
||||
bool isRepeat ();
|
||||
[[nodiscard]] bool isRepeat () const;
|
||||
/**
|
||||
* Stops decoding and playbak of the stream
|
||||
*/
|
||||
@ -76,21 +76,21 @@ class CAudioStream {
|
||||
/**
|
||||
* @return The file data buffer
|
||||
*/
|
||||
const void* getBuffer ();
|
||||
[[nodiscard]] const uint8_t* getBuffer ();
|
||||
/**
|
||||
* @return The length of the file data buffer
|
||||
*/
|
||||
int getLength ();
|
||||
[[nodiscard]] uint32_t getLength () const;
|
||||
/**
|
||||
* @return The read position of the data buffer
|
||||
*/
|
||||
int getPosition ();
|
||||
[[nodiscard]] uint32_t getPosition () const;
|
||||
/**
|
||||
* Updates the read position of the data buffer
|
||||
*
|
||||
* @param current
|
||||
*/
|
||||
void setPosition (int current);
|
||||
void setPosition (uint32_t current);
|
||||
/**
|
||||
* @return The SDL_cond used to signal waiting for data
|
||||
*/
|
||||
@ -175,13 +175,13 @@ class CAudioStream {
|
||||
/** The format context that controls how data is read off the file */
|
||||
AVFormatContext* m_formatContext = nullptr;
|
||||
/** The stream index for the audio being played */
|
||||
int m_audioStream = -1;
|
||||
unsigned int m_audioStream;
|
||||
/** File data pointer */
|
||||
const void* m_buffer {};
|
||||
const uint8_t* m_buffer {};
|
||||
/** The length of the file data pointer */
|
||||
int m_length {};
|
||||
uint32_t m_length {};
|
||||
/** The read position on the file data pointer */
|
||||
int m_position = 0;
|
||||
uint32_t m_position = 0;
|
||||
|
||||
struct MyAVPacketList {
|
||||
AVPacket* packet;
|
||||
|
@ -25,9 +25,9 @@ void pa_stream_read_cb (pa_stream* stream, const size_t /*nbytes*/, void* userda
|
||||
|
||||
// Careful when to pa_stream_peek() and pa_stream_drop()!
|
||||
// c.f. https://www.freedesktop.org/software/pulseaudio/doxygen/stream_8h.html#ac2838c449cde56e169224d7fe3d00824
|
||||
const void* data = nullptr;
|
||||
const uint8_t* data = nullptr;
|
||||
size_t currentSize;
|
||||
if (pa_stream_peek (stream, &data, ¤tSize) != 0) {
|
||||
if (pa_stream_peek (stream, reinterpret_cast<const void**> (&data), ¤tSize) != 0) {
|
||||
sLog.error ("Failed to peek at stream data...");
|
||||
return;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ using namespace WallpaperEngine::Core;
|
||||
using namespace WallpaperEngine::Assets;
|
||||
using namespace WallpaperEngine::Core::UserSettings;
|
||||
|
||||
CObject::CObject (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, std::string type,
|
||||
CObject::CObject (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles) :
|
||||
m_scene (scene),
|
||||
m_visible (visible),
|
||||
@ -108,7 +108,7 @@ const std::vector<Objects::CEffect*>& CObject::getEffects () const {
|
||||
return this->m_effects;
|
||||
}
|
||||
|
||||
const std::vector<uint32_t>& CObject::getDependencies () const {
|
||||
const std::vector<int>& CObject::getDependencies () const {
|
||||
return this->m_dependencies;
|
||||
}
|
||||
|
||||
@ -129,6 +129,6 @@ void CObject::insertEffect (Objects::CEffect* effect) {
|
||||
this->m_effects.push_back (effect);
|
||||
}
|
||||
|
||||
void CObject::insertDependency (uint32_t dependency) {
|
||||
void CObject::insertDependency (int dependency) {
|
||||
this->m_dependencies.push_back (dependency);
|
||||
}
|
@ -45,37 +45,37 @@ class CObject {
|
||||
return this->m_type == T::Type;
|
||||
}
|
||||
|
||||
const std::vector<Objects::CEffect*>& getEffects () const;
|
||||
const std::vector<uint32_t>& getDependencies () const;
|
||||
int getId () const;
|
||||
[[nodiscard]] const std::vector<Objects::CEffect*>& getEffects () const;
|
||||
[[nodiscard]] const std::vector<int>& getDependencies () const;
|
||||
[[nodiscard]] int getId () const;
|
||||
|
||||
glm::vec3 getOrigin () const;
|
||||
glm::vec3 getScale () const;
|
||||
const glm::vec3& getAngles () const;
|
||||
const std::string& getName () const;
|
||||
[[nodiscard]] glm::vec3 getOrigin () const;
|
||||
[[nodiscard]] glm::vec3 getScale () const;
|
||||
[[nodiscard]] const glm::vec3& getAngles () const;
|
||||
[[nodiscard]] const std::string& getName () const;
|
||||
|
||||
bool isVisible () const;
|
||||
CScene* getScene () const;
|
||||
[[nodiscard]] bool isVisible () const;
|
||||
[[nodiscard]] CScene* getScene () const;
|
||||
|
||||
protected:
|
||||
CObject (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, std::string type,
|
||||
CObject (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, std::string type,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles);
|
||||
|
||||
void insertEffect (Objects::CEffect* effect);
|
||||
void insertDependency (uint32_t dependency);
|
||||
void insertDependency (int dependency);
|
||||
|
||||
private:
|
||||
std::string m_type;
|
||||
|
||||
CUserSettingBoolean* m_visible;
|
||||
uint32_t m_id;
|
||||
int m_id;
|
||||
std::string m_name;
|
||||
CUserSettingVector3* m_origin;
|
||||
CUserSettingVector3* m_scale;
|
||||
glm::vec3 m_angles;
|
||||
|
||||
std::vector<Objects::CEffect*> m_effects;
|
||||
std::vector<uint32_t> m_dependencies;
|
||||
std::vector<int> m_dependencies;
|
||||
|
||||
CScene* m_scene;
|
||||
};
|
||||
|
@ -67,7 +67,7 @@ CEffect* CEffect::fromJSON (json data, CUserSettingBoolean* visible, CObject* ob
|
||||
|
||||
for (const auto& passCur : material->getPasses ()) {
|
||||
if (textures_it != cur->end ()) {
|
||||
int textureNumber = 0;
|
||||
std::vector<std::string>::size_type textureNumber = 0;
|
||||
|
||||
for (const auto& texturesCur : (*textures_it)) {
|
||||
std::string texture;
|
||||
|
@ -12,7 +12,7 @@
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
using namespace WallpaperEngine::Core::UserSettings;
|
||||
|
||||
CImage::CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, uint32_t id, std::string name,
|
||||
CImage::CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, int id, std::string name,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles, const glm::vec2& size,
|
||||
std::string alignment, CUserSettingVector3* color, CUserSettingFloat* alpha, float brightness,
|
||||
uint32_t colorBlendMode, const glm::vec2& parallaxDepth, bool fullscreen, bool passthrough,
|
||||
@ -31,7 +31,7 @@ CImage::CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean*
|
||||
m_autosize (autosize) {}
|
||||
|
||||
WallpaperEngine::Core::CObject* CImage::fromJSON (CScene* scene, json data, CContainer* container,
|
||||
CUserSettingBoolean* visible, uint32_t id, std::string name,
|
||||
CUserSettingBoolean* visible, int id, std::string name,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||
const glm::vec3& angles) {
|
||||
const auto image_it = data.find ("image");
|
||||
|
@ -28,7 +28,7 @@ class CImage : public CObject {
|
||||
|
||||
public:
|
||||
static CObject* fromJSON (CScene* scene, json data, CContainer* container, CUserSettingBoolean* visible,
|
||||
uint32_t id, std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||
int id, std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||
const glm::vec3& angles);
|
||||
|
||||
/**
|
||||
@ -77,7 +77,7 @@ class CImage : public CObject {
|
||||
[[nodiscard]] bool isAutosize () const;
|
||||
|
||||
protected:
|
||||
CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, uint32_t id, std::string name,
|
||||
CImage (CScene* scene, Images::CMaterial* material, CUserSettingBoolean* visible, int id, std::string name,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale, const glm::vec3& angles, const glm::vec2& size,
|
||||
std::string alignment, CUserSettingVector3* color, CUserSettingFloat* alpha, float brightness,
|
||||
uint32_t colorBlendMode, const glm::vec2& parallaxDepth, bool fullscreen, bool passthrough, bool autosize);
|
||||
|
@ -6,8 +6,8 @@
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
|
||||
CParticle* CParticle::fromFile (CScene* scene, const std::string& filename, CContainer* container,
|
||||
CUserSettingBoolean* visible, uint32_t id, std::string name,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale) {
|
||||
CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
|
||||
CUserSettingVector3* scale) {
|
||||
json data = json::parse (WallpaperEngine::FileSystem::loadFullFile (filename, container));
|
||||
const auto controlpoint_it = data.find ("controlpoint");
|
||||
const auto starttime_it = jsonFindRequired (data, "starttime", "Particles must have start time");
|
||||
@ -29,7 +29,7 @@ CParticle* CParticle::fromFile (CScene* scene, const std::string& filename, CCon
|
||||
return particle;
|
||||
}
|
||||
|
||||
CParticle::CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, uint32_t id,
|
||||
CParticle::CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, int id,
|
||||
std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale) :
|
||||
CObject (scene, visible, id, std::move (name), Type, origin, scale, glm::vec3 ()),
|
||||
m_starttime (starttime),
|
||||
|
@ -18,7 +18,7 @@ class CParticle : public CObject {
|
||||
|
||||
public:
|
||||
static CParticle* fromFile (CScene* scene, const std::string& filename, CContainer* container,
|
||||
CUserSettingBoolean* visible, uint32_t id, std::string name,
|
||||
CUserSettingBoolean* visible, int id, std::string name,
|
||||
CUserSettingVector3* origin, CUserSettingVector3* scale);
|
||||
|
||||
/**
|
||||
@ -35,7 +35,7 @@ class CParticle : public CObject {
|
||||
[[nodiscard]] const std::vector<Particles::CInitializer*>& getInitializers () const;
|
||||
|
||||
protected:
|
||||
CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, uint32_t id,
|
||||
CParticle (CScene* scene, uint32_t starttime, uint32_t maxcount, CUserSettingBoolean* visible, int id,
|
||||
std::string name, CUserSettingVector3* origin, CUserSettingVector3* scale);
|
||||
|
||||
/**
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Objects;
|
||||
|
||||
CSound::CSound (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, CUserSettingVector3* origin,
|
||||
CSound::CSound (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
|
||||
CUserSettingVector3* scale, const glm::vec3& angles, bool repeat) :
|
||||
CObject (scene, visible, id, std::move (name), Type, origin, scale, angles),
|
||||
m_repeat (repeat) {}
|
||||
|
||||
WallpaperEngine::Core::CObject* CSound::fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, uint32_t id,
|
||||
WallpaperEngine::Core::CObject* CSound::fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, int id,
|
||||
const std::string& name, CUserSettingVector3* origin,
|
||||
CUserSettingVector3* scale, const glm::vec3& angles) {
|
||||
bool repeat = false;
|
||||
|
@ -15,7 +15,7 @@ class CSound : public CObject {
|
||||
friend class CObject;
|
||||
|
||||
public:
|
||||
static CObject* fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, uint32_t id,
|
||||
static CObject* fromJSON (CScene* scene, json data, CUserSettingBoolean* visible, int id,
|
||||
const std::string& name, CUserSettingVector3* origin, CUserSettingVector3* scale,
|
||||
const glm::vec3& angles);
|
||||
|
||||
@ -29,7 +29,7 @@ class CSound : public CObject {
|
||||
[[nodiscard]] bool isRepeat () const;
|
||||
|
||||
protected:
|
||||
CSound (CScene* scene, CUserSettingBoolean* visible, uint32_t id, std::string name, CUserSettingVector3* origin,
|
||||
CSound (CScene* scene, CUserSettingBoolean* visible, int id, std::string name, CUserSettingVector3* origin,
|
||||
CUserSettingVector3* scale, const glm::vec3& angles, bool repeat);
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ void CPass::insertTexture (const std::string& texture) {
|
||||
this->m_textures.push_back (texture);
|
||||
}
|
||||
|
||||
void CPass::setTexture (int index, const std::string& texture) {
|
||||
void CPass::setTexture (std::vector<std::string>::size_type index, const std::string& texture) {
|
||||
this->m_textures.at (index) = texture;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class CPass {
|
||||
* @param index
|
||||
* @param texture
|
||||
*/
|
||||
void setTexture (int index, const std::string& texture);
|
||||
void setTexture (std::vector<std::string>::size_type index, const std::string& texture);
|
||||
|
||||
private:
|
||||
// TODO: CREATE ENUMERATIONS FOR THESE INSTEAD OF USING STRING VALUES!
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
using namespace WallpaperEngine::Core::Scenes;
|
||||
|
||||
CProjection::CProjection (uint32_t width, uint32_t height) : m_isAuto (false), m_width (width), m_height (height) {}
|
||||
CProjection::CProjection (int width, int height) : m_isAuto (false), m_width (width), m_height (height) {}
|
||||
|
||||
CProjection::CProjection (bool isAuto) : m_isAuto (isAuto), m_width (0), m_height (0) {}
|
||||
|
||||
const uint32_t& CProjection::getWidth () const {
|
||||
const int& CProjection::getWidth () const {
|
||||
return this->m_width;
|
||||
}
|
||||
|
||||
const uint32_t& CProjection::getHeight () const {
|
||||
const int& CProjection::getHeight () const {
|
||||
return this->m_height;
|
||||
}
|
||||
|
||||
@ -18,11 +18,11 @@ bool CProjection::isAuto () const {
|
||||
return this->m_isAuto;
|
||||
}
|
||||
|
||||
void CProjection::setWidth (uint32_t width) {
|
||||
void CProjection::setWidth (int width) {
|
||||
this->m_width = width;
|
||||
}
|
||||
|
||||
void CProjection::setHeight (uint32_t height) {
|
||||
void CProjection::setHeight (int height) {
|
||||
this->m_height = height;
|
||||
}
|
||||
|
||||
|
@ -9,20 +9,20 @@ class CProjection {
|
||||
public:
|
||||
static CProjection* fromJSON (json data);
|
||||
|
||||
const uint32_t& getWidth () const;
|
||||
const uint32_t& getHeight () const;
|
||||
bool isAuto () const;
|
||||
[[nodiscard]] const int& getWidth () const;
|
||||
[[nodiscard]] const int& getHeight () const;
|
||||
[[nodiscard]] bool isAuto () const;
|
||||
|
||||
void setWidth (uint32_t width);
|
||||
void setHeight (uint32_t height);
|
||||
void setWidth (int width);
|
||||
void setHeight (int height);
|
||||
|
||||
protected:
|
||||
CProjection (uint32_t width, uint32_t height);
|
||||
CProjection (int width, int height);
|
||||
explicit CProjection (bool isAuto);
|
||||
|
||||
private:
|
||||
uint32_t m_width;
|
||||
uint32_t m_height;
|
||||
int m_width;
|
||||
int m_height;
|
||||
bool m_isAuto;
|
||||
};
|
||||
} // namespace WallpaperEngine::Core::Scenes
|
||||
|
@ -123,12 +123,12 @@ class CWallpaper : public Helpers::CContextAware {
|
||||
/**
|
||||
* @return The width of this wallpaper
|
||||
*/
|
||||
[[nodiscard]] virtual uint32_t getWidth () const = 0;
|
||||
[[nodiscard]] virtual int getWidth () const = 0;
|
||||
|
||||
/**
|
||||
* @return The height of this wallpaper
|
||||
*/
|
||||
[[nodiscard]] virtual uint32_t getHeight () const = 0;
|
||||
[[nodiscard]] virtual int getHeight () const = 0;
|
||||
|
||||
/**
|
||||
* Creates a new instance of CWallpaper based on the information provided by the read backgrounds
|
||||
|
@ -61,8 +61,8 @@ template <> void CWallpaperState::updateTextureUVs<CWallpaperState::TextureUVsSc
|
||||
|
||||
const int viewportWidth = this->getViewportWidth ();
|
||||
const int viewportHeight = this->getViewportHeight ();
|
||||
uint32_t projectionWidth = this->getProjectionWidth ();
|
||||
uint32_t projectionHeight = this->getProjectionHeight ();
|
||||
int projectionWidth = this->getProjectionWidth ();
|
||||
int projectionHeight = this->getProjectionHeight ();
|
||||
|
||||
const float m1 = static_cast<float> (viewportWidth) / projectionWidth;
|
||||
const float m2 = static_cast<float> (viewportHeight) / projectionHeight;
|
||||
@ -82,8 +82,8 @@ template <> void CWallpaperState::updateTextureUVs<CWallpaperState::TextureUVsSc
|
||||
|
||||
const int viewportWidth = this->getViewportWidth ();
|
||||
const int viewportHeight = this->getViewportHeight ();
|
||||
uint32_t projectionWidth = this->getProjectionWidth ();
|
||||
uint32_t projectionHeight = this->getProjectionHeight ();
|
||||
int projectionWidth = this->getProjectionWidth ();
|
||||
int projectionHeight = this->getProjectionHeight ();
|
||||
|
||||
const float m1 = static_cast<float> (viewportWidth) / projectionWidth;
|
||||
const float m2 = static_cast<float> (viewportHeight) / projectionHeight;
|
||||
@ -103,8 +103,8 @@ template <> void CWallpaperState::updateTextureUVs<CWallpaperState::TextureUVsSc
|
||||
|
||||
const int viewportWidth = this->getViewportWidth ();
|
||||
const int viewportHeight = this->getViewportHeight ();
|
||||
const uint32_t projectionWidth = this->getProjectionWidth ();
|
||||
const uint32_t projectionHeight = this->getProjectionHeight ();
|
||||
const int projectionWidth = this->getProjectionWidth ();
|
||||
const int projectionHeight = this->getProjectionHeight ();
|
||||
|
||||
if ((viewportHeight > viewportWidth && projectionWidth >= projectionHeight) ||
|
||||
(viewportWidth > viewportHeight && projectionHeight > projectionWidth)) {
|
||||
|
@ -70,12 +70,12 @@ class CWallpaperState {
|
||||
};
|
||||
|
||||
// @return The width of viewport
|
||||
uint32_t getProjectionWidth () const {
|
||||
int getProjectionWidth () const {
|
||||
return projection.width;
|
||||
};
|
||||
|
||||
// @return The height of viewport
|
||||
uint32_t getProjectionHeight () const {
|
||||
int getProjectionHeight () const {
|
||||
return projection.height;
|
||||
};
|
||||
|
||||
@ -96,8 +96,8 @@ class CWallpaperState {
|
||||
|
||||
// Wallpaper dimensions
|
||||
struct {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int width;
|
||||
int height;
|
||||
} projection {};
|
||||
|
||||
// Are Vs coordinates fliped
|
||||
|
@ -203,7 +203,8 @@ void CWaylandOpenGLDriver::onLayerClose (Output::CWaylandOutputViewport* viewpor
|
||||
wl_surface_destroy (viewport->surface);
|
||||
|
||||
// remove the output from the list
|
||||
std::remove (this->m_screens.begin (), this->m_screens.end (), viewport);
|
||||
this->m_screens.erase (std::remove (this->m_screens.begin (), this->m_screens.end (), viewport),
|
||||
this->m_screens.end ());
|
||||
|
||||
// reset the viewports
|
||||
this->getOutput ().reset ();
|
||||
|
@ -74,7 +74,7 @@ bool CX11FullScreenDetector::anythingFullscreen () const {
|
||||
XFree (children);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nchildren; i++) {
|
||||
for (unsigned int i = 0; i < nchildren; i++) {
|
||||
if (!XGetWindowAttributes (this->m_display, children [i], &attribs))
|
||||
continue;
|
||||
|
||||
|
@ -377,7 +377,7 @@ void CImage::render () {
|
||||
#if !NDEBUG
|
||||
std::string str = "Rendering ";
|
||||
|
||||
if (this->getScene ()->getScene ()->isBloom () && this->getId () == 0xFFFFFFFF)
|
||||
if (this->getScene ()->getScene ()->isBloom () && this->getId () == -1)
|
||||
str += "bloom";
|
||||
else {
|
||||
str += this->getImage ()->getName () + " (" + std::to_string (this->getId ()) + ", " +
|
||||
|
@ -12,7 +12,7 @@ CSound::CSound (CScene* scene, Core::Objects::CSound* sound) : CObject (scene, T
|
||||
void CSound::load () {
|
||||
for (const auto& cur : this->m_sound->getSounds ()) {
|
||||
uint32_t filesize = 0;
|
||||
const void* filebuffer = this->getContainer ()->readFile (cur, &filesize);
|
||||
const uint8_t* filebuffer = this->getContainer ()->readFile (cur, &filesize);
|
||||
|
||||
auto stream = new Audio::CAudioStream (this->getScene ()->getAudioContext (), filebuffer, filesize);
|
||||
|
||||
|
@ -701,7 +701,7 @@ void Compiler::parseParameterConfiguration (const std::string& type, const std::
|
||||
// extract the texture number from the name
|
||||
const char value = name.at (std::string ("g_Texture").length ());
|
||||
// now convert it to integer
|
||||
int index = value - '0';
|
||||
size_t index = value - '0';
|
||||
|
||||
if (combo != data.end ()) {
|
||||
// if the texture exists (and is not null), add to the combo
|
||||
|
@ -96,8 +96,7 @@ CScene::CScene (Core::CScene* scene, CRenderContext& context, CAudioContext& aud
|
||||
"\t\"origin\": \"" +
|
||||
std::to_string (sceneWidth / 2) + " " + std::to_string (sceneHeight / 2) +
|
||||
" 0.0\","
|
||||
"\t\"id\": " +
|
||||
std::to_string (0xFFFFFFFF) +
|
||||
"\t\"id\": -1" +
|
||||
","
|
||||
"\t\"effects\":"
|
||||
"\t["
|
||||
@ -246,11 +245,11 @@ Core::CScene* CScene::getScene () const {
|
||||
return this->getWallpaperData ()->as<Core::CScene> ();
|
||||
}
|
||||
|
||||
uint32_t CScene::getWidth () const {
|
||||
int CScene::getWidth () const {
|
||||
return this->getScene ()->getOrthogonalProjection ()->getWidth ();
|
||||
}
|
||||
|
||||
uint32_t CScene::getHeight () const {
|
||||
int CScene::getHeight () const {
|
||||
return this->getScene ()->getOrthogonalProjection ()->getHeight ();
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ class CScene final : public CWallpaper {
|
||||
|
||||
Core::CScene* getScene () const;
|
||||
|
||||
uint32_t getWidth () const override;
|
||||
uint32_t getHeight () const override;
|
||||
int getWidth () const override;
|
||||
int getHeight () const override;
|
||||
|
||||
glm::vec2* getMousePosition ();
|
||||
glm::vec2* getMousePositionLast ();
|
||||
|
@ -67,7 +67,7 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext& context, CAudioContext& aud
|
||||
this->setupFramebuffers ();
|
||||
}
|
||||
|
||||
void CVideo::setSize (int64_t width, int64_t height) {
|
||||
void CVideo::setSize (int width, int height) {
|
||||
this->m_width = width > 0 ? width : this->m_width;
|
||||
this->m_height = height > 0 ? height : this->m_height;
|
||||
|
||||
@ -117,11 +117,11 @@ Core::CVideo* CVideo::getVideo () {
|
||||
return this->getWallpaperData ()->as<Core::CVideo> ();
|
||||
}
|
||||
|
||||
uint32_t CVideo::getWidth () const {
|
||||
int CVideo::getWidth () const {
|
||||
return this->m_width;
|
||||
}
|
||||
|
||||
uint32_t CVideo::getHeight () const {
|
||||
int CVideo::getHeight () const {
|
||||
return this->m_height;
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,10 @@ class CVideo final : public CWallpaper {
|
||||
|
||||
Core::CVideo* getVideo ();
|
||||
|
||||
uint32_t getWidth () const override;
|
||||
uint32_t getHeight () const override;
|
||||
[[nodiscard]] int getWidth () const override;
|
||||
[[nodiscard]] int getHeight () const override;
|
||||
|
||||
void setSize (int64_t width, int64_t height);
|
||||
void setSize (int width, int height);
|
||||
|
||||
protected:
|
||||
void renderFrame (glm::ivec4 viewport) override;
|
||||
|
@ -36,7 +36,7 @@ CWeb::CWeb (Core::CWeb* web, CRenderContext& context, CAudioContext& audioContex
|
||||
CefBrowserHost::CreateBrowserSync (window_info, m_client.get (), htmlURL, browserSettings, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void CWeb::setSize (int64_t width, int64_t height) {
|
||||
void CWeb::setSize (int width, int height) {
|
||||
this->m_width = width > 0 ? width : this->m_width;
|
||||
this->m_height = height > 0 ? height : this->m_height;
|
||||
|
||||
@ -96,8 +96,6 @@ CWeb::~CWeb () {
|
||||
|
||||
CWeb::RenderHandler::RenderHandler (CWeb* webdata) : m_webdata (webdata) {}
|
||||
|
||||
CWeb::RenderHandler::~RenderHandler () {}
|
||||
|
||||
// Required by CEF
|
||||
void CWeb::RenderHandler::GetViewRect (CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||
rect = CefRect (0, 0, this->m_webdata->getWidth (), this->m_webdata->getHeight ());
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <glm/ext.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
@ -20,12 +21,12 @@ namespace WallpaperEngine::Render
|
||||
{
|
||||
public:
|
||||
CWeb (Core::CWeb* scene, CRenderContext& context, CAudioContext& audioContext, WallpaperEngine::WebBrowser::CWebBrowserContext& browserContext, const CWallpaperState::TextureUVsScaling& scalingMode);
|
||||
~CWeb();
|
||||
uint32_t getWidth () const override { return this->m_width; }
|
||||
~CWeb() override;
|
||||
[[nodiscard]] int getWidth () const override { return this->m_width; }
|
||||
|
||||
uint32_t getHeight () const override { return this->m_height; }
|
||||
[[nodiscard]] int getHeight () const override { return this->m_height; }
|
||||
|
||||
void setSize (int64_t width, int64_t height);
|
||||
void setSize (int width, int height);
|
||||
|
||||
protected:
|
||||
void renderFrame (glm::ivec4 viewport) override;
|
||||
@ -46,14 +47,10 @@ namespace WallpaperEngine::Render
|
||||
class RenderHandler: public CefRenderHandler
|
||||
{
|
||||
public:
|
||||
RenderHandler(CWeb* webdata);
|
||||
explicit RenderHandler(CWeb* webdata);
|
||||
|
||||
//! \brief
|
||||
~RenderHandler();
|
||||
|
||||
//! \brief Compile OpenGL shaders and create OpenGL objects (VAO,
|
||||
//! VBO, texture, locations ...)
|
||||
bool init();
|
||||
~RenderHandler() override = default;
|
||||
|
||||
//! \brief CefRenderHandler interface
|
||||
void GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect) override;
|
||||
@ -70,10 +67,10 @@ namespace WallpaperEngine::Render
|
||||
private:
|
||||
CWeb* m_webdata;
|
||||
|
||||
uint32_t getWidth () const {
|
||||
int getWidth () const {
|
||||
return this->m_webdata->getWidth();
|
||||
};
|
||||
uint32_t getHeight () const {
|
||||
int getHeight () const {
|
||||
return this->m_webdata->getHeight();
|
||||
};
|
||||
//! \brief Return the OpenGL texture handle
|
||||
@ -90,8 +87,8 @@ namespace WallpaperEngine::Render
|
||||
class BrowserClient: public CefClient
|
||||
{
|
||||
public:
|
||||
BrowserClient(CefRefPtr<CefRenderHandler> ptr)
|
||||
: m_renderHandler(ptr)
|
||||
explicit BrowserClient(CefRefPtr<CefRenderHandler> ptr)
|
||||
: m_renderHandler(std::move(ptr))
|
||||
{}
|
||||
|
||||
CefRefPtr<CefRenderHandler> GetRenderHandler() override
|
||||
@ -109,8 +106,8 @@ namespace WallpaperEngine::Render
|
||||
CefRefPtr<BrowserClient> m_client;
|
||||
RenderHandler* m_render_handler = nullptr;
|
||||
|
||||
int64_t m_width;
|
||||
int64_t m_height;
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
glm::vec2 m_mousePosition;
|
||||
glm::vec2 m_mousePositionLast;
|
||||
|
Loading…
Reference in New Issue
Block a user