Fixed a lot of MSVC compiler warnings.

This commit is contained in:
Leon Styhre 2020-12-29 12:54:24 +01:00
parent 53bb5bb2ea
commit c95334756d
26 changed files with 61 additions and 62 deletions

View file

@ -727,7 +727,7 @@ FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* s
std::string desc = "This collection is empty."; std::string desc = "This collection is empty.";
std::vector<FileData*> gamesList = rootFolder->getChildren(); std::vector<FileData*> gamesList = rootFolder->getChildren();
std::vector<FileData*> gamesListRandom; std::vector<FileData*> gamesListRandom;
unsigned int gameCount = gamesList.size(); unsigned int gameCount = static_cast<unsigned int>(gamesList.size());
// If there is more than 1 game in the collection, then randomize the example game names. // If there is more than 1 game in the collection, then randomize the example game names.
if (gameCount > 1) { if (gameCount > 1) {

View file

@ -167,7 +167,7 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
// been used for scraping the ratings, or if the gamelist.xml file // been used for scraping the ratings, or if the gamelist.xml file
// has been manually edited. // has been manually edited.
ratingNumber = static_cast<int>( ratingNumber = static_cast<int>(
(ceilf(stof(ratingString) / 0.1) / 10) * 5); (ceilf(stof(ratingString) / 0.1f) / 10) * 5);
if (ratingNumber < 0) if (ratingNumber < 0)
ratingNumber = 0; ratingNumber = 0;

View file

@ -107,9 +107,9 @@ GuiMetaDataEd::GuiMetaDataEd(
case MD_BOOL: { case MD_BOOL: {
ed = std::make_shared<SwitchComponent>(window); ed = std::make_shared<SwitchComponent>(window);
// Make the switches slightly smaller. // Make the switches slightly smaller.
auto switchSize = ed->getSize() * 0.9; auto switchSize = ed->getSize() * 0.9f;
ed->setResize(switchSize.x(), switchSize.y()); ed->setResize(switchSize.x(), switchSize.y());
ed->setOrigin(-0.05, -0.09); ed->setOrigin(-0.05f, -0.09f);
ed->setChangedColor(ICONCOLOR_USERMARKED); ed->setChangedColor(ICONCOLOR_USERMARKED);
row.addElement(ed, false, true); row.addElement(ed, false, true);

View file

@ -327,7 +327,7 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
if (game.child("note")) { if (game.child("note")) {
float ratingVal = (game.child("note").text().as_int() / 20.0f); float ratingVal = (game.child("note").text().as_int() / 20.0f);
// Round up to the closest .1 value, i.e. to the closest half-star. // Round up to the closest .1 value, i.e. to the closest half-star.
ratingVal = ceilf(ratingVal / 0.1) / 10; ratingVal = ceilf(ratingVal / 0.1f) / 10;
std::stringstream ss; std::stringstream ss;
ss << ratingVal; ss << ratingVal;
if (ratingVal > 0) { if (ratingVal > 0) {

View file

@ -713,14 +713,14 @@ void ViewController::render(const Transform4x4f& parentTrans)
if (mFadeOpacity) { if (mFadeOpacity) {
unsigned int fadeColor = 0x00000000 | static_cast<unsigned char>(mFadeOpacity * 255); unsigned int fadeColor = 0x00000000 | static_cast<unsigned char>(mFadeOpacity * 255);
Renderer::setMatrix(parentTrans); Renderer::setMatrix(parentTrans);
Renderer::drawRect(0.0f, 0.0f, Renderer::getScreenWidth(), Renderer::drawRect(0.0f, 0.0f, static_cast<float>(Renderer::getScreenWidth()),
Renderer::getScreenHeight(), fadeColor, fadeColor); static_cast<float>(Renderer::getScreenHeight()), fadeColor, fadeColor);
} }
} }
void ViewController::preload() void ViewController::preload()
{ {
unsigned int systemCount = SystemData::sSystemVector.size(); unsigned int systemCount = static_cast<int>(SystemData::sSystemVector.size());
for (auto it = SystemData::sSystemVector.cbegin(); for (auto it = SystemData::sSystemVector.cbegin();
it != SystemData::sSystemVector.cend(); it ++) { it != SystemData::sSystemVector.cend(); it ++) {

View file

@ -230,7 +230,6 @@ bool GridGameListView::input(InputConfig* config, Input input)
const std::string GridGameListView::getImagePath(FileData* file) const std::string GridGameListView::getImagePath(FileData* file)
{ {
ImageSource src = mGrid.getImageSource(); ImageSource src = mGrid.getImageSource();
FileData* returnFile;
if (src == ImageSource::IMAGE) if (src == ImageSource::IMAGE)
return file->getImagePath(); return file->getImagePath();

View file

@ -396,11 +396,13 @@ void ISimpleGameListView::generateGamelistInfo(FileData* cursor, FileData* first
if (idx->isFiltered()) { if (idx->isFiltered()) {
mIsFiltered = true; mIsFiltered = true;
mFilteredGameCount = rootFolder->getFilesRecursive(GAME, true, false).size(); mFilteredGameCount = static_cast<unsigned int>(rootFolder->
getFilesRecursive(GAME, true, false).size());
// Also count the games that are set to not be counted as games, as the filter may // Also count the games that are set to not be counted as games, as the filter may
// apply to such entries as well and this will be indicated with a separate '+ XX' // apply to such entries as well and this will be indicated with a separate '+ XX'
// in the GamelistInfo field. // in the GamelistInfo field.
mFilteredGameCountAll = rootFolder->getFilesRecursive(GAME, true, true).size(); mFilteredGameCountAll = static_cast<unsigned int>(rootFolder->
getFilesRecursive(GAME, true, true).size());
} }
if (firstEntry->getParent() && firstEntry->getParent()->getType() == FOLDER) if (firstEntry->getParent() && firstEntry->getParent()->getType() == FOLDER)

View file

@ -151,8 +151,8 @@ void AudioManager::mixAudio(void* /*unused*/, Uint8* stream, int len)
} }
// Mix sample into stream. // Mix sample into stream.
SDL_MixAudioFormat(stream, &(sound->getData()[sound->getPosition()]), SDL_MixAudioFormat(stream, &(sound->getData()[sound->getPosition()]),
sAudioFormat.format, restLength, sAudioFormat.format, restLength, static_cast<int>(Settings::getInstance()->
Settings::getInstance()->getInt("SoundVolumeNavigation") * 1.28f); getInt("SoundVolumeNavigation") * 1.28f));
if (sound->getPosition() + restLength < sound->getLength()) { if (sound->getPosition() + restLength < sound->getLength()) {
// Sample hasn't ended yet. // Sample hasn't ended yet.
stillPlaying = true; stillPlaying = true;
@ -204,7 +204,8 @@ void AudioManager::mixAudio(void* /*unused*/, Uint8* stream, int len)
if (processedLength > 0) if (processedLength > 0)
SDL_MixAudioFormat(stream, converted, sAudioFormat.format, processedLength, SDL_MixAudioFormat(stream, converted, sAudioFormat.format, processedLength,
Settings::getInstance()->getInt("SoundVolumeVideos") * 1.28); static_cast<int>(Settings::getInstance()->
getInt("SoundVolumeVideos") * 1.28f));
} }
delete[] converted; delete[] converted;

View file

@ -354,7 +354,7 @@ void ComponentGrid::render(const Transform4x4f& parentTrans)
if (mLines.size()) { if (mLines.size()) {
Renderer::setMatrix(trans); Renderer::setMatrix(trans);
Renderer::bindTexture(0); Renderer::bindTexture(0);
Renderer::drawLines(&mLines[0], mLines.size()); Renderer::drawLines(&mLines[0], static_cast<const unsigned int>(mLines.size()));
} }
} }

View file

@ -101,7 +101,7 @@ bool ComponentList::input(InputConfig* config, Input input)
} }
else if (config->isMappedLike("righttrigger", input)) { else if (config->isMappedLike("righttrigger", input)) {
if (input.value != 0) { if (input.value != 0) {
mSelectorBarOffset = mEntries.size() - 1; mSelectorBarOffset = mEntries.size() - 1.0f;
return listLastRow(); return listLastRow();
} }
} }
@ -254,7 +254,7 @@ void ComponentList::render(const Transform4x4f& parentTrans)
// Custom rendering. // Custom rendering.
Renderer::setMatrix(trans); Renderer::setMatrix(trans);
float opacity = mOpacity / 255.0; float opacity = mOpacity / 255.0f;
// Draw selector bar. // Draw selector bar.
if (mFocused) { if (mFocused) {

View file

@ -213,7 +213,7 @@ void GridTileComponent::setSelected(bool selected, bool allowAnimation,
auto func = [this](float t) { auto func = [this](float t) {
t -= 1; // Cubic ease out. t -= 1; // Cubic ease out.
float pct = Math::lerp(0, 1, t*t*t + 1); float pct = Math::lerp(0, 1, t*t*t + 1);
this->setSelectedZoom(1.0 - pct); this->setSelectedZoom(1.0f - pct);
}; };
cancelAnimation(3); cancelAnimation(3);
@ -271,7 +271,7 @@ void GridTileComponent::calcCurrentProperties()
{ {
mCurrentProperties = mSelected ? mSelectedProperties : mDefaultProperties; mCurrentProperties = mSelected ? mSelectedProperties : mDefaultProperties;
float zoomPercentInverse = 1.0 - mSelectedZoomPercent; float zoomPercentInverse = 1.0f - mSelectedZoomPercent;
if (mSelectedZoomPercent != 0.0f && mSelectedZoomPercent != 1.0f) { if (mSelectedZoomPercent != 0.0f && mSelectedZoomPercent != 1.0f) {
if (mDefaultProperties.mSize != mSelectedProperties.mSize) if (mDefaultProperties.mSize != mSelectedProperties.mSize)

View file

@ -235,7 +235,7 @@ protected:
bool listLastRow() bool listLastRow()
{ {
mCursor = mEntries.size() - 1; mCursor = static_cast<int>(mEntries.size()) - 1;
onCursorChanged(CURSOR_STOPPED); onCursorChanged(CURSOR_STOPPED);
onScroll(); onScroll();
return true; return true;

View file

@ -337,7 +337,7 @@ void ImageComponent::updateVertices()
void ImageComponent::updateColors() void ImageComponent::updateColors()
{ {
const float opacity = (mOpacity * (mFading ? mFadeOpacity / 255.0 : 1.0)) / 255.0; const float opacity = (mOpacity * (mFading ? mFadeOpacity / 255.0f : 1.0f)) / 255.0f;
const unsigned int color = Renderer::convertRGBAToABGR((mColorShift & 0xFFFFFF00) | const unsigned int color = Renderer::convertRGBAToABGR((mColorShift & 0xFFFFFF00) |
static_cast<unsigned char>((mColorShift & 0xFF) * opacity)); static_cast<unsigned char>((mColorShift & 0xFF) * opacity));
const unsigned int colorEnd = Renderer::convertRGBAToABGR((mColorShiftEnd & 0xFFFFFF00) | const unsigned int colorEnd = Renderer::convertRGBAToABGR((mColorShiftEnd & 0xFFFFFF00) |

View file

@ -399,7 +399,7 @@ void ImageGridComponent<T>::onCursorChanged(const CursorState& state)
int oldCol = (mLastCursor / dimOpposite); int oldCol = (mLastCursor / dimOpposite);
int col = (mCursor / dimOpposite); int col = (mCursor / dimOpposite);
int lastCol = ((mEntries.size() - 1) / dimOpposite); int lastCol = static_cast<int>((mEntries.size() - 1) / dimOpposite);
int lastScroll = std::max(0, (lastCol + 1 - dimScrollable)); int lastScroll = std::max(0, (lastCol + 1 - dimScrollable));
@ -423,9 +423,9 @@ void ImageGridComponent<T>::onCursorChanged(const CursorState& state)
int newIdx = mCursor - mStartPosition + (dimOpposite * EXTRAITEMS); int newIdx = mCursor - mStartPosition + (dimOpposite * EXTRAITEMS);
if (isScrollLoop()) { if (isScrollLoop()) {
if (newIdx < 0) if (newIdx < 0)
newIdx += mEntries.size(); newIdx += static_cast<int>(mEntries.size());
else if (newIdx >= mTiles.size()) else if (newIdx >= mTiles.size())
newIdx -= mEntries.size(); newIdx -= static_cast<int>(mEntries.size());
} }
if (newIdx >= 0 && newIdx < mTiles.size()) if (newIdx >= 0 && newIdx < mTiles.size())
@ -626,9 +626,9 @@ void ImageGridComponent<T>::updateTileAtPos(int tilePos, int imgPos,
if (isScrollLoop()) { if (isScrollLoop()) {
if (imgPos < 0) if (imgPos < 0)
imgPos += mEntries.size(); imgPos += static_cast<int>(mEntries.size());
else if (imgPos >= size()) else if (imgPos >= size())
imgPos -= mEntries.size(); imgPos -= static_cast<int>(mEntries.size());
} }
// If we have more tiles than we have to display images on screen, hide them. // If we have more tiles than we have to display images on screen, hide them.
@ -686,7 +686,8 @@ void ImageGridComponent<T>::calcGridDimension()
mLastRowPartial = floorf(gridDimension.y()) != gridDimension.y(); mLastRowPartial = floorf(gridDimension.y()) != gridDimension.y();
// Ceil y dim so we can display partial last row. // Ceil y dim so we can display partial last row.
mGridDimension = Vector2i(gridDimension.x(), ceilf(gridDimension.y())); mGridDimension = Vector2i(static_cast<const int>(gridDimension.x()),
static_cast<const int>(ceilf(gridDimension.y())));
// Grid dimension validation. // Grid dimension validation.
if (mGridDimension.x() < 1) { if (mGridDimension.x() < 1) {

View file

@ -116,7 +116,7 @@ void NinePatchComponent::render(const Transform4x4f& parentTrans)
Renderer::setMatrix(trans); Renderer::setMatrix(trans);
if (mOpacity < 255) { if (mOpacity < 255) {
mVertices[0].shaders = Renderer::SHADER_OPACITY; mVertices[0].shaders = Renderer::SHADER_OPACITY;
mVertices[0].opacity = mOpacity / 255.0; mVertices[0].opacity = mOpacity / 255.0f;
} }
else if (mVertices[0].shaders & Renderer::SHADER_OPACITY) { else if (mVertices[0].shaders & Renderer::SHADER_OPACITY) {
// We have reached full opacity, so disable the opacity shader and set // We have reached full opacity, so disable the opacity shader and set
@ -136,17 +136,6 @@ void NinePatchComponent::onSizeChanged()
buildVertices(); buildVertices();
} }
const Vector2f& NinePatchComponent::getCornerSize() const
{
return mCornerSize;
}
void NinePatchComponent::setCornerSize(int sizeX, int sizeY)
{
mCornerSize = Vector2f(sizeX, sizeY);
buildVertices();
}
void NinePatchComponent::fitTo(Vector2f size, Vector3f position, Vector2f padding) void NinePatchComponent::fitTo(Vector2f size, Vector3f position, Vector2f padding)
{ {
size += padding; size += padding;

View file

@ -49,9 +49,12 @@ public:
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view, virtual void applyTheme(const std::shared_ptr<ThemeData>& theme, const std::string& view,
const std::string& element, unsigned int properties) override; const std::string& element, unsigned int properties) override;
const Vector2f& getCornerSize() const; inline const Vector2f& getCornerSize() const { return mCornerSize; };
void setCornerSize(int sizeX, int sizeY); inline void setCornerSize(const Vector2f& size)
inline void setCornerSize(const Vector2f& size) { setCornerSize(size.x(), size.y()); } {
mCornerSize = size;
buildVertices();
};
private: private:
void buildVertices(); void buildVertices();

View file

@ -39,7 +39,7 @@ void RatingComponent::setValue(const std::string& value)
} }
else { else {
// Round up to the closest .1 value, i.e. to the closest half-icon. // Round up to the closest .1 value, i.e. to the closest half-icon.
mValue = ceilf(stof(value) / 0.1) / 10; mValue = ceilf(stof(value) / 0.1f) / 10;
mOriginalValue = static_cast<int>(mValue * 10); mOriginalValue = static_cast<int>(mValue * 10);
// If the argument to colorize the rating icons has been passed, set the // If the argument to colorize the rating icons has been passed, set the

View file

@ -93,7 +93,7 @@ void ScrollableContainer::update(int deltaTime)
const float widthMod = contentSize.x() / AUTO_WIDTH_MOD; const float widthMod = contentSize.x() / AUTO_WIDTH_MOD;
if (mAutoScrollSpeed != 0) { if (mAutoScrollSpeed != 0) {
mAutoScrollAccumulator += deltaTime / widthMod; mAutoScrollAccumulator += deltaTime / static_cast<int>(widthMod);
while (mAutoScrollAccumulator >= mAutoScrollSpeed) { while (mAutoScrollAccumulator >= mAutoScrollSpeed) {
mScrollPos += mScrollDir; mScrollPos += mScrollDir;

View file

@ -236,7 +236,8 @@ void TextListComponent<T>::render(const Transform4x4f& parentTrans)
offset[0] = mHorizontalMargin; offset[0] = mHorizontalMargin;
break; break;
case ALIGN_CENTER: case ALIGN_CENTER:
offset[0] = static_cast<int>((mSize.x() - entry.data.textCache->metrics.size.x()) / 2); offset[0] = static_cast<float>((mSize.x() -
entry.data.textCache->metrics.size.x()) / 2);
if (offset[0] < mHorizontalMargin) if (offset[0] < mHorizontalMargin)
offset[0] = mHorizontalMargin; offset[0] = mHorizontalMargin;
break; break;

View file

@ -174,7 +174,7 @@ void VideoVlcComponent::render(const Transform4x4f& parentTrans)
if (mIsPlaying && mContext.valid && mIsActuallyPlaying) { if (mIsPlaying && mContext.valid && mIsActuallyPlaying) {
unsigned int color; unsigned int color;
if (mFadeIn < 1) { if (mFadeIn < 1) {
const unsigned int fadeIn = mFadeIn * 255.0f; const unsigned int fadeIn = static_cast<int>(mFadeIn * 255.0f);
color = Renderer::convertRGBAToABGR((fadeIn << 24) | color = Renderer::convertRGBAToABGR((fadeIn << 24) |
(fadeIn << 16) | (fadeIn << 8) | 255); (fadeIn << 16) | (fadeIn << 8) | 255);
} }
@ -300,7 +300,6 @@ void VideoVlcComponent::startVideo()
if (mMedia) { if (mMedia) {
unsigned track_count; unsigned track_count;
int parseResult; int parseResult;
libvlc_event_t vlcEvent;
// Asynchronous media parsing. // Asynchronous media parsing.
libvlc_event_attach(libvlc_media_event_manager(mMedia), libvlc_event_attach(libvlc_media_event_manager(mMedia),

View file

@ -80,7 +80,7 @@ GuiComplexTextEditPopup::GuiComplexTextEditPopup(
mGrid.setEntry(mText, Vector2i(0, 3), true, false, Vector2i(1, 1), mGrid.setEntry(mText, Vector2i(0, 3), true, false, Vector2i(1, 1),
GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM); GridFlags::BORDER_TOP | GridFlags::BORDER_BOTTOM);
mGrid.setEntry(mButtonGrid, Vector2i(0, 4), true, false); mGrid.setEntry(mButtonGrid, Vector2i(0, 4), true, false);
mGrid.setRowHeightPerc(1, 0.15, true); mGrid.setRowHeightPerc(1, 0.15f, true);
float textHeight = mText->getFont()->getHeight(); float textHeight = mText->getFont()->getHeight();
@ -89,7 +89,7 @@ GuiComplexTextEditPopup::GuiComplexTextEditPopup(
mText->setSize(0, textHeight); mText->setSize(0, textHeight);
setSize(Renderer::getScreenWidth() * 0.75f, mTitle->getFont()->getHeight() + setSize(Renderer::getScreenWidth() * 0.75f, mTitle->getFont()->getHeight() +
textHeight + mButtonGrid->getSize().y() + mButtonGrid->getSize().y() * 1.85); textHeight + mButtonGrid->getSize().y() + mButtonGrid->getSize().y() * 1.85f);
setPosition((Renderer::getScreenWidth() - mSize.x()) / 2, setPosition((Renderer::getScreenWidth() - mSize.x()) / 2,
(Renderer::getScreenHeight() - mSize.y()) / 2); (Renderer::getScreenHeight() - mSize.y()) / 2);
mText->startEditing(); mText->startEditing();

View file

@ -229,7 +229,8 @@ namespace Renderer
viewport.y = screenOffsetY; viewport.y = screenOffsetY;
viewport.w = screenWidth; viewport.w = screenWidth;
viewport.h = screenHeight; viewport.h = screenHeight;
projection.orthoProjection(0, screenWidth, screenHeight, 0, -1.0, 1.0); projection.orthoProjection(0.0f, static_cast<float>(screenWidth),
static_cast<float>(screenHeight), 0.0f, -1.0f, 1.0f);
} }
break; break;
case 1: { case 1: {
@ -237,7 +238,8 @@ namespace Renderer
viewport.y = screenOffsetX; viewport.y = screenOffsetX;
viewport.w = screenHeight; viewport.w = screenHeight;
viewport.h = screenWidth; viewport.h = screenWidth;
projection.orthoProjection(0, screenHeight, screenWidth, 0, -1.0, 1.0); projection.orthoProjection(0.0f, static_cast<float>(screenHeight),
static_cast<float>(screenWidth), 0.0f, -1.0f, 1.0f);
projection.rotate(static_cast<float>(ES_DEG_TO_RAD(90)), {0, 0, 1}); projection.rotate(static_cast<float>(ES_DEG_TO_RAD(90)), {0, 0, 1});
projection.translate({0, screenHeight * -1.0f, 0}); projection.translate({0, screenHeight * -1.0f, 0});
} }
@ -247,7 +249,8 @@ namespace Renderer
viewport.y = windowHeight - screenOffsetY - screenHeight; viewport.y = windowHeight - screenOffsetY - screenHeight;
viewport.w = screenWidth; viewport.w = screenWidth;
viewport.h = screenHeight; viewport.h = screenHeight;
projection.orthoProjection(0, screenWidth, screenHeight, 0, -1.0, 1.0); projection.orthoProjection(0.0f, static_cast<float>(screenWidth),
static_cast<float>(screenHeight), 0.0f, -1.0f, 1.0f);
projection.rotate(static_cast<float>(ES_DEG_TO_RAD(180)), {0, 0, 1}); projection.rotate(static_cast<float>(ES_DEG_TO_RAD(180)), {0, 0, 1});
projection.translate({screenWidth * -1.0f, screenHeight * -1.0f, 0}); projection.translate({screenWidth * -1.0f, screenHeight * -1.0f, 0});
} }
@ -257,7 +260,8 @@ namespace Renderer
viewport.y = windowHeight - screenOffsetX - screenWidth; viewport.y = windowHeight - screenOffsetX - screenWidth;
viewport.w = screenHeight; viewport.w = screenHeight;
viewport.h = screenWidth; viewport.h = screenWidth;
projection.orthoProjection(0, screenHeight, screenWidth, 0, -1.0, 1.0); projection.orthoProjection(0.0f, static_cast<float>(screenHeight),
static_cast<float>(screenWidth), 0.0f, -1.0f, 1.0f);
projection.rotate(static_cast<float>(ES_DEG_TO_RAD(270)), {0, 0, 1}); projection.rotate(static_cast<float>(ES_DEG_TO_RAD(270)), {0, 0, 1});
projection.translate({screenWidth * -1.0f, 0, 0}); projection.translate({screenWidth * -1.0f, 0, 0});
} }

View file

@ -177,11 +177,11 @@ namespace Renderer
GL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture)); GL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture));
GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _repeat ? GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _repeat ?
GL_REPEAT : GL_CLAMP_TO_EDGE)); static_cast<GLfloat>(GL_REPEAT) : static_cast<GLfloat>(GL_CLAMP_TO_EDGE)));
GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _repeat ? GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _repeat ?
GL_REPEAT : GL_CLAMP_TO_EDGE)); static_cast<GLfloat>(GL_REPEAT) : static_cast<GLfloat>(GL_CLAMP_TO_EDGE)));
GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _linear ? GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _linear ?
GL_LINEAR : GL_NEAREST)); static_cast<GLfloat>(GL_LINEAR) : static_cast<GLfloat>(GL_NEAREST)));
GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); GL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
GL_CHECK_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, type, _width, _height, 0, type, GL_CHECK_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, type, _width, _height, 0, type,
@ -323,10 +323,10 @@ namespace Renderer
if (_vertices->shaders & SHADER_SCANLINES) { if (_vertices->shaders & SHADER_SCANLINES) {
Shader* runShader = getShaderProgram(SHADER_SCANLINES); Shader* runShader = getShaderProgram(SHADER_SCANLINES);
float shaderWidth = width * 1.2; float shaderWidth = width * 1.2f;
// Workaround to get the scanlines to render somehow proportional to the // Workaround to get the scanlines to render somehow proportional to the
// resolution. A better solution is for sure needed. // resolution. A better solution is for sure needed.
float shaderHeight = height + height / (static_cast<int>(height) >> 7) * 2.0; float shaderHeight = height + height / (static_cast<int>(height) >> 7) * 2.0f;
if (runShader) { if (runShader) {
runShader->activateShaders(); runShader->activateShaders();
runShader->setModelViewProjectionMatrix(getProjectionMatrix() * _trans); runShader->setModelViewProjectionMatrix(getProjectionMatrix() * _trans);

View file

@ -379,7 +379,8 @@ void Font::renderTextCache(TextCache* cache)
auto vertexList = *it; auto vertexList = *it;
Renderer::bindTexture(*it->textureIdPtr); Renderer::bindTexture(*it->textureIdPtr);
Renderer::drawTriangleStrips(&it->verts[0], it->verts.size()); Renderer::drawTriangleStrips(&it->verts[0],
static_cast<const unsigned int>(it->verts.size()));
} }
} }

View file

@ -192,7 +192,8 @@ bool TextureData::uploadAndBind()
// Upload texture. // Upload texture.
mTextureID = Renderer::createTexture(Renderer::Texture::RGBA, true, mTextureID = Renderer::createTexture(Renderer::Texture::RGBA, true,
mTile, mWidth, mHeight, mDataRGBA.data()); mTile, static_cast<const unsigned int>(mWidth),
static_cast<const unsigned int>(mHeight), mDataRGBA.data());
} }
return true; return true;
} }

View file

@ -177,8 +177,6 @@ namespace Utils
std::string getCWDPath() std::string getCWDPath()
{ {
char temp[512];
// Return current working directory. // Return current working directory.
#if defined(_WIN64) #if defined(_WIN64)
wchar_t tempWide[512]; wchar_t tempWide[512];