Cyrus Mod Loader
Loading...
Searching...
No Matches
Window.h
1#pragma once
2#include <cstdint>
3#include <memory>
4#include <string>
5#include <vector>
6
7#include "WindowFlags.h"
8#include "WindowStyle.h"
9#include <Cyrus/Classes/PropertyClass.h>
10#include <Cyrus/shared.h>
11#include <cstdint>
12#include <iostream>
13#include <sstream>
14#include <string>
15#include <vector>
16
17class ControlButton;
18class ControlEdit;
19struct WindowLayout;
20
21class Window;
22
23typedef int64_t (*ClickResponder_t)(Window *element);
24
25#pragma pack(push, 1)
27 void *vftable; // 0x00
28 std::list<ClickResponder_t> clickResponders; // 0x8
29
30public:
31 std::list<ClickResponder_t> getList() { return clickResponders; }
32};
33#pragma pack(pop)
34
35#pragma pack(push, 1)
45class Window : public PropertyClass {
46private:
47 float N00000A81; // 0x0048
48 int32_t windowID; // 0x004C
49 std::string m_sName; // 0x50
50 std::vector<std::shared_ptr<Window>> children; // 0x70
51 Window *parent; // 0x88
52 void *inputHandler; // 0x90 seems to handle all input, even mouse position,
53 // key presses, etc.
54 WindowStyle_internal m_Style; // 0x0098
55 WindowFlags_internal m_Flags; // 0x009C
56 Rect transform; // 0xA0
57 VectorI2D parentOffset; // 0xB0
58 char pad_00B8[8]; // 0x00B8
59 VectorI2D offset; // 0xC0
60 Vector2D scale; // 0xC8
61 uint32_t N00000417; // 0x00D0
62 float m_fTargetAlpha; // 0x00D4
63 float m_fDisabledAlpha; // 0x00D8
64 float N000008E4; // 0x00DC
65 float screen_time; // 0x00E0 // seconds this window has been displayed on
66 // screen
67 float screen_time_; // 0x00E4 // seconds this window has been displayed on
68 // screen
69 int64_t m_pWindowStyle; // 0x00E8
70 void *soundDescriptor; // 0x00F0
71 std::wstring m_sHelp; // 0x00F8
72 char pad_0118[0x48]; // 0x0118
73 std::string m_sScript; // 0x0160
74 uintptr_t pad_d; // 0x180
75 std::wstring m_sTip; // 0x0188
76 void *m_BubbleList; // 0x01A8
77 char pad_01B0[16]; // 0x01B0
78 void *artDescriptor; // 0x01C0
79 char pad_01C8[120]; // 0x01C8
80 char **internalClassName; // 0x0240
81
82public:
91 CYRUS int32_t getWindowID() const;
92
93 CYRUS std::list<ClickResponder_t> getClickResponders();
94
103 CYRUS std::string getName();
104
114 CYRUS std::vector<std::shared_ptr<Window>> getChildren();
115
125 CYRUS Window *getParent();
126
127 CYRUS std::string getFlags();
128
129 CYRUS std::string getStyles();
130
140 CYRUS void addFlag(uint32_t flag);
141
151 CYRUS void addStyle(uint32_t style);
152
162 CYRUS void toggleFlag(uint32_t flag);
163
173 CYRUS void toggleStyle(uint32_t style);
174
184 CYRUS void removeFlag(uint32_t flag);
185
195 CYRUS void removeStyle(uint32_t style);
196
203 CYRUS Rect *getTransform();
204
209 CYRUS void setTransform(Rect in);
210
216 CYRUS VectorI2D getParentOffset() const;
217
223 CYRUS float getTimeOnScreen() const;
224
230 CYRUS void setTimeOnScreen(float screenTime);
231
237 CYRUS float getDisabledAlpha() const;
238
244 CYRUS void setFDisabledAlpha(float fDisabledAlpha);
245
251 CYRUS float getTargetAlpha() const;
252
258 CYRUS void setFTargetAlpha(float fTargetAlpha);
259
265 CYRUS Vector2D getScale() const;
266
273 CYRUS void setScale(float x, float y);
274
280 CYRUS VectorI2D getOffset() const;
281
289 CYRUS void performScale(float factor);
290
304 template <class T> CYRUS T *findChild(const std::string &name) {
305 for (auto &child : children) {
306 if (child->getName() == name) {
307 return child->as<T>();
308 }
309 }
310 return nullptr;
311 }
312
328 template <class T> CYRUS T *findDescendant(const std::string &name) {
329 for (auto &child : children) {
330 if (child->getName() == name) {
331 return child->as<T>();
332 }
333 T *descendant = child->findDescendant<T>(name);
334 if (descendant != nullptr) {
335 return descendant;
336 }
337 }
338 return nullptr;
339 }
340
341public:
342 virtual void func1();
343 virtual void func2();
344 virtual void func3();
345 virtual void func4();
346 virtual void func5();
347 virtual void func6();
348 virtual void func7();
349 virtual void func8();
350 virtual void func9();
351 virtual void func10();
352 virtual void func11();
353 virtual void func12();
354 virtual void func13();
355 virtual void func14();
356 virtual void func15();
357 virtual void func16();
358 virtual void func17();
359 virtual void func18();
360 virtual void func19();
361 virtual void func20();
362 virtual void func21();
363 virtual void func22();
364 virtual void func23();
365 virtual void func24();
366 virtual void func25();
367 virtual void func26();
368 virtual void func27();
369 virtual void func28();
370 virtual void func29();
371 virtual void func30();
372 virtual void func31();
373 virtual void func32();
374 virtual void func33();
375 virtual void func34();
376 virtual void func35();
377 virtual bool updateDockPosition();
378
379private:
380 friend struct WindowLayout;
381};
382
383STATIC_ASSERT(sizeof(Window) == 0x248, "Window size is not correct");
400 DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_fDisabledAlpha, 0xD8);
414 DEFINE_OFFSET_AND_STATIC_ASSERT(Window, internalClassName, 0x240);
415};
416#pragma pack(pop)
A class that represents a button control element in a window.
Definition ControlButton.h:22
A class that represents an editable text control element in a window.
Definition ControlEdit.h:21
Definition Window.h:26
std::list< ClickResponder_t > getList()
Definition Window.h:31
Base class for all property classes, providing reflection and serialization functionality.
Definition PropertyClass.h:86
Represents a Wizard101 Window, think anything you see on screen that is not a 3D model.
Definition Window.h:45
virtual void func19()
virtual void func20()
CYRUS Rect * getTransform()
Get the transformation coordinates of the window.
Definition Window.cpp:119
CYRUS Window * getParent()
Get the Windows parent Window.
Definition Window.cpp:15
CYRUS std::vector< std::shared_ptr< Window > > getChildren()
Retrieve the child Windows of this Window.
Definition Window.cpp:13
virtual void func17()
virtual bool updateDockPosition()
virtual void func23()
CYRUS float getTargetAlpha() const
Get the target alpha value of the window.
Definition Window.cpp:135
virtual void func11()
CYRUS std::string getFlags()
Definition Window.cpp:17
CYRUS VectorI2D getParentOffset() const
Get the offset of the window relative to its parent.
Definition Window.cpp:123
virtual void func14()
CYRUS float getDisabledAlpha() const
Get the alpha value when the window is disabled.
Definition Window.cpp:129
CYRUS void setTransform(Rect in)
Sets the transformation coordinates of the window.
Definition Window.cpp:121
CYRUS void addStyle(uint32_t style)
Unconditionally sets the specified Window style to 1.
Definition Window.cpp:109
virtual void func34()
virtual void func30()
CYRUS void setFTargetAlpha(float fTargetAlpha)
Set the target alpha value of the window.
Definition Window.cpp:137
CYRUS std::string getName()
Retrieve the name of the Window.
Definition Window.cpp:11
virtual void func15()
virtual void func24()
CYRUS void performScale(float factor)
Scales the current Window, and all descendants, by the scale factor. If the scale factor is 2,...
Definition Window.cpp:147
CYRUS void setFDisabledAlpha(float fDisabledAlpha)
Set the alpha value for when the window is disabled.
Definition Window.cpp:131
virtual void func8()
virtual void func21()
CYRUS float getTimeOnScreen() const
Get the total time the window has been displayed on the screen.
Definition Window.cpp:125
virtual void func27()
CYRUS void removeFlag(uint32_t flag)
Unconditionally sets the specified Window flag to 0.
Definition Window.cpp:115
virtual void func29()
CYRUS std::list< ClickResponder_t > getClickResponders()
Definition Window.cpp:5
virtual void func13()
virtual void func2()
virtual void func12()
CYRUS void toggleFlag(uint32_t flag)
Toggles the current value of the specified Window flag.
Definition Window.cpp:111
virtual void func5()
CYRUS void setTimeOnScreen(float screenTime)
Set the total time the window has been displayed on the screen.
Definition Window.cpp:127
CYRUS T * findDescendant(const std::string &name)
Find a descendant Window by name and cast it to the specified type.
Definition Window.h:328
CYRUS void setScale(float x, float y)
Sets the scale of the window.
Definition Window.cpp:143
CYRUS void removeStyle(uint32_t style)
Unconditionally sets the specified Window style to 0.
Definition Window.cpp:117
virtual void func32()
virtual void func6()
CYRUS VectorI2D getOffset() const
Get the offset of the window.
Definition Window.cpp:145
virtual void func26()
virtual void func7()
virtual void func33()
virtual void func3()
virtual void func22()
CYRUS int32_t getWindowID() const
Retrieve the unique identifier for the Window.
Definition Window.cpp:3
virtual void func16()
virtual void func10()
virtual void func25()
CYRUS void toggleStyle(uint32_t style)
Toggles the current value of the specified Window style.
Definition Window.cpp:113
CYRUS T * findChild(const std::string &name)
Find a child Window by name and cast it to the specified type.
Definition Window.h:304
virtual void func1()
virtual void func9()
CYRUS void addFlag(uint32_t flag)
Unconditionally sets the specified Window flag to 1.
Definition Window.cpp:107
virtual void func4()
virtual void func18()
virtual void func28()
virtual void func35()
virtual void func31()
CYRUS std::string getStyles()
Definition Window.cpp:57
CYRUS Vector2D getScale() const
Get the scale of the window.
Definition Window.cpp:141
Definition shared.h:28
Definition shared.h:23
Definition shared.h:18
Definition WindowFlags.h:5
Definition Window.h:384
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, N00000417, 0xD0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, screen_time, 0xE0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_Flags, 0x9C)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_Style, 0x98)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, artDescriptor, 0x1C0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, N000008E4, 0xDC)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, pad_01C8, 0x1C8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, pad_00B8, 0xB8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, inputHandler, 0x90)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, transform, 0xA0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, N00000A81, 0x48)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, parent, 0x88)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, soundDescriptor, 0xF0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, parentOffset, 0xB0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_pWindowStyle, 0xE8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, pad_01B0, 0x1B0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_BubbleList, 0x1A8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, screen_time_, 0xE4)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_sScript, 0x160)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_sHelp, 0xF8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, children, 0x70)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_fTargetAlpha, 0xD4)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_fDisabledAlpha, 0xD8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_sTip, 0x188)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, scale, 0xC8)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, m_sName, 0x50)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, internalClassName, 0x240)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, pad_0118, 0x118)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, offset, 0xC0)
DEFINE_OFFSET_AND_STATIC_ASSERT(Window, windowID, 0x4C)
Definition WindowStyle.h:5