Skip to content
Snippets Groups Projects
Commit 490859fe authored by Nils Jonathan Friedrich Eckardt's avatar Nils Jonathan Friedrich Eckardt
Browse files

Implemented

parent e53e4713
Branches
No related tags found
2 merge requests!38Merge the level editor,!29Merge main into box2d to implement physics
/**
* TileSelector.cpp
*
* @date 06.02.2025
* @author Nils Jonathan Friedrich Eckardt implementation
*/
#include "AutomateButton.hpp"
#include "EventHandler.hpp"
#include <QMessageBox>
#include <QEvent>
namespace editor
{
AutomateButton::AutomateButton(const QString text, QWidget* parent) : QCheckBox(text,parent)
{
setChecked(false);
toggled = false;
}
void AutomateButton::changeEvent(QEvent* event)
{
QCheckBox::changeEvent(event);
toggled =!toggled;
bool isToggled= toggled;
EventHandler::send([isToggled](EventHandler* e) { e->onCheckBoxToggle(isToggled); });
}
} // namespace editor
\ No newline at end of file
/**
* TileSelector.hpp
*
* @date 06.02.2025
* @author Nils Jonathan Friedrich Eckardt implementation
*/
#pragma once
#include <QCheckBox>
#include <QString>
#include <QEvent>
namespace editor
{
class AutomateButton : public QCheckBox {
public:
AutomateButton(const QString text, QWidget *parent = nullptr);
protected:
void changeEvent(QEvent* event) override;
private:
bool toggled;
};
} // namespace editor
\ No newline at end of file
......@@ -3,6 +3,7 @@
*
* @date 29.01.2025
* @author Jonathan Dueck (jonathan.dueck@informatik.hs-fulda.de)
* @author Nils Jonathan Friedrich Eckardt onCheckBoxToggle added
*/
#pragma once
......@@ -95,6 +96,13 @@ public:
*/
virtual void onNewTileIdSelected(uint8_t tile_id){};
/**
* Overwrite this event method to handle the change of tile placement method due
* to the user selecting automatic tile placement assisstance.
* @param isToggled Boolean that enables tile placing assisstment.
*/
virtual void onCheckBoxToggle(bool isToggled){};
/**
* Overwrite this event method to handle the dispatch of a new delta due to
* the user pressing the zoom in or zoom out button.
......
......@@ -3,6 +3,7 @@
*
* @date 28.01.2025
* @author Jonathan Dueck (jonathan.dueck@informatik.hs-fulda.de)
* @author Nils Jonathan Friedrich Eckardt minor change
*/
#include "TopBar.hpp"
......@@ -16,6 +17,7 @@
#include "ZoomInButton.hpp"
#include "ZoomInfo.hpp"
#include "ZoomOutButton.hpp"
#include "AutomateButton.hpp"
namespace editor
{
......@@ -39,6 +41,7 @@ TopBar::TopBar(const std::string& level_name, QWidget* parent) : QToolBar(parent
QPushButton* zoom_in = new ZoomInButton(right_container);
QPushButton* zoom_out = new ZoomOutButton(right_container);
QPushButton* zoom_info = new ZoomInfo(right_container);
AutomateButton* checkedBox = new AutomateButton("Kacheln automatisch setzen", container);
right_layout->addStretch();
right_layout->addWidget(zoom_out);
right_layout->addWidget(zoom_info);
......@@ -50,6 +53,7 @@ TopBar::TopBar(const std::string& level_name, QWidget* parent) : QToolBar(parent
right_container->setFixedWidth(300);
main_layout->addWidget(left_container, 1);
main_layout->addWidget(right_container);
main_layout->addWidget(checkedBox);
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // Allow resizing
this->addWidget(container);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment