ShaderTool  0.1
Live tool for developing OpenGL shaders interactively
Macros | Functions
io.c File Reference
#include <FreeImage.h>
#include <errno.h>
#include <libgen.h>
#include <stdlib.h>
#include <string.h>
#include <sys/inotify.h>
#include <time.h>
#include <unistd.h>
#include "log.h"
#include "renderer.h"
#include "shaders.h"
Include dependency graph for io.c:

Macros

#define BUF_LEN   (10 * (sizeof(struct inotify_event) + 1))
 

Functions

char * basename_without_suffix (const char *filename)
 Return the file name without the leading directories and without the extension. More...
 
void capture_screenshot (struct renderer_state *state)
 Capture a screenshot of the current window. More...
 
void process_input (struct renderer_state *state)
 Ensure the window is closed when the user presses the escape key. More...
 

Macro Definition Documentation

◆ BUF_LEN

#define BUF_LEN   (10 * (sizeof(struct inotify_event) + 1))

Function Documentation

◆ basename_without_suffix()

char* basename_without_suffix ( const char *  filename)

Return the file name without the leading directories and without the extension.

Parameters
filenameThe original filename.
Returns
A newly allocated string containing the output of basename(3) without the extension.

◆ capture_screenshot()

void capture_screenshot ( struct renderer_state state)

Capture a screenshot of the current window.

Takes the dimensions of the viewport to save a pixel array of the same dimensions. Uses FreeImage to create an image from the raw pixels and save it to disk.

Parameters
stateThe renderer state, needed to get the name of the current shader and the frame count.

◆ process_input()

void process_input ( struct renderer_state state)

Ensure the window is closed when the user presses the escape key.

Parameters
stateThe current state of the renderer.