Skip to content

Commit

Permalink
pizdec();
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyAdd committed Jan 7, 2025
1 parent f3bc0c0 commit 167c976
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 34 deletions.
55 changes: 46 additions & 9 deletions src/gui_mobile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,22 @@ bool HacksLayer::setup() {
auto engineTab = CCMenu::create();
engineTab->setContentSize({325, 210});

record_toggle = CCMenuItemExt::createTogglerWithStandardSprites(0.75f, [this, &config, &engine](CCMenuItemToggler* sender) {
auto info_label = CCLabelBMFont::create(fmt::format("Frame: {}\nReplay Size: {}", engine.get_frame(), engine.get_actions_size()).c_str(), "chatFont.fnt");
info_label->setAnchorPoint({0.f, 0.5f});
info_label->setPosition({8, 15});
info_label->setScale(0.5f);
engineTab->addChild(info_label);

record_toggle = CCMenuItemExt::createTogglerWithStandardSprites(0.75f, [this, &config, &engine, info_label](CCMenuItemToggler* sender) {
play_toggle->toggle(false);
if (!sender->isOn()) {
bool canRecord = (!engine.engine_v2 && config.get<bool>("tps_enabled", false)) || (engine.engine_v2 && !config.get<bool>("tps_enabled", false));

if (canRecord)
{
engine.clear();
engine.mode = state::record;
info_label->setString(fmt::format("Frame: {}\nReplay Size: {}/{}", engine.get_frame(), engine.get_current_index(), engine.get_actions_size()).c_str());
}
else
{
Expand Down Expand Up @@ -272,12 +280,6 @@ bool HacksLayer::setup() {
replayListClick->setPosition({255.f, 155.f});
engineTab->addChild(replayListClick);

auto info_label = CCLabelBMFont::create(fmt::format("Frame: {}\nReplay Size: {}", engine.get_frame(), engine.get_actions_size()).c_str(), "chatFont.fnt");
info_label->setAnchorPoint({0.f, 0.5f});
info_label->setPosition({8, 15});
info_label->setScale(0.5f);
engineTab->addChild(info_label);

auto saveButton = ButtonSprite::create("Save", 40, true, "bigFont.fnt", "GJ_button_01.png", 30.f, 0.7f);
auto saveButtonClick = CCMenuItemExt::createSpriteExtra(saveButton, [this, &engine, info_label](CCMenuItemSpriteExtra* sender) {
FLAlertLayer::create("Info", engine.save(engine.replay_name).c_str(), "OK")->show();
Expand All @@ -288,7 +290,7 @@ bool HacksLayer::setup() {
auto loadButton = ButtonSprite::create("Load", 40, true, "bigFont.fnt", "GJ_button_01.png", 30.f, 0.7f);
auto loadButtonClick = CCMenuItemExt::createSpriteExtra(loadButton, [this, &engine, info_label](CCMenuItemSpriteExtra* sender) {
FLAlertLayer::create("Info", engine.load(engine.replay_name).c_str(), "OK")->show();
info_label->setString(fmt::format("Frame: {}\nReplay Size: {}", engine.get_frame(), engine.get_actions_size()).c_str());
info_label->setString(fmt::format("Frame: {}\nReplay Size: {}/{}", engine.get_frame(), engine.get_current_index(), engine.get_actions_size()).c_str());
});
loadButtonClick->setPosition({95, 120});
engineTab->addChild(loadButtonClick);
Expand Down Expand Up @@ -334,8 +336,43 @@ bool HacksLayer::setup() {
engineTab->addChild(engineV2_label);

auto justATestButton = ButtonSprite::create("Just a test", 80, true, "bigFont.fnt", "GJ_button_01.png", 30.f, 0.7f);
auto justATestButtonClick = CCMenuItemExt::createSpriteExtra(justATestButton, [this, &engine, info_label](CCMenuItemSpriteExtra* sender) {
auto justATestButtonClick = CCMenuItemExt::createSpriteExtra(justATestButton, [this](CCMenuItemSpriteExtra* sender) {
auto& recorder = Recorder::get();

if (recorder.is_recording) {
recorder.stop();
FLAlertLayer::create("Recorder", "Recording stopped!", "OK")->show();
}

geode::utils::file::pick(geode::utils::file::PickMode::OpenFolder, {std::nullopt, {}}).listen(
[&](geode::Result<std::filesystem::path>* path) {
if (!path->isErr()) {
auto path_final = path->unwrap();
auto pl = PlayLayer::get();
if (pl) {
recorder.folderShowcasesPath = path_final;

recorder.video_name = pl->m_level->m_levelName + ".flvc";

auto size = CCEGLView::get()->getFrameSize();
recorder.width = size.width;
recorder.height = size.height;

if (!recorder.is_recording) {
recorder.start("");
FLAlertLayer::create("Recorder", fmt::format("Recording started!\nFilename: {}\nPath {}\nSize: {}x{}\nFPS: {}",
recorder.video_name, recorder.folderShowcasesPath, recorder.width, recorder.height, recorder.fps).c_str(), "OK")->show();
}

}
else {
FLAlertLayer::create("Recorder", "Not in PlayLayer", "OK")->show();
}
}
else {
FLAlertLayer::create("Recorder", "Not selected directory", "OK")->show();
}
});
});
justATestButtonClick->setPosition({270, 25});
engineTab->addChild(justATestButtonClick);
Expand Down
26 changes: 1 addition & 25 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,28 +242,4 @@ std::string utilsH::GetKeyName(int key) {
default: return "Unknown";
}
}
#endif


void utilsH::getFolder() {
geode::utils::file::pick(geode::utils::file::PickMode::OpenFolder, {std::nullopt, {}}).listen(
[](geode::Result<std::filesystem::path>* path) {
if (!path->isErr()) {
auto path_final = path->unwrap();
geode::log::debug("{}", path_final);
std::ofstream outFile(path_final / "replay_engine.txt");

if (outFile.is_open()) {
outFile << "Hello, this is a text file saved by C++!" << std::endl;
outFile.close();

FLAlertLayer::create("Info", fmt::format("Saved as {}", path_final / "replay_engine.txt"), "OK")->show();
} else {
FLAlertLayer::create("Info", fmt::format("Error openning file"), "OK")->show();
}
}
else {
FLAlertLayer::create("info", "goddamn??", "OK")->show();
}
});
}
#endif

0 comments on commit 167c976

Please sign in to comment.