Skip to content

Instantly share code, notes, and snippets.

View ermiry's full-sized avatar
🏠
Working from home

Erick Salas ermiry

🏠
Working from home
View GitHub Profile
@ermiry
ermiry / user.c
Last active November 17, 2019 01:04
User Structure Example
#include <stdlib.h>
#include <string.h>
typedef struct User {
char *name;
int id;
} User;
@ermiry
ermiry / avl.h
Created November 17, 2019 02:04
AVL Tree Header
#ifndef _COLLECTIONS_AVL_H_
#define _COLLECTIONS_AVL_H_
#include <stdbool.h>
typedef struct AVLNode {
void *id;
char balance;
struct AVLNode* left, *right;
@ermiry
ermiry / main.c
Created November 17, 2019 02:15
AVL Tree Example
#include <stdlib.h>
#include <stdio.h>
#include "avl.h"
void avl_print (AVLNode *node) {
if (node) {
avl_print (node->right);
#include "cengine/renderer.h"
#include "cengine/ui/font.h"
int load_font (Renderer *renderer) {
int retval = 1;
if (renderer) {
// first create the font structure
Font *main_font = ui_font_create ("roboto", "./assets/fonts/Roboto-Regular.ttf");
#include "cengine/renderer.h"
#include "cengine/ui/image.h"
void image_display_with_outline (const char *filename) {
if (filename) {
Renderer *main_renderer = renderer_get_by_name ("main");
Image *image = ui_image_create_static (0, 0, main_renderer);
#include "cengine/renderer.h"
#include "cengine/ui/image.h"
void cimage_like_image_create (const char *filename,
SDL_Texture *overlay_texture, SDL_Texture *selected_texture) {
if (filename && overlay_texture && selected_texture) {
Renderer *main_renderer = renderer_get_by_name ("main");
Image *image = ui_image_create_static (0, 0, main_renderer);
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/font.h"
#include "cengine/ui/inputfield.h"
void input_field_create () {
Renderer *main_renderer = renderer_get_by_name ("main");
Font *font = ui_font_get_default ();
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/panel.h"
// you can use a panel as background for your application
void set_background (void) {
Renderer *main_renderer = renderer_get_by_name ("main");
#include "cengine/types/types.h"
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/image.h"
#include "cengine/ui/panel.h"
Panel *images_panel = NULL;
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/font.h"
#include "cengine/ui/textbox.h"
// creates and display a textbox at the center of the screen
void display_text (const char *text) {
Renderer *main_renderer = renderer_get_by_name ("main");