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 / mongo.c
Last active April 28, 2020 14:53
#include "mongo.h"
// opens handle to user collection
int users_collection_get (void) {
int errors = 0;
users_collection = mongo_collection_get (USERS_COLL_NAME);
if (!users_collection) {
log_msg (stderr, LOG_ERROR, LOG_NO_TYPE, "Failed to get handle to users collection!");
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/font.h"
#include "cengine/ui/dropdown.h"
void dropdown_create (void) {
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/button.h"
void create_button (void) {
Renderer *main_renderer = renderer_get_by_name ("main");
Button *btn = ui_button_create (0, 0, 128, 128, UI_POS_MIDDLE_CENTER, main_renderer);
#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");
#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/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/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/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/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/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");