mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
Watch out! Skins!
This commit is contained in:
@@ -3,8 +3,11 @@
|
||||
|
||||
#include "AppPlatform.h"
|
||||
#include "platform/log.h"
|
||||
#include "platform/HttpClient.h"
|
||||
#include "platform/PngLoader.h"
|
||||
#include "client/renderer/gles.h"
|
||||
#include "world/level/storage/FolderMethods.h"
|
||||
#include "util/StringUtils.h"
|
||||
#include <png.h>
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
@@ -50,10 +53,19 @@ public:
|
||||
|
||||
TextureData loadTexture(const std::string& filename_, bool textureFolder)
|
||||
{
|
||||
// Support fetching PNG textures via HTTP/HTTPS (for skins, etc).
|
||||
if (Util::startsWith(filename_, "http://") || Util::startsWith(filename_, "https://")) {
|
||||
std::vector<unsigned char> body;
|
||||
if (HttpClient::download(filename_, body) && !body.empty()) {
|
||||
return loadTextureFromMemory(body.data(), body.size());
|
||||
}
|
||||
return TextureData();
|
||||
}
|
||||
|
||||
TextureData out;
|
||||
|
||||
std::string filename = textureFolder? "data/images/" + filename_
|
||||
: filename_;
|
||||
: filename_;
|
||||
std::ifstream source(filename.c_str(), std::ios::binary);
|
||||
|
||||
if (source) {
|
||||
@@ -102,7 +114,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::string getDateString(int s) {
|
||||
TextureData loadTextureFromMemory(const unsigned char* data, size_t size) override {
|
||||
return loadPngFromMemory(data, size);
|
||||
}
|
||||
time_t tm = s;
|
||||
|
||||
char mbstr[100];
|
||||
|
||||
Reference in New Issue
Block a user