Coder Social home page Coder Social logo

fgui's Introduction

logo

c++ mit

discord


A multiplatform object-oriented gui framework written in C++. This framework is mainly aimed towards game hacking, but you can use it for anything.

* Easy to use and to customize.
* Works with DirectX 9/10 and Valve's DirectX 9 wrapper: Surface. (OpenGL will come later.)
* It comes with a built-in config system. (The library is using json (https://github.com/nlohmann/json) as a file parser.)

You can visit the wiki (currently under construction) page for widgets, function documentation and a how to setup guide.

img1 img2

In this link you can see more examples of what you can do with FGUI.

If you find bugs or glitches feel free to visit the issues tab or report it on the Discord server. If you want to contribute, you can always make a pull request.

fgui's People

Contributors

nulledc0de avatar otvv avatar vulgar1s avatar xlevitate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fgui's Issues

Fonts

How can i use it with another language and change the fonts. I cant import TTF.

Prevent textover flow

For textbox.cc

void fgui::textbox::draw() {

	// get the current position of the window
	fgui::point a = fgui::element::get_absolute_position();

	// get the window style
	fgui::style style = handler::get_style();

	// get the control area
	fgui::rect area = { a.x, a.y, m_width, m_height };

	// textbox title text size
	fgui::dimension text_size = fgui::render.get_text_size(fgui::textbox::get_font(), m_title);

	// textbox body
	fgui::render.outline(area.left, area.top, area.right, area.bottom, fgui::color(style.textbox.at(0)));
	
	if (fgui::input_system::mouse_in_area(area) || m_is_getting_key)
		fgui::render.outline(area.left + 2, area.top + 2, area.right - 4, area.bottom - 4, fgui::color(style.textbox.at(3)));
	else
		fgui::render.outline(area.left + 1, area.top + 1, area.right - 2, area.bottom - 2, fgui::color(style.textbox.at(2)));

	fgui::render.colored_gradient(area.left + 3, area.top + 3, area.right - 6, area.bottom - 6, fgui::color(style.textbox.at(1)), fgui::color(style.textbox.at(2)), false);

	// textbox label
	fgui::render.text(area.left, (area.top - text_size.height) - 2, fgui::color(style.text.at(0)), fgui::textbox::get_font(), m_title);

	if (m_text.empty())
		return;

	// typed text size
	fgui::dimension typed_text_size = fgui::render.get_text_size(fgui::textbox::get_font(), m_text);
	
	//The text won't fit in the box
	int number_errased = 0;
	std::string to_write = m_text;

	while (typed_text_size.width + 7 > m_width)
	{
		if (m_text_input_pos >= number_errased && m_text_input_pos > 1)
		{
			to_write.erase(to_write.begin());
			number_errased++;
		}
		else
		{
			to_write.pop_back();
		}
		typed_text_size = fgui::render.get_text_size(fgui::textbox::get_font(), to_write);

	}

	// draw custom text
	if (m_text_flag & static_cast<int>(fgui::text_flags::SECRET))
	{
		fgui::render.text(area.left + 5, area.top + (area.bottom / 2) - (typed_text_size.height / 2) - 1, fgui::color(style.text.at(0)), fgui::textbox::get_font(), std::string(to_write.length(), '*'));
	}

	else if (m_text_flag & static_cast<int>(fgui::text_flags::UPPERCASE)) 
	{
		
		// transform the text into uppercase
		std::string upper_case_display = to_write;
		std::transform(upper_case_display.begin(), upper_case_display.end(),upper_case_display.begin(), ::toupper);

		fgui::render.text(area.left + 5, area.top + (area.bottom / 2) - (typed_text_size.height / 2) - 1, fgui::color(style.text.at(0)), fgui::textbox::get_font(), upper_case_display);
	}
	else
	{
		fgui::render.text(area.left + 5, area.top + (area.bottom / 2) - (typed_text_size.height / 2) - 1, fgui::color(style.text.at(0)), fgui::textbox::get_font(), to_write);
	}

	// if the textbox is ready to receive text
	if (m_is_getting_key) {

		// caret
		std::string caret = to_write;

		if (m_text_input_pos - number_errased <= 0)
		{
			number_errased = 0;
			m_text_input_pos = 1;
		}
		if (m_text_input_pos - number_errased >= caret.size())
		{
			m_text_input_pos = caret.size();
			number_errased = 0;
		}
		caret.erase(m_text_input_pos - number_errased, caret.size());

		// caret size
		fgui::dimension caret_text_size = fgui::render.get_text_size(fgui::textbox::get_font(), caret);

		// draw the caret
		fgui::render.line(area.left + caret_text_size.width + 7, area.top + 5, area.left + caret_text_size.width + 7, (area.top + area.bottom) - 5, fgui::color(style.text.at(0)));
	}

	// selected text rectangle
	if (m_text_selected)
		fgui::render.rect(area.left + 5, area.top + (area.bottom / 2) - (typed_text_size.height / 2) - 1, typed_text_size.width, typed_text_size.height, fgui::color(style.textbox.at(3), 100));
}

multibox issue

when you try to select the item in the multibox it does not get selected

nested tabboxes

i may be stupid, however i dont understand why this code won't work. it compiles fully, however with it not commented, it crashes.
ADD_GROUPBOX(vars::container["#vbox"], 15, 40, "aim", 260, 370, title_font, vars::container["#window"], 0, false, false, false); ADD_CONTROLLER(vars::container["#vbox"], vars::tabs["#tab_panel"]); /* REGISTER_TAB(vars::tabs["#visuals"], 7, 1, fgui::tab_layout::HORIZONTAL, title_font, vars::container["#aimbotbox"], 0 ); ADD_TAB(vars::tabs["#visuals"], "team"); { } ADD_TAB(vars::tabs["#visuals"], "enemy"); { } ADD_TAB(vars::tabs["#visuals"], "priority"); { } ADD_TAB(vars::tabs["#visuals"], "friend"); { ADD_LABEL(vars::label["#joe"], 15, 15, "piss. piss in your asss!", fgui::label_type::TEXT, title_font, vars::container["#visuals"], 3); } ADD_TAB(vars::tabs["#visuals"], "viewmodel"); { } ADD_TAB(vars::tabs["#visuals"], "localplayer"); { } */

it's inside of a tabbox. please correct if i'm doing something stupid.

i'll add an image, as it looks like github code formatting sux

https://cdn.discordapp.com/attachments/611804250833420307/643996378715914280/image.png

Really bad way to deal with shift held numbers and such

Really bad way to deal with !@#$% etc. I couldn't think of a better way to do it.

However, thought this may help.

if (fgui::input_system::key_held(fgui::external::KEY_LSHIFT) || fgui::input_system::key_held(fgui::external::KEY_RSHIFT)) { if (input.compare(xor("1")) == 0) { input = xor ("!"); } else if (input.compare( xor ("2")) == 0) { input = xor ("@"); } else if (input.compare( xor ("3")) == 0) { input = xor ("#"); } else if (input.compare( xor ("4")) == 0) { input = xor ("$"); } else if (input.compare( xor ("5")) == 0) { input = xor ("%"); } else if (input.compare( xor ("6")) == 0) { input = xor ("^"); } else if (input.compare( xor ("7")) == 0) { input = xor ("&"); } else if (input.compare( xor ("8")) == 0) { input = xor ("*"); } else if (input.compare( xor ("9")) == 0) { input = xor ("("); } else if (input.compare( xor ("0")) == 0) { input = xor (")"); } else if (input.compare( xor ("-")) == 0) { input = xor ("_"); } else if (input.compare( xor ("=")) == 0) { input = xor ("+"); } else if (input.compare( xor ("[")) == 0) { input = xor ("{"); } else if (input.compare( xor ("]")) == 0) { input = xor ("}"); } else if (input.compare( xor ("\\")) == 0) { input = xor ("|"); } else if (input.compare( xor (";")) == 0) { input = xor (":"); } else if (input.compare( xor ("'")) == 0) { input = xor ("\""); } else if (input.compare( xor (",")) == 0) { input = xor ("<"); } else if (input.compare( xor (".")) == 0) { input = xor (">"); } else if (input.compare( xor ("/")) == 0) { input = xor ("?"); } else if (input.compare( xor ("")) == 0)
{
input = xor ("~");
}
}`

Unable to close menu.

Once I open the menu I am unable to close it.

My main function:

std::shared_ptr<fgui::container> window;
window = std::make_shared<fgui::container>();
fgui::element_font font;

ADD_WINDOW(window, 10, 10, "fgui", 1280, 720, VK_INSERT, font, true);
REGISTER_CURSOR(fgui::cursor_type::ARROW, fgui::input_state::UNLOCKED);

fgui::handler::render_window();

My key state function:

return g_InputSystem->IsButtonDown(g_InputSystem->VirtualKeyToButtonCode(key));

I've tried to debug handler.cc but I can't find why the window state won't unset.

Crashing on inject sometimes

most times when i inject i crash on this line
inline fgui::state get_state() const noexcept { return m_opened; }

I cant figure out a way around it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.