From: yu.dongliang <18588496441@163.com> Date: Sat, 15 Apr 2023 07:21:33 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=e7303ddfe63cff8b56e2731122827c76611e6b39;p=simplay.git tmp --- diff --git a/main.c b/main.c index c06b6ad..41eeecf 100644 --- a/main.c +++ b/main.c @@ -1,21 +1,12 @@ #include -#include +#include "simp.h" -void chess_file_new(GtkMenuButton* self, gpointer user_data) -{ - printf("%s(),%d\n", __func__, __LINE__); - - GtkBuilder *builder; - GtkNotebook *code_notebook; - GtkWidget *code_page; +GtkWidget* gl_area = NULL; - builder = GTK_BUILDER(user_data); -} - -void chess_file_open(GtkMenuButton* self, gpointer user_data) +void simp_file_add(GtkMenuButton* self, gpointer user_data) { printf("%s(),%d\n", __func__, __LINE__); - +#if 0 GtkBuilder *builder; GtkWindow *window; GtkWidget *dialog; @@ -25,7 +16,7 @@ void chess_file_open(GtkMenuButton* self, gpointer user_data) GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; - dialog = gtk_file_chooser_dialog_new ("Open File", + dialog = gtk_file_chooser_dialog_new ("add source", window, action, "_Cancel", @@ -37,41 +28,10 @@ void chess_file_open(GtkMenuButton* self, gpointer user_data) gtk_widget_show(dialog); g_signal_connect(dialog, "response", G_CALLBACK(on_open_response), NULL); +#endif } -void chess_file_save(GtkMenuButton* self, gpointer user_data) -{ - printf("%s(),%d\n", __func__, __LINE__); -} - -void chess_file_save_as(GtkMenuButton* self, gpointer user_data) -{ - printf("%s(),%d\n", __func__, __LINE__); - - GtkBuilder *builder; - GtkWindow *window; - GtkWidget *dialog; - - builder = GTK_BUILDER(user_data); - window = GTK_WINDOW(gtk_builder_get_object(builder, "main_window")); - - GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE; - - dialog = gtk_file_chooser_dialog_new ("Save File", - window, - action, - "_Cancel", - GTK_RESPONSE_CANCEL, - "_Save", - GTK_RESPONSE_ACCEPT, - NULL); - - gtk_widget_show(dialog); - - g_signal_connect(dialog, "response", G_CALLBACK(on_save_response), NULL); -} - -void chess_edit_reset(GtkMenuButton* self, gpointer user_data) +void simp_edit_play(GtkMenuButton* self, gpointer user_data) { printf("%s(),%d\n", __func__, __LINE__); @@ -110,12 +70,12 @@ static gboolean render(GtkGLArea *area, GdkGLContext *context) if (gtk_gl_area_get_error (area) != NULL) return FALSE; - glViewport(0, 0, 512, 512); + glViewport(0, 0, 1920, 1080); glClearColor (1.0, 0.0, 0.0, 1.0); glClear (GL_COLOR_BUFFER_BIT); -// chess_gl_draw(gl); + // draw glFlush (); @@ -128,68 +88,75 @@ static gboolean button_release_event (GtkWidget* self, GdkEventButton* event, gp return TRUE; } +static gboolean simp_record(GtkWidget* self, GdkEventButton* event, gpointer user_data) +{ + printf("%s(),%d\n", __func__, __LINE__); + return TRUE; +} + +static gboolean simp_pause(GtkWidget* self, GdkEventButton* event, gpointer user_data) +{ + printf("%s(),%d\n", __func__, __LINE__); + return TRUE; +} + +static gboolean simp_stop(GtkWidget* self, GdkEventButton* event, gpointer user_data) +{ + printf("%s(),%d\n", __func__, __LINE__); + return TRUE; +} int main(int argc, char *argv[]) { printf("%s(),%d\n", __func__, __LINE__); GtkBuilder *builder; - GObject *window; - - GObject *menu_file_quit; - GObject *menu_file_new; - GObject *menu_file_open; - GObject *menu_file_save; - GObject *menu_file_save_as; - GObject *menu_edit_back; - GObject *menu_edit_next; - GObject *menu_edit_mode; - GObject *menu_edit_reset; - GError *error = NULL; + GObject *window; + + GObject *menu_file_quit; + GObject *menu_file_add; + + GObject *button_record; + GObject *button_pause; + GObject *button_stop; + + GError *error = NULL; gtk_init (&argc, &argv); -#if 1 - builder = gtk_builder_new (); - if (gtk_builder_add_from_file (builder, "chess.glade", &error) == 0) + + builder = gtk_builder_new(); + if (gtk_builder_add_from_file (builder, "simp.glade", &error) == 0) { g_printerr ("Error loading file: %s\n", error->message); g_clear_error (&error); return 1; } -#endif - window = gtk_builder_get_object (builder, "main_window"); - g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); - -#if 1 - menu_file_quit = gtk_builder_get_object (builder, "menu_file_quit"); - menu_file_new = gtk_builder_get_object (builder, "menu_file_new"); - menu_file_open = gtk_builder_get_object (builder, "menu_file_open"); - menu_file_save = gtk_builder_get_object (builder, "menu_file_save"); - menu_file_save_as = gtk_builder_get_object (builder, "menu_file_save_as"); - - menu_edit_back = gtk_builder_get_object (builder, "menu_edit_back"); - menu_edit_next = gtk_builder_get_object (builder, "menu_edit_next"); - menu_edit_reset = gtk_builder_get_object (builder, "menu_edit_reset"); - - g_signal_connect(menu_file_quit, "activate", G_CALLBACK(gtk_main_quit), NULL); - g_signal_connect(menu_file_new, "activate", G_CALLBACK(chess_file_new), builder); - g_signal_connect(menu_file_open, "activate", G_CALLBACK(chess_file_open), builder); - g_signal_connect(menu_file_save, "activate", G_CALLBACK(chess_file_save), builder); - g_signal_connect(menu_file_save_as, "activate", G_CALLBACK(chess_file_save_as), builder); - - g_signal_connect(menu_edit_back, "activate", G_CALLBACK(chess_edit_back), builder); - g_signal_connect(menu_edit_next, "activate", G_CALLBACK(chess_edit_next), builder); - g_signal_connect(menu_edit_reset, "activate", G_CALLBACK(chess_edit_reset), builder); - g_signal_connect(menu_edit_mode, "activate", G_CALLBACK(chess_edit_mode), builder); -#endif - gl_area = GTK_WIDGET(gtk_builder_get_object(builder, "gl_area")); + window = gtk_builder_get_object (builder, "main_window"); + + menu_file_quit = gtk_builder_get_object (builder, "menu_file_quit"); + menu_file_add = gtk_builder_get_object (builder, "menu_file_add"); + + button_record = gtk_builder_get_object (builder, "button_record"); + button_pause = gtk_builder_get_object (builder, "button_pause"); + button_stop = gtk_builder_get_object (builder, "button_stop"); + + gl_area = GTK_WIDGET(gtk_builder_get_object(builder, "gl_area")); + + g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + + g_signal_connect(menu_file_quit, "activate", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(menu_file_add, "activate", G_CALLBACK(simp_file_add), builder); + + g_signal_connect(button_record, "activate", G_CALLBACK(simp_record), builder); + g_signal_connect(button_pause, "activate", G_CALLBACK(simp_pause), builder); + g_signal_connect(button_stop, "activate", G_CALLBACK(simp_stop), builder); - g_signal_connect (gl_area, "resize", G_CALLBACK (resize), NULL); - g_signal_connect (gl_area, "unrealize", G_CALLBACK (unrealize), NULL); - g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL); + g_signal_connect(gl_area, "resize", G_CALLBACK(resize), NULL); + g_signal_connect(gl_area, "unrealize", G_CALLBACK(unrealize), NULL); + g_signal_connect(gl_area, "render", G_CALLBACK(render), NULL); - g_signal_connect (window, "button-release-event", G_CALLBACK (button_release_event), NULL); + g_signal_connect(window, "button-release-event", G_CALLBACK(button_release_event), NULL); gtk_widget_show_all(GTK_WIDGET(window)); diff --git a/simp.glade b/simp.glade index 588fde0..e8130c4 100644 --- a/simp.glade +++ b/simp.glade @@ -7,8 +7,8 @@ False 国际象棋 False - 640 - 544 + 1280 + 720 @@ -71,7 +71,7 @@ False - 上一步(B) + 播放(P) True False True diff --git a/simp.h b/simp.h index bf7c56d..ca73079 100644 --- a/simp.h +++ b/simp.h @@ -14,6 +14,10 @@ #include "libavfilter/buffersink.h" #include "libavutil/audio_fifo.h" +#define GL_GLEXT_PROTOTYPES +#include +#include + typedef struct simp_avio_s simp_avio_t; typedef struct simp_avio_ops_s simp_avio_ops_t;