Progmar Marcin Załęczny

Language:
We are using cookies in the page. If you use the page you agree for the cookies.      Close

VGE Resources Manager

Operating system: Ubuntu 20.04+

VGE Resources application gives to you possibility of creating and managing resources in your applications: image files, text files, audio files and binary files. It was created with developing video games on mind but also is useful for standard desktop applications - everywhere where is need to pack multiple files into single binaries.

Application also contains library which can be used to load resources in the your own programs written in C or C++.
There are available too three sample programs demonstrating how to use the libraray - first in console, second in GTK+ 3.0, third in GTK+ 3.0 and GtkGLArea widget for drawing 3d models and fourth in Vulkan+XCB.

Install from the Snap Store with command: sudo snap install vge-resources

Get it from the Snap Store

Libary for C/C++ and sample resources files

New functionality in version: v1.3

  • Added drawing bitmaps with regarding transparent pixels.
  • Added in json description options for:
    • draw_with_alpha - if 0 then blit_canvas is called (no alpha taking into account - default) elsewhere blit_canvas_with_alpha is called (draw with transparency),
    • visible - if 1 (default) then object is drawed elsewhere is skipped,
    • offset_y - src_offset y (default 0) in drawing object (if <0 then offset_y lines from the top of source is skipped).
  • Added canvas draw_border function.
  • Added canvas mask function.
  • Added option for converting color to alpha value.
  • Added snap version of the application.

New functionality in version: v1.2

  • Preview (rendering) of model files of type Wavefront *.obj and added vast options that affects that rendering.
  • Automatic adding all files related with selected *.obj file (material and texture files).
  • Saving on exit and restoring on startup main window size and location.
  • Saving and restoring last chosen directory in "select files dialog boxes".
  • Added sample for *.obj model rendering in Gtk and OpenGL.
  • Added sample resource file with some wavefront models.
For Ubuntu 20.04 to 21.04
For Ubuntu 21.10+

New functionality in version: v1.1

  • Added preview of font files.
  • Added handlers for playing uncompressed *.wav files.

 

Listing below presents the shortest possible use case of the library. Lines related to library use (loading and releasing buffers) are written in strong.

#include <stdlib.h>
#include <stdio.h>
#include "../lib/vge-resources/include/vge-resources.h"

int main(int argc, char *argv[]) {
    char *buffer;
    size_t buffer_size;

    if (get_resource_by_name("resources.db", "test.txt", &buffer, &buffer_size, -1) == 0) {
        printf("Text from the resources: %s\n", buffer);
        printf("Returned size: %lu\n", buffer_size);
        printf("strlen of the text: %lu\n", strlen(buffer));
        printf("last byte: %d\n", buffer[buffer_size]);
        free(buffer);
    }

    return 0;
}

And a simplest example of windowed application:

#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
#include "../lib/vge-resources/include/vge-resources.h"

int main(int argc, char *argv[]) {
    gchar *buffer;
    gsize buffer_size;
    GdkPixbufLoader *loader;
    GdkPixbuf *pixbuf;
    GtkWidget *window, *scrolled_window;
    GtkWidget *image;

    gtk_init (&argc, &argv);

    if (get_resource_by_name("resources_gtk.db", "mms_img31238.jpg", &buffer, &buffer_size, -1) == 0) {
        loader = gdk_pixbuf_loader_new();
        gdk_pixbuf_loader_write(loader, buffer, buffer_size, NULL);
        pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
        free(buffer);

        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_default_size(GTK_WINDOW(window), 900, 700);
        scrolled_window = gtk_scrolled_window_new(NULL, NULL);
        image = gtk_image_new_from_pixbuf(pixbuf);
        gtk_container_add(GTK_CONTAINER(window), scrolled_window);
        gtk_container_add(GTK_CONTAINER(scrolled_window), image);
        gtk_widget_show_all(GTK_WIDGET(window));
        g_signal_connect(window, "destroy", gtk_main_quit, NULL);
        gtk_main();
    }

    return 0;
}

Third example attached to the program's tarball is demo of using animation and resources in app written in Vulcan SDK. Because of the sources length I do not insert it to this website.