Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions platforms/ios/minecraftpe-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ReMinecraftPE</string>
<string>ReMCPE</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFiles</key>
Expand Down Expand Up @@ -36,8 +36,6 @@
<array/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
Expand All @@ -48,5 +46,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
4 changes: 1 addition & 3 deletions platforms/ios/minecraftpeViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ - (void)initView
//[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDrawSize) name:UIDeviceOrientationDidChangeNotification object:nil];

/*Minecraft *mc = (Minecraft *)app;
mc->selectLevel("TestWorld", "Test", (int)"iOS");
mc->hostMultiplayer();
mc->setScreen(new ProgressScreen);*/
mc->selectLevel("TestWorld", "Test", (int)"iOS");*/
}

- (NSInteger)animationFrameInterval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ SDKROOT = $(SDKROOT_IOS)
ARCHS_IOS = armv6 armv7 armv7s arm64
ARCHS = $(ARCHS_IOS)

IPHONEOS_DEPLOYMENT_TARGET = 3.0 // iOS 3.0
IPHONEOS_DEPLOYMENT_TARGET = 5.0 // iOS 3.0
TARGETED_DEVICE_FAMILY = 1,2 // iPhone/iPad
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,8 @@
84CCBC9E2E618C1D00E251AF /* libNBT.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84CCBC452E61849800E251AF /* libNBT.a */; };
84CCBC9F2E61910500E251AF /* libClient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84B8AEE72AF188D8008DE93D /* libClient.a */; };
84CCBCA02E61910500E251AF /* libWorld.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BF630B2AF1859D008A9995 /* libWorld.a */; };
84CED51F2E672826006BC585 /* ConvertWorldScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84CED51D2E672826006BC585 /* ConvertWorldScreen.cpp */; };
84CED5202E672826006BC585 /* ConvertWorldScreen.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 84CED51E2E672826006BC585 /* ConvertWorldScreen.hpp */; };
84CEF0032AE3C97D006C5829 /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CEF0022AE3C97D006C5829 /* EAGLView.m */; };
84D9A30E2AF18EC000B00AD3 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8489B3252A86E4B0004CA8EC /* OpenGL.framework */; };
84D9A30F2AF18EE700B00AD3 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8489B3252A86E4B0004CA8EC /* OpenGL.framework */; settings = {ATTRIBUTES = (Required, ); }; };
Expand Down Expand Up @@ -2875,6 +2877,8 @@
84CCBC922E61880600E251AF /* EntityFactory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = EntityFactory.hpp; sourceTree = "<group>"; };
84CCBC952E61886800E251AF /* RakIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RakIO.cpp; sourceTree = "<group>"; };
84CCBC962E61886800E251AF /* RakIO.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RakIO.hpp; sourceTree = "<group>"; };
84CED51D2E672826006BC585 /* ConvertWorldScreen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConvertWorldScreen.cpp; sourceTree = "<group>"; };
84CED51E2E672826006BC585 /* ConvertWorldScreen.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ConvertWorldScreen.hpp; sourceTree = "<group>"; };
84CEF0012AE3C97D006C5829 /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
84CEF0022AE3C97D006C5829 /* EAGLView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EAGLView.m; sourceTree = "<group>"; };
84D6694F2B1EAEBF00B34FC1 /* GlobalDebugSettings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = GlobalDebugSettings.xcconfig; path = ../Configuration/GlobalDebugSettings.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3173,6 +3177,8 @@
840DD59E2AC810620006A435 /* ChatScreen.hpp */,
840DD59F2AC810620006A435 /* ConfirmScreen.cpp */,
840DD5A02AC810620006A435 /* ConfirmScreen.hpp */,
84CED51D2E672826006BC585 /* ConvertWorldScreen.cpp */,
84CED51E2E672826006BC585 /* ConvertWorldScreen.hpp */,
840DD5A12AC810620006A435 /* CreateWorldScreen.cpp */,
840DD5A22AC810620006A435 /* CreateWorldScreen.hpp */,
840DD5A32AC810620006A435 /* DeathScreen.cpp */,
Expand Down Expand Up @@ -5496,6 +5502,7 @@
84AA8C2B2B32F3F3003F5B82 /* LightUpdate.hpp in Headers */,
84AA8C2D2B32F3F3003F5B82 /* PatchManager.hpp in Headers */,
84AA8C2F2B32F3F3003F5B82 /* RenderChunk.hpp in Headers */,
84CED5202E672826006BC585 /* ConvertWorldScreen.hpp in Headers */,
84A2FF162DB5B7B70090CE3E /* AssetFile.hpp in Headers */,
84AA8C312B32F3F3003F5B82 /* RenderList.hpp in Headers */,
84AA8C332B32F3F3003F5B82 /* Tesselator.hpp in Headers */,
Expand Down Expand Up @@ -6729,6 +6736,7 @@
84B8AEEF2AF1890A008DE93D /* ScrolledSelectionList.cpp in Sources */,
84B8AEF02AF1890A008DE93D /* SmallButton.cpp in Sources */,
84B8AEF12AF1890A008DE93D /* TextInputBox.cpp in Sources */,
84CED51F2E672826006BC585 /* ConvertWorldScreen.cpp in Sources */,
84B8AEF22AF1890A008DE93D /* WorldSelectionList.cpp in Sources */,
84B8AEF32AF1890A008DE93D /* Gui.cpp in Sources */,
84B8AEF42AF1890A008DE93D /* GuiComponent.cpp in Sources */,
Expand Down
18 changes: 0 additions & 18 deletions platforms/sdl/base/AppPlatform_sdl_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,6 @@ void AppPlatform_sdl_base::initSoundSystem()
}
}

std::string AppPlatform_sdl_base::getDateString(int time)
{
time_t tt = time;
struct tm t;
#ifdef _WIN32
gmtime_s(&t, &tt);
#else
gmtime_r(&tt, &t);
#endif

// Format String
char buf[2048];
strftime(buf, sizeof buf, "%b %d %Y %H:%M:%S", &t);

// Return
return std::string(buf);
}

void AppPlatform_sdl_base::setIcon(const Texture& icon)
{
if (!icon.m_pixels)
Expand Down
1 change: 0 additions & 1 deletion platforms/sdl/base/AppPlatform_sdl_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class AppPlatform_sdl_base : public AppPlatform
Texture loadTexture(const std::string& path, bool bIsRequired = false) override = 0;
int getUserInputStatus() override;
SoundSystem* const getSoundSystem() const override { return m_pSoundSystem; }
std::string getDateString(int time) override;

// Also add these to allow proper turning within the game.
void setMouseGrabbed(bool b) override;
Expand Down
35 changes: 18 additions & 17 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(reminecraftpe-core)
# Build
add_library(reminecraftpe-core STATIC
common/CThread.cpp
common/DataIO.cpp
common/DataIO.cpp
common/Logger.cpp
common/Matrix.cpp
common/Mth.cpp
Expand Down Expand Up @@ -70,6 +70,7 @@ add_library(reminecraftpe-core STATIC
client/gui/Screen.cpp
client/gui/screens/OptionsScreen.cpp
client/gui/screens/StartMenuScreen.cpp
client/gui/screens/ConvertWorldScreen.cpp
client/gui/screens/CreateWorldScreen.cpp
client/gui/screens/DirectConnectScreen.cpp
client/gui/screens/DisconnectionScreen.cpp
Expand Down Expand Up @@ -138,21 +139,21 @@ add_library(reminecraftpe-core STATIC
client/player/input/TouchscreenInput_TestFps.cpp
client/player/input/UnifiedTurnBuild.cpp
client/network/ClientSideNetworkHandler.cpp
nbt/CompoundTag.cpp
nbt/DoubleTag.cpp
nbt/EndTag.cpp
nbt/FloatTag.cpp
nbt/Int8ArrayTag.cpp
nbt/Int8Tag.cpp
nbt/Int16Tag.cpp
nbt/Int32ArrayTag.cpp
nbt/Int32Tag.cpp
nbt/Int64ArrayTag.cpp
nbt/Int64Tag.cpp
nbt/ListTag.cpp
nbt/NbtIo.cpp
nbt/StringTag.cpp
nbt/Tag.cpp
nbt/CompoundTag.cpp
nbt/DoubleTag.cpp
nbt/EndTag.cpp
nbt/FloatTag.cpp
nbt/Int8ArrayTag.cpp
nbt/Int8Tag.cpp
nbt/Int16Tag.cpp
nbt/Int32ArrayTag.cpp
nbt/Int32Tag.cpp
nbt/Int64ArrayTag.cpp
nbt/Int64Tag.cpp
nbt/ListTag.cpp
nbt/NbtIo.cpp
nbt/StringTag.cpp
nbt/Tag.cpp
network/packets/UpdateBlockPacket.cpp
network/packets/RequestChunkPacket.cpp
network/packets/PlayerEquipmentPacket.cpp
Expand Down Expand Up @@ -206,7 +207,7 @@ add_library(reminecraftpe-core STATIC
world/entity/WaterAnimal.cpp
world/entity/Monster.cpp
world/entity/Rocket.cpp
world/entity/EntityFactory.cpp
world/entity/EntityFactory.cpp
world/entity/MobFactory.cpp
world/entity/Chicken.cpp
world/entity/Cow.cpp
Expand Down
15 changes: 14 additions & 1 deletion source/client/app/AppPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,20 @@ void AppPlatform::finish()

std::string AppPlatform::getDateString(int time)
{
return "";
time_t tt = time;
struct tm t;
#ifdef _WIN32
gmtime_s(&t, &tt);
#else
gmtime_r(&tt, &t);
#endif

// Format String
char buf[2048];
strftime(buf, sizeof buf, "%b %d %Y %H:%M:%S", &t);

// Return
return std::string(buf);
}

// ??? AppPlatform::getOptionStrings()
Expand Down
22 changes: 19 additions & 3 deletions source/client/app/Minecraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "client/gui/screens/RenameMPLevelScreen.hpp"
#include "client/gui/screens/SavingWorldScreen.hpp"
#include "client/gui/screens/DeathScreen.hpp"
#include "client/gui/screens/ProgressScreen.hpp"
#include "client/gui/screens/ConvertWorldScreen.hpp"
#include "network/ServerSideNetworkHandler.hpp"
#include "client/network/ClientSideNetworkHandler.hpp"

Expand Down Expand Up @@ -1145,15 +1147,29 @@ void Minecraft::setLevel(Level* pLevel, const std::string& text, LocalPlayer* pL
}
}

void Minecraft::selectLevel(const std::string& levelDir, const std::string& levelName, int c)
void Minecraft::selectLevel(const LevelSummary& ls, bool forceConversion)
{
LevelStorage* pStor = m_pLevelStorageSource->selectLevel(levelDir, false);
if (ls.m_storageVersion != LEVEL_STORAGE_VERSION_DEFAULT && !forceConversion)
{
setScreen(new ConvertWorldScreen(ls));
return;
}

selectLevel(ls.m_fileName, ls.m_levelName, 0, forceConversion);
}

void Minecraft::selectLevel(const std::string& levelDir, const std::string& levelName, int32_t seed, bool forceConversion)
{
LevelStorage* pStor = m_pLevelStorageSource->selectLevel(levelDir, false, forceConversion);
Dimension* pDim = Dimension::getNew(0);

m_pLevel = new Level(pStor, levelName, c, LEVEL_STORAGE_VERSION_DEFAULT, pDim);
m_pLevel = new Level(pStor, levelName, seed, LEVEL_STORAGE_VERSION_DEFAULT, pDim);
setLevel(m_pLevel, "Generating level", nullptr);

field_D9C = 1;

hostMultiplayer();
setScreen(new ProgressScreen);
}

const char* Minecraft::getProgressMessage()
Expand Down
3 changes: 2 additions & 1 deletion source/client/app/Minecraft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class Minecraft : public App
void saveOptions();
void handleBuildAction(const BuildActionIntention& action);
bool isLevelGenerated() const;
void selectLevel(const std::string&, const std::string&, int);
void selectLevel(const LevelSummary& ls, bool forceConversion = false);
void selectLevel(const std::string&, const std::string&, int, bool forceConversion = false);
void setLevel(Level*, const std::string&, LocalPlayer*);
bool pauseGame();
bool resumeGame();
Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/components/RolledSelectionList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void RolledSelectionList::render(int mouseX, int mouseY, float f)

float right = itemX + width;
float up = float(field_1C) / 2.0f - 48.0f - 4.0f;
float dn = float(field_1C) / 2.0f + 56.0f - 4.0f;
float dn = float(field_1C) / 2.0f + 48.0f - 4.0f;

t.vertexUV(itemX - 2, up, 0.0f, 0.0f, 0.0f);
t.vertexUV(itemX - 2, dn, 0.0f, 1.0f, 0.0f);
Expand Down
106 changes: 60 additions & 46 deletions source/client/gui/components/TextInputBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,41 +173,11 @@ void TextInputBox::keyPressed(int key)
switch (key) {
case AKEYCODE_DEL:
{
// Backspace
if (m_text.empty())
{
return;
}
if (m_insertHead <= 0)
{
return;
}
if (m_insertHead > int(m_text.size()))
{
m_insertHead = int(m_text.size());
}
m_text.erase(m_text.begin() + m_insertHead - 1, m_text.begin() + m_insertHead);
m_insertHead--;
recalculateScroll();
break;
charPressed('\b');
}
case AKEYCODE_FORWARD_DEL:
{
// Delete
if (m_text.empty())
{
return;
}
if (m_insertHead < 0)
{
return;
}
if (m_insertHead >= int(m_text.size()))
{
return;
}
m_text.erase(m_text.begin() + m_insertHead, m_text.begin() + m_insertHead + 1);
break;
charPressed(AKEYCODE_FORWARD_DEL);
}
case AKEYCODE_ARROW_LEFT:
{
Expand Down Expand Up @@ -307,20 +277,64 @@ void TextInputBox::charPressed(int k)
if (!m_bFocused)
return;

// Ignore Unprintable Characters
if (k == '\n' || k < ' ' || k > '~')
return;

// Check Max Length
if (m_maxLength != -1 && int(m_text.length()) >= m_maxLength)
{
return;
}

// Insert
m_text.insert(m_text.begin() + m_insertHead, k);
m_insertHead++;
recalculateScroll();
switch (k) {
case '\b':
{
// Backspace
if (m_text.empty())
{
return;
}
if (m_insertHead <= 0)
{
return;
}
if (m_insertHead > int(m_text.size()))
{
m_insertHead = int(m_text.size());
}
m_text.erase(m_text.begin() + m_insertHead - 1, m_text.begin() + m_insertHead);
m_insertHead--;
recalculateScroll();
break;
}
case AKEYCODE_FORWARD_DEL:
{
// Delete
if (m_text.empty())
{
return;
}
if (m_insertHead < 0)
{
return;
}
if (m_insertHead >= int(m_text.size()))
{
return;
}
m_text.erase(m_text.begin() + m_insertHead, m_text.begin() + m_insertHead + 1);
break;
}
default:
{
// Ignore Unprintable Characters
if (k == '\n' || k < ' ' || k > '~')
return;

// Check Max Length
if (m_maxLength != -1 && int(m_text.length()) >= m_maxLength)
{
return;
}

// Insert
m_text.insert(m_text.begin() + m_insertHead, k);
m_insertHead++;
recalculateScroll();
break;
}
}
}

constexpr int PADDING = 5;
Expand Down
Loading
Loading