Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**********************************
- | Author : XForce |
- | Website : xforce.square7.ch |
- | |
- ***********************************/
- #include <vector>
- #include <string>
- #include <sstream>
- #include <d3d9.h>
- #include <d3dx9.h>
- //#include "drawfuncs.h"
- #pragma comment(lib, "d3d9.lib")
- #pragma comment(lib , "d3dx9.lib")
- //extern ID3DXFont *xfont;
- #undef SAFE_RELEASE
- #define SAFE_RELEASE( d ) \
- if ( d ) \
- { \
- d->Release(); \
- d = NULL; \
- }
- extern LPD3DXLINE g_pLine;
- enum types
- {
- Window,
- Button,
- Textbox,
- ListBox,
- ComboBox,
- NumericUpDown,
- };
- enum WindowState
- {
- Hide,
- Normal,
- Active,
- };
- struct XListBoxItem
- {
- std::string name;
- std::string info;
- int selected;
- };
- class XControl
- {
- public:
- int x;
- int y;
- int h;
- int w;
- POINT window;
- virtual void Render(LPDIRECT3DDEVICE9 Device);
- std::string title;
- types type;
- int id;
- int active;
- void (*clickevent)(XControl* sender,types type); //Only for buttons
- };
- class XTextBox : public XControl
- {
- public:
- XTextBox();
- XTextBox(int x,int y,int h,int w,int id);
- std::string getText();
- //void Render();
- int caretPos;
- int caretPosScreen;
- int caretTick;
- int showPosbegin;
- int showPosend;
- int charw;
- bool showCaret;
- DWORD ltick;
- std::string textbuffer;
- void HandleInput(int nCode, WPARAM wParam, LPARAM lParam);
- void Render(LPDIRECT3DDEVICE9 Device);
- };
- class XButton : public XControl
- {
- public:
- XButton();
- XButton(int x,int y,int h,int w, std::string title,void (*func)(XButton* sender),int id);
- XButton(RECT rct,std::string title,void* func,int id);
- void Render(LPDIRECT3DDEVICE9 Device);
- void(*clickevent)(XButton* sender);
- int getstate(); // 1 - Normal 2 - Hide 3 - Closed
- void Release();
- };
- class XNumericUpDown : public XControl
- {
- public:
- XNumericUpDown();
- XNumericUpDown(int x,int y,int h,int w, std::string title,int id);
- XNumericUpDown(RECT rct,std::string title,void* func,int id);
- void Render(LPDIRECT3DDEVICE9 Device);
- int mouse;
- float step;
- float value;
- float max;
- float min;
- int getstate(); // 1 - Normal 2 - Hide 3 - Closed
- void Release();
- };
- class XListBox : public XControl
- {
- public:
- XListBox();
- XListBox(int x,int y,int h,int w, std::string title,int id);
- int selected;
- std::vector<XListBoxItem> items;
- int out;
- int slidermouse;
- int slidery;
- void AddItem(XListBoxItem item);
- void RemoveItem(XListBoxItem item);
- void Render(LPDIRECT3DDEVICE9 Device);
- XListBoxItem GetSelectedItem();
- };
- class XWindow
- {
- public:
- int x,y,h,w;
- std::string title;
- XWindow();
- XWindow(int x,int y,int h,int w, std::string title,int id);
- XWindow(RECT rct,std::string title ,int id);
- D3DCOLOR textcolor;
- int id;
- WindowState state;
- bool fadeout;
- std::vector<XControl*> controls;
- void AddControl(XControl* control);
- void RemoveControl(XControl* control);
- void Render(LPDIRECT3DDEVICE9 Device);
- int getstate(); // 1 - Normal 2 - Hide 3 - Closed
- void Release();
- };
- class XGUI
- {
- public:
- XGUI();
- std::vector<XWindow*> windows;
- void AddWindow(XWindow* window);
- void RemoveWindow(XWindow* window);
- void Release();
- bool disabled;
- void Render(LPDIRECT3DDEVICE9 pDevice/*,D3DVIEWPORT9 viewport,ID3DXFont* xfont*/);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement