Changed function naming style

This commit is contained in:
Adrien Bourmault 2023-01-25 19:27:51 +01:00
parent 9c42fae1f2
commit 91026f87be
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
6 changed files with 55 additions and 55 deletions

View File

@ -26,18 +26,18 @@
#include <unistd.h>
#include <GL/glu.h>
void graphicsDraw(void);
void graphics_draw(void);
void graphicsInitBuffers( GLuint *vao_out, GLuint *buffer_out,
void graphics_init_buffers( GLuint *vao_out, GLuint *buffer_out,
GLuint *color_buffer_out );
void graphicsInitShaders( GLuint *program_out, GLuint *m_out,
void graphics_init_shaders( GLuint *program_out, GLuint *m_out,
GLuint *v_out, GLuint *p_out );
void graphicsDebugCallback( GLenum source, GLenum type, GLuint id,
void graphics_debug_callback( GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length, const GLchar *msg,
const void *data );
void graphicsInitGL(void);
void graphics_init(void);
void graphicsShutdownGL(void);
void graphics_shutdown(void);

View File

@ -115,9 +115,9 @@ static const GActionEntry app_actions[] = {
{ "savefile", on_savefile_action, NULL, NULL, NULL },
};
void uiApplicationEnableAction(const char *name);
void ui_enable_action(const char *name);
void uiApplicationDisableAction(const char *name);
void ui_disable_action(const char *name);
//
// Actions responses
@ -136,6 +136,6 @@ void on_openfile_response_complete(GObject *source_object,
// Window primitives
//
void uiWindowStackChange(const char *mode);
void ui_set_stack(const char *mode);
void uiWindowSendNotification(const char *message);
void ui_send_notification(const char *message);

View File

@ -98,7 +98,7 @@ static GLfloat color_base[] = {
/* -------------------------------------------------------------------------- */
void graphicsDebugCallback( GLenum source, GLenum type, GLuint id, GLenum severity,
void graphics_debug_callback( GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar *msg, const void *data );
static inline void compute_i(float *res)
@ -147,7 +147,7 @@ static inline void compute_mvp(float *res, float phi, float theta, float psi)
}
/* Create and compile a shader */
static GLuint createShader(int type, const char *src)
static GLuint create_shader(int type, const char *src)
{
GLuint shader;
int status;
@ -180,7 +180,7 @@ static GLuint createShader(int type, const char *src)
return shader;
}
static inline char *readShaderFile(char *filename)
static inline char *read_shader_file(char *filename)
{
int fd = open(filename, O_RDONLY);
@ -206,7 +206,7 @@ static inline char *readShaderFile(char *filename)
/* -------------------------------------------------------------------------- */
void graphicsDraw(void)
void graphics_draw(void)
{
float m[16];
float v[16];
@ -258,7 +258,7 @@ void graphicsDraw(void)
/* Initialize the GL buffers */
void graphicsInitBuffers( GLuint *vao_out, GLuint *buffer_out,
void graphics_init_buffers( GLuint *vao_out, GLuint *buffer_out,
GLuint *color_buffer_out)
{
GLuint vao, vertex_buffer, color_buffer;
@ -304,7 +304,7 @@ void graphicsInitBuffers( GLuint *vao_out, GLuint *buffer_out,
/* Initialize the shaders and link them into a program */
void graphicsInitShaders( GLuint *program_out, GLuint *m_out,
void graphics_init_shaders( GLuint *program_out, GLuint *m_out,
GLuint *v_out, GLuint *p_out)
{
GLuint vertex, fragment;
@ -314,14 +314,14 @@ void graphicsInitShaders( GLuint *program_out, GLuint *m_out,
GLuint p = 0;
int status;
vertex = createShader(GL_VERTEX_SHADER, readShaderFile(VERTEX_SHADER_FILE));
vertex = create_shader(GL_VERTEX_SHADER, read_shader_file(VERTEX_SHADER_FILE));
if(vertex == 0) {
*program_out = 0;
return;
}
fragment = createShader(GL_FRAGMENT_SHADER, readShaderFile(FRAG_SHADER_FILE));
fragment = create_shader(GL_FRAGMENT_SHADER, read_shader_file(FRAG_SHADER_FILE));
if(fragment == 0) {
glDeleteShader(vertex);
@ -381,7 +381,7 @@ out:
*p_out = p;
}
void graphicsInitGL(void)
void graphics_init(void)
{
glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
@ -389,12 +389,12 @@ void graphicsInitGL(void)
//glEnable(GL_POLYGON_SMOOTH);
//glEnable(GL_PROGRAM_POINT_SIZE);
graphicsInitBuffers(NULL, &position_buffer, &color_buffer);
graphicsInitShaders(&program, &m_location, &v_location, &p_location);
glDebugMessageCallback(graphicsDebugCallback, NULL);
graphics_init_buffers(NULL, &position_buffer, &color_buffer);
graphics_init_shaders(&program, &m_location, &v_location, &p_location);
glDebugMessageCallback(graphics_debug_callback, NULL);
}
void graphicsShutdownGL(void)
void graphics_shutdown(void)
{
glDeleteBuffers(1, &position_buffer);
glDeleteBuffers(1, &color_buffer);
@ -404,7 +404,7 @@ void graphicsShutdownGL(void)
/* -------------------------------------------------------------------------- */
void graphicsDebugCallback( GLenum source, GLenum type, GLuint id, GLenum severity,
void graphics_debug_callback( GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar *msg, const void *data )
{
const char *errsource;

View File

@ -69,7 +69,7 @@ void on_preferences_action(GSimpleAction *action,
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
uiWindowSendNotification("Not implemented !");
ui_send_notification("Not implemented !");
}
void on_togglesidebar_action(GSimpleAction *action,
@ -80,7 +80,7 @@ void on_togglesidebar_action(GSimpleAction *action,
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
uiWindowSendNotification("Not implemented !");
ui_send_notification("Not implemented !");
}
void on_editmode_action(GSimpleAction *action,
@ -91,7 +91,7 @@ void on_editmode_action(GSimpleAction *action,
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
uiWindowStackChange("edit");
ui_set_stack("edit");
}
void on_runmode_action(GSimpleAction *action,
@ -102,7 +102,7 @@ void on_runmode_action(GSimpleAction *action,
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
uiWindowStackChange("run");
ui_set_stack("run");
}
void on_presentmode_action(GSimpleAction *action,
@ -113,7 +113,7 @@ void on_presentmode_action(GSimpleAction *action,
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
uiWindowStackChange("presentation");
ui_set_stack("presentation");
}
void on_openfile_action(GSimpleAction *action,
@ -152,12 +152,12 @@ void on_closefile_action(GSimpleAction *action,
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
uiApplicationDisableAction("closefile");
uiApplicationDisableAction("savefile");
uiApplicationDisableAction("runmode");
uiApplicationDisableAction("editmode");
uiApplicationDisableAction("presentmode");
uiWindowStackChange("home");
ui_disable_action("closefile");
ui_disable_action("savefile");
ui_disable_action("runmode");
ui_disable_action("editmode");
ui_disable_action("presentmode");
ui_set_stack("home");
}
void on_savefile_action(GSimpleAction *action,
@ -202,7 +202,7 @@ void on_openfile_response_complete(GObject *source_object,
{
GFile *file = G_FILE(source_object);
char *contents = NULL;
g_autofree char *contents = NULL;
gsize length = 0;
g_autoptr(GError) error = NULL;
@ -227,10 +227,10 @@ void on_openfile_response_complete(GObject *source_object,
g_print("File content is :\n%s\n", contents);
uiApplicationEnableAction("closefile");
uiApplicationEnableAction("savefile");
uiApplicationEnableAction("runmode");
uiApplicationEnableAction("editmode");
uiApplicationEnableAction("presentmode");
uiWindowStackChange("edit");
ui_enable_action("closefile");
ui_enable_action("savefile");
ui_enable_action("runmode");
ui_enable_action("editmode");
ui_enable_action("presentmode");
ui_set_stack("edit");
}

View File

@ -39,7 +39,7 @@ static GemGraphClientApplication *application;
/* -------------------------------------------------------------------------- */
void uiApplicationEnableAction(const char *name) {
void ui_enable_action(const char *name) {
g_simple_action_set_enabled(
(GSimpleAction *)g_action_map_lookup_action(
G_ACTION_MAP(application),
@ -47,7 +47,7 @@ void uiApplicationEnableAction(const char *name) {
true);
}
void uiApplicationDisableAction(const char *name) {
void ui_disable_action(const char *name) {
g_simple_action_set_enabled(
(GSimpleAction *)g_action_map_lookup_action(
G_ACTION_MAP(application),
@ -71,7 +71,7 @@ static void gem_graph_client_application_activate(GApplication *app)
"application", app,
NULL);
uiWindowStackChange("home");
ui_set_stack("home");
gtk_window_present(window);
}
@ -109,11 +109,11 @@ static void gem_graph_client_application_init(GemGraphClientApplication *self)
//
// Disable unneeded/inoperant actions
//
uiApplicationDisableAction("savefile");
uiApplicationDisableAction("closefile");
uiApplicationDisableAction("editmode");
uiApplicationDisableAction("runmode");
uiApplicationDisableAction("presentmode");
ui_disable_action("savefile");
ui_disable_action("closefile");
ui_disable_action("editmode");
ui_disable_action("runmode");
ui_disable_action("presentmode");
}
/* -------------------------------------------------------------------------- */

View File

@ -105,7 +105,7 @@ static gboolean on_render(GtkGLArea * area, GdkGLContext * context)
if(gtk_gl_area_get_error(area) != NULL)
return FALSE;
graphicsDraw();
graphics_draw();
return TRUE;
}
@ -119,7 +119,7 @@ static void on_realize(GtkWidget *widget)
if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL)
return;
graphicsInitGL();
graphics_init();
}
/* We should tear down the state when unrealizing */
@ -130,7 +130,7 @@ static void on_unrealize(GtkWidget *widget)
if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL)
return;
graphicsShutdownGL();
graphics_shutdown();
}
static void on_close_window(GtkWidget *widget)
@ -260,7 +260,7 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
/* -------------------------------------------------------------------------- */
void uiWindowStackChange(const char *mode)
void ui_set_stack(const char *mode)
{
if (window->main_stack == NULL) {
@ -301,7 +301,7 @@ void uiWindowStackChange(const char *mode)
}
}
void uiWindowSendNotification(const char *message)
void ui_send_notification(const char *message)
{
if (window->toast_overlay == NULL) {
g_printerr("Can't find self->toast_overlay !\n");