Changed function naming style
This commit is contained in:
parent
9c42fae1f2
commit
91026f87be
|
@ -26,18 +26,18 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <GL/glu.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 );
|
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 );
|
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,
|
GLenum severity, GLsizei length, const GLchar *msg,
|
||||||
const void *data );
|
const void *data );
|
||||||
|
|
||||||
void graphicsInitGL(void);
|
void graphics_init(void);
|
||||||
|
|
||||||
void graphicsShutdownGL(void);
|
void graphics_shutdown(void);
|
||||||
|
|
|
@ -115,9 +115,9 @@ static const GActionEntry app_actions[] = {
|
||||||
{ "savefile", on_savefile_action, NULL, NULL, NULL },
|
{ "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
|
// Actions responses
|
||||||
|
@ -136,6 +136,6 @@ void on_openfile_response_complete(GObject *source_object,
|
||||||
// Window primitives
|
// 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);
|
||||||
|
|
|
@ -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 );
|
GLsizei length, const GLchar *msg, const void *data );
|
||||||
|
|
||||||
static inline void compute_i(float *res)
|
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 */
|
/* Create and compile a shader */
|
||||||
static GLuint createShader(int type, const char *src)
|
static GLuint create_shader(int type, const char *src)
|
||||||
{
|
{
|
||||||
GLuint shader;
|
GLuint shader;
|
||||||
int status;
|
int status;
|
||||||
|
@ -180,7 +180,7 @@ static GLuint createShader(int type, const char *src)
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *readShaderFile(char *filename)
|
static inline char *read_shader_file(char *filename)
|
||||||
{
|
{
|
||||||
int fd = open(filename, O_RDONLY);
|
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 m[16];
|
||||||
float v[16];
|
float v[16];
|
||||||
|
@ -258,7 +258,7 @@ void graphicsDraw(void)
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the GL buffers */
|
/* 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 *color_buffer_out)
|
||||||
{
|
{
|
||||||
GLuint vao, vertex_buffer, color_buffer;
|
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 */
|
/* 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 *v_out, GLuint *p_out)
|
||||||
{
|
{
|
||||||
GLuint vertex, fragment;
|
GLuint vertex, fragment;
|
||||||
|
@ -314,14 +314,14 @@ void graphicsInitShaders( GLuint *program_out, GLuint *m_out,
|
||||||
GLuint p = 0;
|
GLuint p = 0;
|
||||||
int status;
|
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) {
|
if(vertex == 0) {
|
||||||
*program_out = 0;
|
*program_out = 0;
|
||||||
return;
|
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) {
|
if(fragment == 0) {
|
||||||
glDeleteShader(vertex);
|
glDeleteShader(vertex);
|
||||||
|
@ -381,7 +381,7 @@ out:
|
||||||
*p_out = p;
|
*p_out = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphicsInitGL(void)
|
void graphics_init(void)
|
||||||
{
|
{
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||||
|
@ -389,12 +389,12 @@ void graphicsInitGL(void)
|
||||||
//glEnable(GL_POLYGON_SMOOTH);
|
//glEnable(GL_POLYGON_SMOOTH);
|
||||||
//glEnable(GL_PROGRAM_POINT_SIZE);
|
//glEnable(GL_PROGRAM_POINT_SIZE);
|
||||||
|
|
||||||
graphicsInitBuffers(NULL, &position_buffer, &color_buffer);
|
graphics_init_buffers(NULL, &position_buffer, &color_buffer);
|
||||||
graphicsInitShaders(&program, &m_location, &v_location, &p_location);
|
graphics_init_shaders(&program, &m_location, &v_location, &p_location);
|
||||||
glDebugMessageCallback(graphicsDebugCallback, NULL);
|
glDebugMessageCallback(graphics_debug_callback, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphicsShutdownGL(void)
|
void graphics_shutdown(void)
|
||||||
{
|
{
|
||||||
glDeleteBuffers(1, &position_buffer);
|
glDeleteBuffers(1, &position_buffer);
|
||||||
glDeleteBuffers(1, &color_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 )
|
GLsizei length, const GLchar *msg, const void *data )
|
||||||
{
|
{
|
||||||
const char *errsource;
|
const char *errsource;
|
||||||
|
|
|
@ -69,7 +69,7 @@ void on_preferences_action(GSimpleAction *action,
|
||||||
|
|
||||||
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
||||||
|
|
||||||
uiWindowSendNotification("Not implemented !");
|
ui_send_notification("Not implemented !");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_togglesidebar_action(GSimpleAction *action,
|
void on_togglesidebar_action(GSimpleAction *action,
|
||||||
|
@ -80,7 +80,7 @@ void on_togglesidebar_action(GSimpleAction *action,
|
||||||
|
|
||||||
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
||||||
|
|
||||||
uiWindowSendNotification("Not implemented !");
|
ui_send_notification("Not implemented !");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_editmode_action(GSimpleAction *action,
|
void on_editmode_action(GSimpleAction *action,
|
||||||
|
@ -91,7 +91,7 @@ void on_editmode_action(GSimpleAction *action,
|
||||||
|
|
||||||
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
||||||
|
|
||||||
uiWindowStackChange("edit");
|
ui_set_stack("edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_runmode_action(GSimpleAction *action,
|
void on_runmode_action(GSimpleAction *action,
|
||||||
|
@ -102,7 +102,7 @@ void on_runmode_action(GSimpleAction *action,
|
||||||
|
|
||||||
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
||||||
|
|
||||||
uiWindowStackChange("run");
|
ui_set_stack("run");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_presentmode_action(GSimpleAction *action,
|
void on_presentmode_action(GSimpleAction *action,
|
||||||
|
@ -113,7 +113,7 @@ void on_presentmode_action(GSimpleAction *action,
|
||||||
|
|
||||||
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
||||||
|
|
||||||
uiWindowStackChange("presentation");
|
ui_set_stack("presentation");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_openfile_action(GSimpleAction *action,
|
void on_openfile_action(GSimpleAction *action,
|
||||||
|
@ -152,12 +152,12 @@ void on_closefile_action(GSimpleAction *action,
|
||||||
|
|
||||||
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
g_assert(GEM_GRAPH_CLIENT_IS_APPLICATION(self));
|
||||||
|
|
||||||
uiApplicationDisableAction("closefile");
|
ui_disable_action("closefile");
|
||||||
uiApplicationDisableAction("savefile");
|
ui_disable_action("savefile");
|
||||||
uiApplicationDisableAction("runmode");
|
ui_disable_action("runmode");
|
||||||
uiApplicationDisableAction("editmode");
|
ui_disable_action("editmode");
|
||||||
uiApplicationDisableAction("presentmode");
|
ui_disable_action("presentmode");
|
||||||
uiWindowStackChange("home");
|
ui_set_stack("home");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_savefile_action(GSimpleAction *action,
|
void on_savefile_action(GSimpleAction *action,
|
||||||
|
@ -202,7 +202,7 @@ void on_openfile_response_complete(GObject *source_object,
|
||||||
{
|
{
|
||||||
GFile *file = G_FILE(source_object);
|
GFile *file = G_FILE(source_object);
|
||||||
|
|
||||||
char *contents = NULL;
|
g_autofree char *contents = NULL;
|
||||||
gsize length = 0;
|
gsize length = 0;
|
||||||
|
|
||||||
g_autoptr(GError) error = NULL;
|
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);
|
g_print("File content is :\n%s\n", contents);
|
||||||
|
|
||||||
uiApplicationEnableAction("closefile");
|
ui_enable_action("closefile");
|
||||||
uiApplicationEnableAction("savefile");
|
ui_enable_action("savefile");
|
||||||
uiApplicationEnableAction("runmode");
|
ui_enable_action("runmode");
|
||||||
uiApplicationEnableAction("editmode");
|
ui_enable_action("editmode");
|
||||||
uiApplicationEnableAction("presentmode");
|
ui_enable_action("presentmode");
|
||||||
uiWindowStackChange("edit");
|
ui_set_stack("edit");
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ static GemGraphClientApplication *application;
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void uiApplicationEnableAction(const char *name) {
|
void ui_enable_action(const char *name) {
|
||||||
g_simple_action_set_enabled(
|
g_simple_action_set_enabled(
|
||||||
(GSimpleAction *)g_action_map_lookup_action(
|
(GSimpleAction *)g_action_map_lookup_action(
|
||||||
G_ACTION_MAP(application),
|
G_ACTION_MAP(application),
|
||||||
|
@ -47,7 +47,7 @@ void uiApplicationEnableAction(const char *name) {
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiApplicationDisableAction(const char *name) {
|
void ui_disable_action(const char *name) {
|
||||||
g_simple_action_set_enabled(
|
g_simple_action_set_enabled(
|
||||||
(GSimpleAction *)g_action_map_lookup_action(
|
(GSimpleAction *)g_action_map_lookup_action(
|
||||||
G_ACTION_MAP(application),
|
G_ACTION_MAP(application),
|
||||||
|
@ -71,7 +71,7 @@ static void gem_graph_client_application_activate(GApplication *app)
|
||||||
"application", app,
|
"application", app,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
uiWindowStackChange("home");
|
ui_set_stack("home");
|
||||||
|
|
||||||
gtk_window_present(window);
|
gtk_window_present(window);
|
||||||
}
|
}
|
||||||
|
@ -109,11 +109,11 @@ static void gem_graph_client_application_init(GemGraphClientApplication *self)
|
||||||
//
|
//
|
||||||
// Disable unneeded/inoperant actions
|
// Disable unneeded/inoperant actions
|
||||||
//
|
//
|
||||||
uiApplicationDisableAction("savefile");
|
ui_disable_action("savefile");
|
||||||
uiApplicationDisableAction("closefile");
|
ui_disable_action("closefile");
|
||||||
uiApplicationDisableAction("editmode");
|
ui_disable_action("editmode");
|
||||||
uiApplicationDisableAction("runmode");
|
ui_disable_action("runmode");
|
||||||
uiApplicationDisableAction("presentmode");
|
ui_disable_action("presentmode");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -105,7 +105,7 @@ static gboolean on_render(GtkGLArea * area, GdkGLContext * context)
|
||||||
if(gtk_gl_area_get_error(area) != NULL)
|
if(gtk_gl_area_get_error(area) != NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
graphicsDraw();
|
graphics_draw();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ static void on_realize(GtkWidget *widget)
|
||||||
if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL)
|
if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
graphicsInitGL();
|
graphics_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We should tear down the state when unrealizing */
|
/* 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)
|
if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
graphicsShutdownGL();
|
graphics_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_close_window(GtkWidget *widget)
|
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) {
|
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) {
|
if (window->toast_overlay == NULL) {
|
||||||
g_printerr("Can't find self->toast_overlay !\n");
|
g_printerr("Can't find self->toast_overlay !\n");
|
||||||
|
|
Loading…
Reference in New Issue