This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <string.h> | |
typedef struct User { | |
char *name; | |
int id; | |
} User; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _COLLECTIONS_AVL_H_ | |
#define _COLLECTIONS_AVL_H_ | |
#include <stdbool.h> | |
typedef struct AVLNode { | |
void *id; | |
char balance; | |
struct AVLNode* left, *right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include "avl.h" | |
void avl_print (AVLNode *node) { | |
if (node) { | |
avl_print (node->right); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); |
OlderNewer