Assembled 2
A column based text editor
Loading...
Searching...
No Matches
Functions | Variables
interface.c File Reference
#include <interface/interface.h>
#include <global.h>
#include <util.h>

Functions

int switch_to_screen (char *name)
 
int switch_to_last_screen ()
 
int register_screen (char *name, void(*render)(struct AS_RenderCtx *), void(*update)(struct AS_RenderCtx *), void(*local)(int, int))
 
void draw_border (struct AS_Bound bound)
 

Variables

struct AS_Screenlast_screen = NULL
 

Detailed Description

Author
awewsomegamer awews.nosp@m.omeg.nosp@m.amer@.nosp@m.gmai.nosp@m.l.com

LICENSE

Assembled - Column based text editor Copyright (C) 2023-2024 awewsomegamer

This file is apart of Assembled.

Assembled is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

DESCRIPTION

The screen manager.

Function Documentation

◆ draw_border()

void draw_border ( struct AS_Bound bound)

Utility function to draw a border around a given boundary

Parameters
structAS_Bound bound - The boundary around which to draw the border.

◆ register_screen()

int register_screen ( char * name,
void(*)(struct AS_RenderCtx *) render,
void(*)(struct AS_RenderCtx *) update,
void(*)(int, int) local )

Registers a screen in the hashmap.

The following initializes an entry in the hashmap with the given arguments. The index within the hashmap is calculated using the name parameter.

Parameters
char*name - The string by which to calculate the index within the hashmap
void(*render)(struct AS_RenderCtx *) - The render function of the screen.
void(*update)(struct AS_RenderCtx *) - The update function of the screen.
void(*local)(int, int) - The local function of the screen.

◆ switch_to_last_screen()

int switch_to_last_screen ( )

Switches to the last screen.

The function flips the as_ctx.screen and the internal last_screen pointers.

Returns
The index of the screen in the hashmap.

◆ switch_to_screen()

int switch_to_screen ( char * name)

Switch to the given screen

Change as_ctx.screen to the screen found at the given name in the screens hashmap.

Parameters
char*name - The name of the screen to switch to.
Returns
The index of the screen in the hashmap.