From 8eb0808fecb8c57eff877fddf38db91b1f067921 Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Tue, 28 Feb 2017 11:07:10 -0500 Subject: initial commit, this is the gfx library which serves as a crappy wrapper for SDL. --- gui.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 gui.h (limited to 'gui.h') diff --git a/gui.h b/gui.h new file mode 100644 index 0000000..2c72e80 --- /dev/null +++ b/gui.h @@ -0,0 +1,72 @@ +#ifndef GUI_H +#define GUI_H +#include +#include +#include +#include "gfx.h" +//for the states, they can be OR'd together +#define TOGGLE 1 +#define HOVER 2 +//---=[structure of gui elements]=--- +//gfxupdate handles input events and passess to +//butt and textin classesss +//butt and textin have hitbox members for each of their elements that +//they take mouse data to. +class hitbox { + std::vector rs;//vector of Rects to manage + public: + hitbox();//constructor does nothing + int add(int x, int y, int w, int h); // there is an add but no remove + //because this class is not meant to be edited at runtime. the reason + //we don't just pass a vector is for ease of use by parent function + int check(int x, int y);//checks hitbox + SDL_Rect get(int index); +}; +class butt { + std::vector names; // vector of strings that are the names + //of buttons + std::vector states; + hitbox boxes;//manager of the hitboxes of all the buttons + + public : + butt(); // empty constructor + int add(int x, int y, int w, int h, std::string name); // not meant + //to be done during runtime, it's not in the constructor for ease + + //of use handle the three mouseevents from updategfx(), not return + //because they're not going to run into a runtime error the parent + //has to handle + int hover(int x, int y); + int press(int x,int y ); + int unpress(int index); + //as the Renderer is a global var, draw does not take any inputs + int drawbutt(); + //get's the state of a button; + int state(int index); + int size(); +}; +class tbuff { + public : + std::vector buffs; // vector of strings that are the names + //of buttons + std::vector states; + hitbox boxes;//manager of the hitboxes of all the buttons + tbuff(); // empty constructor + int add(int x, int y, int w, int h); // not meant + //to be done during runtime, it's not in the constructor for ease + + //of use handle the three mouseevents from updategfx(), not return + //because they're not going to run into a runtime error the parent + //has to handle + int hover(int x, int y); + int press(int x,int y ); + int unpress(int index); + //as the Renderer is a global var, draw does not take any inputs + int drawtbuff(); + //get's the state of a button; + int state(int index); + int size(); + int reset(); + int charin(const char *); +}; +#endif -- cgit v1.1