From 9443e89d337ec4e695dd4f02ec7b2f5fd9a7ddfe Mon Sep 17 00:00:00 2001 From: eniko <grodvalt.eniko.agnes@hallgato.ppke.hu> Date: Fri, 2 May 2025 15:47:39 +0200 Subject: [PATCH] athelyez fuggveny, jatekmester class (rossz) --- app.cpp | 16 ++-------------- main.cpp | 10 ++++++++-- pont.cpp | 5 +++++ pont.hpp | 1 + widgets.cpp | 1 + 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app.cpp b/app.cpp index 6113352..ed5732e 100644 --- a/app.cpp +++ b/app.cpp @@ -54,20 +54,8 @@ void App::event_loop() { } else if(ev.type == ev_key) { - if(ev.keycode == key_enter) - action("enter"); - - if(ev.keycode == key_pgdn) - action("checkbox_-10"); - - else if(ev.keycode == key_pgup) - action("checkbox_10"); - - else if(ev.keycode == key_up) - action("checkbox_1"); - - else if(ev.keycode == key_down) - action("checkbox_-1"); + /*if(ev.keycode == key_enter) + action("enter");*/ } if (focus!=-1) { widgets[focus]->handle(ev); diff --git a/main.cpp b/main.cpp index 6501adb..c29b70e 100644 --- a/main.cpp +++ b/main.cpp @@ -3,12 +3,12 @@ #include "app.hpp" #include "pont.hpp" #include "korong.hpp" +//#include "jatekmester.hpp" #include <vector> #include <string> #include <fstream> #include <iostream> -#include <cmath> using namespace std; using namespace genv; @@ -49,15 +49,21 @@ public: jatekos.push_back(new Korong(this, xj, y, 25, 1)); ellenfel.push_back(new Korong(this, xe, y, 25, 0)); } + + //gameManager = new JatekMester(pontok, jatekos, ellenfel); } void action(string id) - {} + { + + + } protected: vector<vector<Pont*>> pontok; vector<Korong*> jatekos; vector<Korong*> ellenfel; + //JatekMester* gameManager; }; int main() diff --git a/pont.cpp b/pont.cpp index 90a73e1..fd9f4d4 100644 --- a/pont.cpp +++ b/pont.cpp @@ -44,3 +44,8 @@ void Pont::handle(event ev) } } } + +vector<int> Pont::koordinata() const +{ + return {_x, _y}; +} diff --git a/pont.hpp b/pont.hpp index 0eca1a9..d8b84b1 100644 --- a/pont.hpp +++ b/pont.hpp @@ -15,6 +15,7 @@ public: virtual void draw() override; virtual void handle(genv::event ev) override; virtual bool is_selected(int mouse_x, int mouse_y) override; + std::vector<int> koordinata() const; }; #endif // PONT_HPP diff --git a/widgets.cpp b/widgets.cpp index 66e4418..248cf67 100644 --- a/widgets.cpp +++ b/widgets.cpp @@ -1,6 +1,7 @@ #include "widgets.hpp" #include "graphics.hpp" #include "app.hpp" + using namespace genv; Widget::Widget(App *parent, int x, int y, int sx, int sy) : -- GitLab