Skip to content

Commit

Permalink
update metadata and bump to 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Jun 28, 2024
1 parent fb559e9 commit af29605
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 17 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog

## v0.2.0-alpha
* Implemented simple curve drawing support with the use of Anti-Grain Geometry library

## v0.1.1-alpha
* Added Android support in mod.json

## v0.1.0-alpha
* Initial release, only supports line drawings.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"win": "2.206",
"android": "2.206"
},
"version": "v0.1.1-alpha",
"version": "v0.2.0-alpha",
"id": "alk.allium",
"name": "Allium Drawing Tool",
"developer": "alk",
Expand Down
40 changes: 24 additions & 16 deletions src/hooks/EditorUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <manager/BrushManager.hpp>
#include <ui/AlliumPopup.hpp>
#include <util/BrushDrawer.hpp>
#include <geode.custom-keybinds/include/Keybinds.hpp>

using namespace geode::prelude;
using namespace allium;
Expand Down Expand Up @@ -44,19 +45,6 @@ struct EditorUIHook : Modify<EditorUIHook, EditorUI> {
return true;
}

$override
void keyDown(enumKeyCodes key) {
if (key == KEY_Enter) {
if (BrushManager::get()->m_currentDrawer) {
BrushManager::get()->m_currentDrawer->clearOverlay();
BrushManager::get()->m_currentDrawer->updateLine();
}
}
else {
EditorUI::keyDown(key);
}
}

CCPoint getLayerPosition(CCTouch* touch) {
auto objectLayer = LevelEditorLayer::get()->m_objectLayer;
auto glPoint = CCDirector::get()->convertToGL(touch->getLocationInView());
Expand Down Expand Up @@ -101,7 +89,27 @@ struct EditorUIHook : Modify<EditorUIHook, EditorUI> {
EditorUI::showUI(show);

auto alliumButton = static_cast<CCMenuItemSpriteExtra*>(this->getChildByIDRecursive("allium-button"_spr));
alliumButton->setEnabled(show);
alliumButton->setVisible(show);
if (alliumButton) {
alliumButton->setEnabled(show);
alliumButton->setVisible(show);
}

auto finalizeButton = static_cast<CCMenuItem*>(this->getChildByIDRecursive("allium-finalize-button"_spr));
if (finalizeButton) {
finalizeButton->setEnabled(show);
finalizeButton->setVisible(show);
}
}
};
};

$execute {
using namespace keybinds;

BindManager::get()->registerBindable({
"finalize-brush"_spr,
"Finalize brush",
"Finalizes the brush created by the drawer.",
{ Keybind::create(KEY_Enter, Modifier::None) },
"Allium/Brushes"
});
}
28 changes: 28 additions & 0 deletions src/ui/AlliumPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ void AlliumPopup::brushToggleCallback(CCMenuItemToggler* toggle) {
brushDrawer->removeFromParent();
brushDrawer = nullptr;
}
auto buttonMenu = EditorUI::get()->getChildByID("editor-buttons-menu");
auto finalizeButton = static_cast<CCMenuItem*>(buttonMenu->getChildByID("allium-finalize-button"_spr));
if (finalizeButton) {
finalizeButton->removeFromParent();
}

if (toggle == m_lineBrushToggle) {
brushDrawer = LineBrushDrawer::create();
Expand All @@ -39,6 +44,29 @@ void AlliumPopup::brushToggleCallback(CCMenuItemToggler* toggle) {
else if (toggle == m_curveBrushToggle) {
brushDrawer = CurveBrushDrawer::create();

auto topSprite = CCLabelBMFont::create("Finalize", "bigFont.fnt");

auto mySprite = BasedButtonSprite::create(
topSprite, BaseType::Editor,
static_cast<int>(EditorBaseSize::Normal), static_cast<int>(EditorBaseColor::Orange)
);
mySprite->setTopRelativeScale(1.6f);

auto myButton = CCMenuItemExt::createSpriteExtra(
mySprite, [this](CCObject* sender) {
if (BrushManager::get()->m_currentDrawer) {
BrushManager::get()->m_currentDrawer->clearOverlay();
BrushManager::get()->m_currentDrawer->updateLine();
}
}
);
myButton->setID("allium-finalize-button"_spr);
// size set in Node IDs itself
myButton->setContentSize({ 40.f, 40.f });

buttonMenu->addChild(myButton);
buttonMenu->updateLayout();

BrushManager::get()->m_currentBrush = BrushType::Curve;
}
else {
Expand Down

0 comments on commit af29605

Please sign in to comment.