Raven Documentation

Welcome to the user manual for Raven, a GUI library for GameMaker!

Raven is a UI library for GameMaker, with the goal of making it easier to create responsive UI's for your projects.

Raven allows you to create panels and UI elements with a minimal amount of effort and in an easy to understand way.

This library is a work in progress geared towards making simple, responsive UI's. Keep in mind that you might encounter slight issues every now and then, especially for new/experimental components/ui elements.

Raven's goal is to be the go-to UI system in GameMaker. Raven is envisioned to be:

If you are looking for a framework that has a recursive set up and allows further nesting of components, Emu might suit your needs. Emu is an incredible UI framework created by a member of the GameMaker community; "DragoniteSpam".

A full width container with a small subcontainer.
A full width container with a small subcontainer.
A full width container that has been scaled down and dynamically fits content.
A full width container that has been scaled down and dynamically fits content.
The same container as the first image but with a light theme selected.
The same container as the first image but with a light theme selected.

Getting Raven

To get started with Raven, you'll need to download it from the Raven GitHub Repository. Once downloaded, you can import the repository into GameMaker as a project or package. This will make the Raven assets and scripts available for use in your project.

Initializing the UI

After setting up Raven in your project, navigate to the obj_raven_init object. In the Create Event of this object, you'll find a "//GET STARTED HERE" section. This is where you'll initialize the UI components and start building your interface.

Creating the Core Struct

The cornerstone of Raven is the core struct instance, which manages the UI elements and interactions. You can create the main/core struct using the following code:


            raven = new RavenMain();
            

The above code instantiates a new RavenMain struct, which will be our main/core object, serving as the controller for any Raven-driven UI.

Adding a menu


            menu = new RavenMenu(0, 0, 64, 32, 32);
            //We create a new menu initializing at x: 0, y: 0 with a width per item of 64 pixels, a height of 32 pixels and a margin of 32 pixels per item. 
            overview_button = new RavenItem("Overview", noone);
            //we are not currently passing a function, so if you don't know what your button should do yet you can pass noone or configure it later. 
            //When we want specific behavior to trigger, we can define a function and use that instead:
            global.open_new_page = function open_new_page(){
                url_open("https://url_to_a_new_item");
            }

            new_button = new RavenItem("New", global.open_new_page);
            //We have now defined a function and passed it into the function, when the button is clicked, the _on_click argument will be triggered, which contains the open new page function in our case, which in turn would open a browser page to a given URL!

            menu.AddItem(overview_button);
            menu.AddItem(new_button);
            

The above code results in a menu with several items in it. While we are working on this menu, we can also customize it by adding an outline:


            menu.SetOutline(true);
            

Now that we have our menu, we just need to add it to our main struct:


            raven.SetMenu(menu);
            

We've now established this menu to be updated and rendered during runtime.

Now that we have established a menu and main struct for our project, we might want to add a panel/tab somewhere. To do this, we can make a container:

Using containers


            container = new RavenContainer(0, 0, global.resolution_x, global.resolution_y, true, false);
            container.SetLock(true);
            

We've created a container and locked it. This means the container cannot be resized, dragged, etc. We have not yet added our container to the main struct, so let's do that:


            raven.AddContainer(container);
            

We can also create a smaller panel, for example, to display tooltips or serve as a sidebar or overlay:


            var tooltip_container = new RavenContainer(200, 200, 600, 600, false, true, gui_render_mode.VLIST, 3);
            var container_menu = new RavenMenu(0, 0, 64, 32, 32);
            tooltip_container.SetMenu(container_menu);
            

As you can see in the above code, each container can also have its own menu. All that we are missing now is some text to display in our tooltip container:


            tooltip_container.AddItem(new RavenTextItem("This is a TextField", 0, 16, fnt_dsansmono16));
            tooltip_container.AddItem(new RavenTextItem("Let's write a paragraph! The quick brown fox jumps over the lazy dog.", 0, 16, fnt_dsansmono16));
            

And we finalize by adding our tooltip container to our main struct:


            raven.AddContainer(tooltip_container);
            

That's it for getting started!

Raven provides a set of components for creating dynamic and responsive GUIs in GameMaker.

Components include checkboxes, text input fields, containers, menus, and more. Components are automatically styled to a certain theme.

Note that Raven is experimental, you may encounter bugs and issues during usage, as well as incomplete, partially implemented or obsolete functionalities.

Despite this, I hope that this library can help you to create UI's quickly and efficiently in GameMaker, if not for games, perhaps for tooling or applications!

The core of Raven revolves around the Render() and Update() functions:

Rendering is delegated from the main struct to containers and individual items (ui elements). This delegation happens through various structs. The different structs/ui elements are documented in this manual. Here is a brief overview of the different structs.

It is highly recommended that you do not alter these structs. If you want to create new functionalities, alter the styling or modify the behavior, please consider using your own implementations of RavenItem. Any struct that has a Render() and Update() function that is added to a container will be called automatically, hence implementing these methods is key to making your own elements/components.

obj_raven_init Object

The obj_raven_init object plays a critical role in initializing the Raven when the game starts. It is responsible for setting up global preferences, theme settings, and various initialization routines that lay the foundation for any UI elements.

Upon creation, this object establishes global variables such as theme and gui properties, which define the desired theme and ensure consistent GUI rendering based on selected preferences.

obj_raven_init takes charge of managing the theme for the GUI. It defines macros and switches that enable you to seamlessly switch between different themes like "RAVEN," "DARK," "LIGHT," and more. These theme settings affect visual elements such as background color, menu appearance, text color and button styles.

Additionally, the object hosts various global preferences, such as raven_debug for toggling debugging messages, experimental_features for enabling experimental functionalities, and interface_scale for controlling the size of GUI components. These preferences grant developers the flexibility to fine-tune the GUI's behavior and presentation according to their project's specific requirements.

obj_raven_main Object

The obj_raven_main object serves as the epicenter of Raven's functionality. It acts as the entry point for rendering and managing the GUI, orchestrating update and drawing routines to add functionality to elements and render components.

Upon creation, obj_raven_main initializes the main GUI components. It constructs instances of RavenMain, buttons, menus, and containers, forming the fundamental structure of the GUI.

The Step Event of this object is where interactions are managed. It calls the RavenMainUpdate() function, capturing mouse input and coordinates to enable responsive interactions like button clicks and menu selections.

In the Draw Event, obj_raven_main invokes the RavenMainRender() function to render the GUI. This process involves calling the appropriate rendering functions for each GUI element, resulting in an interface that aligns with the chosen theme and layout.

The RavenMain struct serves as the central orchestrator of Raven. It encapsulates various components and functionalities that enable developers to create sophisticated user interfaces with ease. The primary objective of RavenMain is to manage the overall rendering and user interaction within the GUI framework.

Constructor:

The RavenMain constructor initializes a new instance of the struct, setting the foundation for GUI development and management.


                RavenMain()
                    

Properties:

Methods:

AddContainer(container)

The AddContainer method enables developers to incorporate container instances into the RavenMain. This facilitates structured content organization, enhances layout management, and streamlines the rendering process.


                AddContainer(container)
                    container (RavenContainer): The container instance to be added.
                    

PushReferences()

The PushReferences method plays a pivotal role in establishing connections between various GUI elements. It ensures that menu items, containers, and other components are aware of their relationships, enabling proper event handling and interactions.

Render Method:

The RavenMainRender function orchestrates the rendering process for all components managed by the RavenMain struct. This comprehensive rendering approach ensures that containers, menus, and their contents are presented cohesively and efficiently on the screen.

Update Method:

The RavenMainUpdate function drives the core interactivity of the RavenMain. It monitors user input and delegates relevant updates to containers and menu items, enabling a responsive and intuitive user experience.

Summary:

The RavenMain struct serves as the backbone of Raven, providing a centralized management system for GUI components. By offering a unified approach to rendering, interaction, and event handling, RavenMain empowers developers to create sophisticated user interfaces with seamless interactivity. The RavenMainRender and RavenMainUpdate functions work in tandem to ensure a consistent and engaging user experience, making it easier for developers to craft rich and dynamic applications.

The RavenContainer struct is a core component, responsible for managing and rendering graphical containers to hold various GUI elements. It offers dynamic resizing, positioning, and customization options to ensure an optimal user interface.

Constructor

The constructor of RavenContainer initializes a container object with the following arguments:

Properties

Methods and Functions

Render and Update

The RavenContainer has two core functions for rendering and updating:

Functionality

The RavenContainer struct enables you to create dynamic and customizable GUI containers. It allows you to:

Overall, the RavenContainer struct forms the building block for creating structured and interactive GUI layouts within Raven.

The RavenMenu struct is a core component by offering a dynamic and interactive contextual menu. If you want to customize containers and allow these to be dragged or moved you need to add a menu to them.

Constructor:

The RavenMenu constructor initializes a new instance of the struct, setting its position and dimensions for proper placement on the screen.


                RavenMenu(x, y, width, height)
                    x (Number): The horizontal position of the menu.
                    y (Number): The vertical position of the menu.
                    width (Number): The width of the menu.
                    height (Number): The height of the menu.
                    

Properties:

Methods:

AddItem(item)

The AddItem method enables developers to append menu items to the RavenMenu. This dynamic addition of items makes it possible to populate the menu with various choices and functionalities.


                AddItem(item)
                    item (RavenItem): The menu item to be added.
                    

SetOutline(outline)

The SetOutline method offers developers control over the menu's visual appearance by enabling or disabling the outline.


                SetOutline(outline)
                    outline (Boolean): A boolean value indicating whether to display an outline.
                    

Render Method:

The RavenMenuRender function handles the rendering of the RavenMenu and its contents on the screen. This process involves drawing each menu item in a visually organized manner, utilizing the defined theme to ensure a cohesive and appealing look.

Update Method:

The RavenMenuUpdate function drives the dynamic behavior of the RavenMenu. It monitors user interactions such as clicks and movements, facilitating item selection and activation. This method's role is pivotal in creating a seamless and responsive menu navigation experience.

Summary:

The RavenMenu struct represents the heart of user interaction in Raven. By combining its constructor, properties, and methods, developers gain the ability to design rich and engaging contextual menus. The RavenMenuRender and RavenMenuUpdate functions work collaboratively to deliver a visually appealing, interactive, and user-centric menu that enhances the overall user experience.

RavenTextItem

The RavenTextItem is a component used to display text-based content within containers and menus. It offers customizable text properties and rendering options.

Constructor

The constructor of RavenTextItem initializes a text item object with the following arguments:

Properties

Methods and Functions

Functionality

The RavenTextItem component allows you to:

Overall, the RavenTextItem should offer a flexible way to integrate single-line text-based content within your projects.

RavenMultilineTextItem

The RavenMultilineTextItem is a component used to display multi-line text-based content within containers and menus. It offers customizable text properties and rendering options.

Constructor

The constructor of RavenMultilineTextItem initializes a multi-line text item object with the following arguments:

Properties

Methods and Functions

Functionality

The RavenMultilineTextItem component allows you to:

Overall, the RavenMultilineTextItem should offer a flexible way to integrate multi-line text-based content within your projects.

RavenLineBreakItem

The RavenLineBreakItem is a component that provides an empty space used to separate content. It is primarily used to control layout and spacing between items in containers.

Constructor

The constructor of RavenLineBreakItem initializes a line break item with the following arguments:

Properties

Methods and Functions

Functionality

The RavenLineBreakItem component allows you to:

The RavenLineBreakItem is a useful tool for controlling the visual arrangement and organization of elements in your GUI layout.

RavenCheckboxItem

The RavenCheckboxItem is a component used to display a checkbox with associated text. It allows users to toggle a boolean value and offers customization options for its appearance and behavior.

Constructor

The constructor of RavenCheckboxItem initializes a checkbox item with the following arguments:

Properties

Methods and Functions

Functionality

The RavenCheckboxItem component allows you to:

The RavenCheckboxItem is a component used to seperate ui elements and acts as a seperator.

RavenDropdownItem

The RavenDropdownItem is a component within Raven that provides a dropdown menu with selectable options. It is used to allow users to choose from a list of predefined values.

Constructor

The constructor of RavenDropdownItem initializes a dropdown item with the following arguments:

Properties

Methods and Functions

Functionality

The RavenDropdownItem component allows you to:

The RavenDropdownItem is a component/ui element that allows you to let a user choose from a given list of options.

RavenTextInputItem

The RavenTextInputItem is a component within Raven that provides a text input field. It allows users to enter text input in a designated area.

Constructor

The constructor of RavenTextInputItem initializes a text input item with the following arguments:

Properties

Methods and Functions

Functionality

The RavenTextInputItem component allows you to:

RavenButtonItem

The RavenButtonItem is a component within Raven that represents a clickable button with customizable text. It is used to trigger actions or events when clicked.

Constructor

The constructor of RavenButtonItem initializes a button item with the following arguments:

Properties

Methods and Functions

Functionality

The RavenButtonItem component allows you to:

RavenImageButtonItem

The ImageButtonItem is an element used to create interactive image buttons.

Constructor

The constructor of RavenImageButtonItem initializes an image button with the following arguments:

Properties

Methods and Functions

Functionality

The RavenImageButtonItem component allows you to:

RavenImageItem

The ImageItem is an element used to create non-interactive image elements.

Constructor

The constructor of RavenImageItem initializes an image item with the following arguments:

Properties

Methods and Functions

Functionality

The RavenImageItem component allows you to: