📄 llk_main.h
字号:
#ifndef __LLK_MAIN_H#define __LLK_MAIN_H#include <gtk/gtk.h>#include <stdio.h>#include <strings.h>#include "llk_algorithm.h"#include "about.h"#include "img/image_cards.h"#include "img/pause.h"#include "img/logo.h"#include "img/main_bg.h"#include "img/vertical.h"#include "img/horizon.h"#define UI_FIXED_START_DRAW_LEFT 145#define UI_FIXED_START_DRAW_TOP 60#define UI_IMAGE_WIDTH 46#define UI_IMAGE_HEIGHT 55#define UI_IMAGE_BORDER 5struct UiTop{ GtkWidget *label_difficulty; GtkWidget *label_life; GtkWidget *label_level; GtkWidget *label_hint; GtkWidget *label_change_type; GtkWidget *label_score; GtkWidget *progress_bar;};struct UiTop ui_top;struct AlgorithmPoint ui_point1,ui_point2;GtkWidget *ui_drawingarea; /*绘图区的指针*/static GdkPixmap *ui_double_pixmap = NULL; /* 绘制区的后端位图 */GdkPixbuf *ui_pixbuf;GtkCheckMenuItem *item_use_mycards;gint time_remain;gint timer_handle;void get_main_menu( GtkWidget *window, GtkWidget **menubar);static void print_hello( GtkWidget *w,gpointer data ); /*测试用的函数*/void ui_about(GtkWidget *w,gpointer data){show_about();}void ui_rule(GtkWidget *w,gpointer data){show_rule();}gboolean ui_drawingarea_clicked(GtkWidget *fixed, GdkEventButton *event);void ui_drawingarea_draw_bg(gint choice);void ui_game_begin(GtkWidget *w,gpointer data);void ui_game_giveup(GtkWidget *w,gpointer data);gboolean ui_game_init(void);gboolean ui_replace_image(struct AlgorithmPoint p1,struct AlgorithmPoint p2);gboolean ui_redraw_images(void);void ui_game_next_level(void);void ui_game_wash(GtkWidget *w,gpointer data);void ui_game_cheat(GtkWidget *w,gpointer data);void ui_game_change(struct AlgorithmPoint p1, struct AlgorithmPoint p2);void ui_game_over(gboolean success);void ui_game_pause(void);gboolean progress_timeout(gpointer value);void ui_refresh_top(void);gint ui_get_time_limited(void);void ui_game_hint( GtkWidget *w,gpointer data );void ui_link(struct AlgorithmPoint p1, struct AlgorithmPoint p2);void ui_use_mycards(GtkWidget *w,gpointer data);/*注意!!!!!!! 对于提示,洗牌等操作,一定要判断是在游戏运行中的时候才能给以响应*/static GtkItemFactoryEntry menu_items[] = { { "/游戏(_G)", NULL, NULL, 0, "<Branch>" }, { "/游戏(G)/单人(_S)", NULL, NULL, 0, "<Branch>" }, { "/游戏(G)/单人(S)/Easy", "F1", ui_game_begin, 1, NULL }, { "/游戏(G)/单人(S)/Normal", "F2", ui_game_begin, 2, NULL }, { "/游戏(G)/单人(S)/Hard", "F3", ui_game_begin, 3, NULL }, { "/游戏(G)/双人合作(_T)", NULL, NULL, 0, "<Branch>" }, { "/游戏(G)/双人合作(T)/Easy", NULL, print_hello, 0, NULL }, { "/游戏(G)/双人合作(T)/Normal", NULL, print_hello, 0, NULL }, { "/游戏(G)/双人合作(T)/Hard", NULL, print_hello, 0, NULL }, { "/游戏(G)/网络对战(_N)", NULL, NULL, 0, "<Branch>" }, { "/游戏(G)/网络对战(N)/服务器", NULL, NULL, 0, "<Branch>" }, { "/游戏(G)/网络对战(N)/服务器/Easy", NULL, print_hello, 0, NULL }, { "/游戏(G)/网络对战(N)/服务器/Normal", NULL, print_hello, 0, NULL }, { "/游戏(G)/网络对战(N)/服务器/Hard", NULL, print_hello, 0, NULL }, { "/游戏(G)/网络对战(N)/客户端", NULL, print_hello, 0, NULL }, { "/游戏(G)/sep1", NULL, NULL, 0, "<Separator>" }, { "/游戏(G)/放弃(_G)", "F12", ui_game_giveup,0, NULL }, { "/游戏(G)/sep2", NULL, NULL, 0, "<Separator>" }, { "/游戏(G)/退出(_X)", "<control>Q", gtk_main_quit, 0, NULL }, { "/设置(_S)", NULL, NULL, 0, "<Branch>" }, { "/设置(S)/提示(_H)", "F5", ui_game_hint, 0, NULL }, { "/设置(S)/洗牌(_R)", "F6", ui_game_wash, 0, NULL }, { "/设置(S)/暂停(_P)", "F7", ui_game_pause, 0, NULL }, { "/设置(S)/sep1", NULL, NULL, 0, "<Separator>" }, { "/设置(S)/音乐开关(_M)", NULL, print_hello, 0, "<CheckItem>" }, { "/设置(S)/声音开关(_S)", NULL, print_hello, 0, "<CheckItem>" }, { "/特殊功能(_T)", NULL, NULL, 0, "<Branch>" }, { "/特殊功能(T)/使用自选牌面", NULL, ui_use_mycards,0, "<CheckItem>" }, { "/特殊功能(T)/作弊(_C)", "F8", ui_game_cheat, 0, NULL }, { "/查看分数(_O)", NULL, NULL, 0, "<Branch>" }, { "/查看分数(O)/查看排行榜", "F9", print_hello, 0, NULL }, { "/查看分数(O)/sep1", NULL, NULL, 0, "<Separator>" }, { "/查看分数(O)/查看网络排行", NULL, print_hello, 0, NULL }, { "/关于(_A)", NULL, NULL, 0, "<Branch>" }, { "/关于(A)/游戏规则(_R)", NULL, ui_rule, 0, NULL }, { "/关于(A)/关于作者(_A)", NULL, ui_about, 0, NULL }};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -