From adbb0ce0c52e2a9f0f6c52adf1d83bf351e8e1fb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Dec 2015 12:04:31 +0100 Subject: LAB: Renamed mouse.* to eventman.* --- engines/lab/eventman.h | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 engines/lab/eventman.h (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h new file mode 100644 index 0000000000..156fb96adc --- /dev/null +++ b/engines/lab/eventman.h @@ -0,0 +1,81 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on Labyrinth of Time code with assistance of + * + * Copyright (c) 1993 Terra Nova Development + * Copyright (c) 2004 The Wyrmkeep Entertainment Co. + * + */ + +#ifndef LAB_EVENTMAN_H +#define LAB_EVENTMAN_H + +namespace Lab { + +struct Gadget; + +class LabEngine; + +class EventManager { +private: + LabEngine *_vm; + bool _leftClick; + bool _rightClick; + + bool _mouseHidden; + int32 _numHidden; + Gadget *_lastGadgetHit; + uint16 _nextKeyIn; + uint16 _nextKeyOut; + Common::Point _mousePos; + bool _mouseAtEdge; + uint16 _keyBuf[64]; + +public: + EventManager (LabEngine *vm); + + Gadget *_screenGadgetList; + Gadget *_hitGadget; + + Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); + void initMouse(); + void updateMouse(); + void mouseShow(); + void mouseHide(); + Common::Point getMousePos(); + void setMousePos(Common::Point pos); + bool mouseButton(uint16 *x, uint16 *y, bool leftButton); + Gadget *mouseGadget(); + void attachGadgetList(Gadget *gadgetList); + void mouseHandler(int flag, Common::Point pos); + bool keyPress(uint16 *keyCode); + bool haveNextChar(); + void processInput(bool can_delay = false); + uint16 getNextChar(); + Common::Point updateAndGetMousePos(); +}; + +} // End of namespace Lab + +#endif /* LAB_EVENTMAN_H */ -- cgit v1.2.3 From 62c4acc6b36639ebcbd2d9161af9b563e0c561f1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 6 Dec 2015 22:50:41 +0200 Subject: LAB: Change the gadget lists to use Common::List --- engines/lab/eventman.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 156fb96adc..a156a8a823 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -55,10 +55,10 @@ private: public: EventManager (LabEngine *vm); - Gadget *_screenGadgetList; + GadgetList *_screenGadgetList; Gadget *_hitGadget; - Gadget *checkGadgetHit(Gadget *gadgetList, Common::Point pos); + Gadget *checkGadgetHit(GadgetList *gadgetList, Common::Point pos); void initMouse(); void updateMouse(); void mouseShow(); @@ -67,7 +67,7 @@ public: void setMousePos(Common::Point pos); bool mouseButton(uint16 *x, uint16 *y, bool leftButton); Gadget *mouseGadget(); - void attachGadgetList(Gadget *gadgetList); + void attachGadgetList(GadgetList *gadgetList); void mouseHandler(int flag, Common::Point pos); bool keyPress(uint16 *keyCode); bool haveNextChar(); -- cgit v1.2.3 From 6bba608fc06658cec8f0bc09874739ae8b4bc9e4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 7 Dec 2015 10:40:40 +0200 Subject: LAB: Get rid of _numHidden --- engines/lab/eventman.h | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index a156a8a823..11d8dfd7e1 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -44,7 +44,6 @@ private: bool _rightClick; bool _mouseHidden; - int32 _numHidden; Gadget *_lastGadgetHit; uint16 _nextKeyIn; uint16 _nextKeyOut; -- cgit v1.2.3 From 2d0fab7f4c1e4c7f8e88aee6a867a98a8917de86 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Dec 2015 11:27:34 +0100 Subject: LAB: Use // for comments --- engines/lab/eventman.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 11d8dfd7e1..f87d7ee2db 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -77,4 +77,4 @@ public: } // End of namespace Lab -#endif /* LAB_EVENTMAN_H */ +#endif // LAB_EVENTMAN_H -- cgit v1.2.3 From 6230fcbeb9e19c1db8bf50dd06fc02ffee925c01 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 8 Dec 2015 16:53:30 +0200 Subject: LAB: Simplify the journal and map gadget handling --- engines/lab/eventman.h | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index f87d7ee2db..420c7d03df 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -67,6 +67,7 @@ public: bool mouseButton(uint16 *x, uint16 *y, bool leftButton); Gadget *mouseGadget(); void attachGadgetList(GadgetList *gadgetList); + Gadget *getGadget(uint16 id); void mouseHandler(int flag, Common::Point pos); bool keyPress(uint16 *keyCode); bool haveNextChar(); -- cgit v1.2.3 From c837e67070913166177a19b2d0d6d925d4569c83 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 14:04:00 +0100 Subject: LAB: Move interface functions to EventMan --- engines/lab/eventman.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 420c7d03df..f9facd815b 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -31,11 +31,28 @@ #ifndef LAB_EVENTMAN_H #define LAB_EVENTMAN_H -namespace Lab { +#include "common/events.h" -struct Gadget; +namespace Lab { class LabEngine; +class Image; + +struct IntuiMessage { + uint32 _msgClass; + uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; + uint32 _seconds, _micros; +}; + + +struct Gadget { + uint16 x, y, _gadgetID; + uint16 _keyEquiv; // if not zero, a key that activates gadget + bool isEnabled; + Image *_image, *_altImage; +}; + +typedef Common::List GadgetList; class EventManager { private: @@ -56,6 +73,7 @@ public: GadgetList *_screenGadgetList; Gadget *_hitGadget; + Common::KeyState _keyPressed; Gadget *checkGadgetHit(GadgetList *gadgetList, Common::Point pos); void initMouse(); @@ -74,6 +92,15 @@ public: void processInput(bool can_delay = false); uint16 getNextChar(); Common::Point updateAndGetMousePos(); + + Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key); + Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt); + void freeButtonList(GadgetList *gadgetList); + void drawGadgetList(GadgetList *gadgetList); + void disableGadget(Gadget *curgad, uint16 pencolor); + void enableGadget(Gadget *curgad); + IntuiMessage *getMsg(); + uint16 makeGadgetKeyEquiv(uint16 key); }; } // End of namespace Lab -- cgit v1.2.3 From 7c1401264ca0da173dfe4de09ca4884d63feeb55 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Dec 2015 14:12:18 +0100 Subject: LAB: Remove interface.h, get rid of a lot of useless defines --- engines/lab/eventman.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index f9facd815b..3becfeb693 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -38,6 +38,21 @@ namespace Lab { class LabEngine; class Image; +// Defines for the Class variable in IntuiMessage +#define MOUSEBUTTONS 0x00000008 +#define GADGETUP 0x00000040 +#define RAWKEY 0x00000400 +#define DELTAMOVE 0x00100000 + +// Defines for the Qualifier variable in IntuiMessage +#define IEQUALIFIER_RIGHTBUTTON 0x2000 +#define IEQUALIFIER_LEFTBUTTON 0x4000 + +#define VKEY_UPARROW 273 +#define VKEY_DNARROW 274 +#define VKEY_RTARROW 275 +#define VKEY_LTARROW 276 + struct IntuiMessage { uint32 _msgClass; uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; -- cgit v1.2.3 From 2332fb617c0c26da563cb60625b24d824ad4630b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 13 Dec 2015 19:36:56 +0200 Subject: LAB: Rename gadget to button --- engines/lab/eventman.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/lab/eventman.h') diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 3becfeb693..cf61c40c19 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -40,7 +40,7 @@ class Image; // Defines for the Class variable in IntuiMessage #define MOUSEBUTTONS 0x00000008 -#define GADGETUP 0x00000040 +#define BUTTONUP 0x00000040 #define RAWKEY 0x00000400 #define DELTAMOVE 0x00100000 @@ -55,19 +55,19 @@ class Image; struct IntuiMessage { uint32 _msgClass; - uint16 _code, _qualifier, _mouseX, _mouseY, _gadgetID; + uint16 _code, _qualifier, _mouseX, _mouseY, _buttonID; uint32 _seconds, _micros; }; -struct Gadget { - uint16 x, y, _gadgetID; - uint16 _keyEquiv; // if not zero, a key that activates gadget +struct Button { + uint16 x, y, _buttonID; + uint16 _keyEquiv; // if not zero, a key that activates button bool isEnabled; Image *_image, *_altImage; }; -typedef Common::List GadgetList; +typedef Common::List