Git Product home page Git Product logo

ue4-canvas-gui's Introduction

ue4-canvas-gui

It's a simple Canvas GUI for Unreal Engine 4 with mouse operation.

Included elements:
Rendering Text (left/center);
Rendering Rects;
Rendering Circles (filled and not);
Button, Slider, Checkbox, Combobox, Hotkeys and ColorPicker.

Implemented a simple post-render system to draw on top of menu and all.

Screenshots with default style:

EU4 GUI

EU4 GUI

EU4 GUI

Ingame render EU4 GUI

Small "How to use" guide:

First you need get UCanvas from game.
After it you can draw like this:

//I'll show you with an example Post Render Hook
void PostRenderHook(UGameViewportClient* viewport, UCanvas* canvas)
{
	ZeroGUI::SetupCanvas(canvas);
	Menu::Tick();
}

//Menu.h
void Tick()
{
	ZeroGUI::Input::Handle();
	
	static bool menu_opened = false;
	if (GetAsyncKeyState(VK_F2) & 1) menu_opened = !menu_opened; //Our menu key

	if (ZeroGUI::Window("Superior UE4 GUI", &pos, FVector2D{ 500.0f, 400.0f }, menu_opened))
	{
		//Simple Tabs
		static int tab = 0;
		if (ZeroGUI::ButtonTab("Tab 1", FVector2D{ 110, 25 }, tab == 0)) tab = 0;
		if (ZeroGUI::ButtonTab("Tab 2", FVector2D{ 110, 25 }, tab == 1)) tab = 1;
		if (ZeroGUI::ButtonTab("Tab 3", FVector2D{ 110, 25 }, tab == 2)) tab = 2;
		if (ZeroGUI::ButtonTab("Tab 4", FVector2D{ 110, 25 }, tab == 3)) tab = 3;
		ZeroGUI::NextColumn(130.0f);
		//
		
		//Some Elements
		static bool text_check = false;
		static float text_slider = 15.0f;
		static int test_hotkey = 0x2;
		static FLinearColor test_color{ 0.0f, 0.0f, 1.0f, 1.0f };

		ZeroGUI::Checkbox("Test Checkbox", &text_check);
		ZeroGUI::SliderFloat("Test Slider", &text_slider, 0.0f, 180.0f);
		ZeroGUI::Hotkey("Test Hotkey", FVector2D{ 80, 25 }, &test_hotkey);

		ZeroGUI::Text("Left aligned text!");
		ZeroGUI::Text("Outline and Center aligned text!", true, true);

		//Element with padding
		ZeroGUI::PushNextElementY(50.0f);
		ZeroGUI::Combobox("Combobox", FVector2D{ 100, 25 }, &test_number, "None", "First", "Second", "Third", NULL); //NULL at end is required!
		ZeroGUI::SameLine();//inline items
		if (ZeroGUI::Button("It's a Button!", FVector2D{ 100, 25 })) { /*clicked!*/ }

		//Color Picker
		ZeroGUI::ColorPicker("Color Picker", &test_color);
	}
	ZeroGUI::Render();//Custom Render. I use it for drawing Combobox and ColorPicker over the menu
	ZeroGUI::Draw_Cursor(menu_opened);
}

ue4-canvas-gui's People

Contributors

maddyoff 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

ue4-canvas-gui's Issues

Subtabs?

Could you give a small example on how you use the subtabs?

Read

FVector2D CursorPos()
{
POINT cursorPos;
GetCursorPos(&cursorPos);
return FVector2D{ (float)cursorPos.x, (float)cursorPos.y };
}

This is detected because you called GetCursorPos that EAC has hooked without any thought

bad optimization

when menu is open my fps drop from 300-400 to 20-30, i just have a window with no content

Crahing game after X amount of time

I am currently using the menu and after about 50 to 60 minutes it will crash the game, the menu is called in post render before the crash it works fine, any possible clue what could cause the crash, my main loop also runs in postrender with the canvas drawing and that keeps working fine only if I open the menu it crashed. Any clue on what it could be would mean alot, Thanks

Poor rendering of the menu

image

I do not know what the problem might be. I'm new to this, I could have made a mistake somewhere. What do I need to do to prevent this from happening to my menu?) It hasn't changed its position yet

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.