From 24d2f4c5e3ed9ba5f43115e5bc96f55f49818e77 Mon Sep 17 00:00:00 2001 From: daleclack Date: Wed, 30 Jun 2021 10:59:10 +0800 Subject: [PATCH] Add guess game --- Gtkmm3/CMakeLists.txt | 7 +- Gtkmm3/README_Gtkmm3.md | 1 + Gtkmm3/res/game1.ui | 44 ++++++++++- Gtkmm3/res/icons/16x16/actions/game.png | Bin 0 -> 1438 bytes .../res/icons/16x16/actions/window-close.png | Bin 0 -> 195 bytes .../icons/16x16/actions/window-minimize.png | Bin 0 -> 104 bytes Gtkmm3/res/icons/48x48/actions/game.png | Bin 0 -> 4117 bytes .../res/icons/48x48/actions/game_running.png | Bin 0 -> 17021 bytes Gtkmm3/res/leftpanel.ui | 29 ++++++- Gtkmm3/res/my_gtkui.resource.xml | 6 ++ Gtkmm3/src/Game.cc | 71 ++++++++++++++++++ Gtkmm3/src/Game.hh | 27 +++++++ Gtkmm3/src/LeftPanel.cc | 37 ++++++++- Gtkmm3/src/LeftPanel.hh | 12 ++- Gtkmm3/src/MyStack.cc | 5 +- 15 files changed, 224 insertions(+), 15 deletions(-) create mode 100644 Gtkmm3/README_Gtkmm3.md create mode 100644 Gtkmm3/res/icons/16x16/actions/game.png create mode 100644 Gtkmm3/res/icons/16x16/actions/window-close.png create mode 100644 Gtkmm3/res/icons/16x16/actions/window-minimize.png create mode 100644 Gtkmm3/res/icons/48x48/actions/game.png create mode 100644 Gtkmm3/res/icons/48x48/actions/game_running.png create mode 100644 Gtkmm3/src/Game.cc create mode 100644 Gtkmm3/src/Game.hh diff --git a/Gtkmm3/CMakeLists.txt b/Gtkmm3/CMakeLists.txt index c5a0ed2..829294e 100644 --- a/Gtkmm3/CMakeLists.txt +++ b/Gtkmm3/CMakeLists.txt @@ -17,16 +17,17 @@ pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0) include_directories (${GTKMM3_INCLUDE_DIRS}) link_directories (${GTKMM3_LIBRARY_DIRS}) +#For win32 platform,use rc resource and .ico icon if(WIN32) SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) set(app_WINRC icon.rc) set_property(SOURCE icon.rc APPEND PROPERTY OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/icon.ico ) - add_executable(My_GtkUI WIN32 src/main.cc src/MyWin.cc src/MyStack.cc - src/TopPanel.cc src/LeftPanel.cc src/winconf.cc src/resources.cc ${app_WINRC}) + add_executable(My_GtkUI WIN32 ${app_WINRC} src/main.cc src/MyWin.cc src/MyStack.cc + src/Game.cc src/TopPanel.cc src/LeftPanel.cc src/winconf.cc src/resources.cc) else() - add_executable(My_GtkUI src/main.cc src/MyWin.cc src/MyStack.cc + add_executable(My_GtkUI src/main.cc src/MyWin.cc src/MyStack.cc src/Game.cc src/TopPanel.cc src/LeftPanel.cc src/winconf.cc src/resources.cc) endif(WIN32) diff --git a/Gtkmm3/README_Gtkmm3.md b/Gtkmm3/README_Gtkmm3.md new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/Gtkmm3/README_Gtkmm3.md @@ -0,0 +1 @@ + diff --git a/Gtkmm3/res/game1.ui b/Gtkmm3/res/game1.ui index 3c5b9cc..ea476cb 100644 --- a/Gtkmm3/res/game1.ui +++ b/Gtkmm3/res/game1.ui @@ -2,10 +2,20 @@ + + True + False + window-close + + + True + False + window-minimize + False 15 - gtk31-guess + center True @@ -33,6 +43,7 @@ True True top + True 1 @@ -48,6 +59,7 @@ True True top + True 3 @@ -63,6 +75,7 @@ True True top + True 1 @@ -78,6 +91,7 @@ True True top + True 3 @@ -215,5 +229,33 @@ + + + True + False + Guess Game + + + True + True + True + image1 + none + + + + + True + True + True + image2 + none + + + 1 + + + + diff --git a/Gtkmm3/res/icons/16x16/actions/game.png b/Gtkmm3/res/icons/16x16/actions/game.png new file mode 100644 index 0000000000000000000000000000000000000000..64864a0b289bfc08bd2fd5d1343017d536135af2 GIT binary patch literal 1438 zcmah|X;70_6un6Z1hSB@CWH_OWFy-bNJvb=76>E+!YYd>vKv$cGzfy$1&W{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K>I zKo{P$vAJc_<}GiuwzY4KaD&LGj?S)a+jn&L^zQ8IkJdxXu7TZyd)^${yYH?22Zmz} z5O?tHLx)G+Idb&fW20loNK88W(Z}b`U$}Vb@|COC zEXk0P`pKu)Z+v$1^INyS`0`F#I%LfK>g#Xre*4|`Kis=Notfnh9@#lFKR$T)=%>d| zo<5tG>j~gBf5G#gfBE&d-~Y&4nD0#oh7Yr#u&B7Cbdj}eu`dgKA3wH#z>=lq%PJ~4 zfk6Ow9@X}r*WM~YD_ol)+g4m)E724!FF^r9kPx{936q2(8Hik?RA~^o2thOm65g#E q`H!KzqPVPd)xQRXM6S+26dDC8RsUm9oIHkp5`f8Ii9M{(-|#oopSdsq literal 0 HcmV?d00001 diff --git a/Gtkmm3/res/icons/16x16/actions/window-close.png b/Gtkmm3/res/icons/16x16/actions/window-close.png new file mode 100644 index 0000000000000000000000000000000000000000..db9f61b481f25aed70552476b32cb217163d1f62 GIT binary patch literal 195 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf9 zf_|q=Iu@wH`ao4&r->_KO3H)^)~s%YsV)i3vz8xw<66M9dzXBXk43_>f5ibCH*@?- oIiT6Oonw*5m+Zc3VS7&TNv5h%l{J31fUaQhboFyt=akR{0Li{Vr~m)} literal 0 HcmV?d00001 diff --git a/Gtkmm3/res/icons/16x16/actions/window-minimize.png b/Gtkmm3/res/icons/16x16/actions/window-minimize.png new file mode 100644 index 0000000000000000000000000000000000000000..c1f38b7532d920eea5e74d8703392033bba9bb6b GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf683a)46*1< xPLN<-oM6D2e`C(I*4}5IbM8I&X>xOKlACC9V;%}7R?{@q*cOZ}Z3U4c>W9+! zsSj!WAf-@51Eo+(u?R)_Acd%^Z4@8k#ALY@SA`0)!%7<`(SAXHF$N#$f zu@QLZ7Y}*=AK`-!+_a+ zmp}Ka6L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True + True + True + image7 + none + top + True + + + False + True + 2 + diff --git a/Gtkmm3/res/my_gtkui.resource.xml b/Gtkmm3/res/my_gtkui.resource.xml index e887d63..068c543 100644 --- a/Gtkmm3/res/my_gtkui.resource.xml +++ b/Gtkmm3/res/my_gtkui.resource.xml @@ -9,6 +9,11 @@ icons/16x16/actions/open-menu.png icons/16x16/actions/system.png icons/16x16/actions/vlc.png + icons/16x16/actions/game.png + icons/16x16/actions/window-close.png + icons/16x16/actions/window-minimize.png + icons/48x48/actions/game.png + icons/48x48/actions/game_running.png icons/48x48/actions/My_GtkUI.png icons/48x48/actions/user_home.png icons/48x48/actions/my_user.png @@ -19,6 +24,7 @@ appmenu.xml main_stack.ui + game1.ui toppanel.ui leftpanel.ui win_size.ui diff --git a/Gtkmm3/src/Game.cc b/Gtkmm3/src/Game.cc new file mode 100644 index 0000000..b5560d8 --- /dev/null +++ b/Gtkmm3/src/Game.cc @@ -0,0 +1,71 @@ +#include "Game.hh" +#include +#include +#include + +Game::Game() +:running(false), +minimized(false), +game_index{0,1,2,3} +{ + //Ininalize Window + game_builder=Gtk::Builder::create_from_resource("/GtkUI/game1.ui"); + game_builder->get_widget("window",game_window); + game_builder->get_widget("win_mini",win_mini); + game_builder->get_widget("win_close",win_close); + game_builder->get_widget("btn_exit",btnexit); + game_builder->get_widget("btn_go",btngo); + game_builder->get_widget("label",game_label); + for(int i=0;i<4;i++){ + char str[6]; + sprintf(str,"btn_%d",i+1); + game_builder->get_widget(str,game_btn[i]); + game_btn[i]->signal_clicked().connect(sigc::bind( + sigc::mem_fun(*this,&Game::gamebtn_clicked),&game_index[i])); + } + //Link Signals + btngo->signal_clicked().connect(sigc::mem_fun(*this,&Game::btngo_clicked)); + win_mini->signal_clicked().connect(sigc::mem_fun(*this,&Game::win_minimized)); + win_close->signal_clicked().connect(sigc::mem_fun(*this,&Game::win_closed)); + btnexit->signal_clicked().connect(sigc::mem_fun(*this,&Game::win_closed)); +} + +void Game::gamebtn_clicked(int *index){ + int flag; + srand((unsigned)time(NULL)); + flag=rand()%4; + game_btn[flag]->set_image_from_icon_name("My_GtkUI",Gtk::ICON_SIZE_DIALOG); + if(*index==flag){ + game_label->set_label("Good Luck!"); + }else{ + game_label->set_label("The Button is here!"); + } +} + +void Game::btngo_clicked(){ + for(int i=0;i<4;i++){ + game_btn[i]->set_image_from_icon_name(""); + } + game_label->set_label("Select a button"); +} + +void Game::hide_game_window(){ + minimized=true; + game_window->hide(); +} + +void Game::win_minimized(){ + minimized=true; + game_window->hide(); +} + +void Game::win_closed(){ + game_window->hide(); + running=false; +} + +void Game::show_game_window(Gtk::Window &parent){ + game_window->set_transient_for(parent); + running=true; + game_window->show_all(); +} diff --git a/Gtkmm3/src/Game.hh b/Gtkmm3/src/Game.hh new file mode 100644 index 0000000..36de0b6 --- /dev/null +++ b/Gtkmm3/src/Game.hh @@ -0,0 +1,27 @@ +#pragma once + +#include + +class Game{ +public: + Game(); + bool running; + bool minimized; + void show_game_window(Gtk::Window &parent); + void hide_game_window(); +private: + //The main builder + Glib::RefPtr game_builder; + //Child Widgets + Gtk::Window *game_window; + Gtk::Button *win_close,*win_mini; + Gtk::Button *game_btn[4],*btngo,*btnexit; + Gtk::Label *game_label; + int game_index[4]; + //Signal Handlers + void gamebtn_clicked(int *index); + void btngo_clicked(); + void win_minimized(); + void win_closed(); + void btnexit_clicked(); +}; \ No newline at end of file diff --git a/Gtkmm3/src/LeftPanel.cc b/Gtkmm3/src/LeftPanel.cc index 22061d7..b90aa92 100644 --- a/Gtkmm3/src/LeftPanel.cc +++ b/Gtkmm3/src/LeftPanel.cc @@ -2,7 +2,7 @@ #include #include -LeftPanel::LeftPanel(Gtk::Window *parent1){ +LeftPanel::LeftPanel(){ //Get Widgets panel_builder=Gtk::Builder::create_from_resource("/GtkUI/leftpanel.ui"); panel_builder->get_widget("popover1",popover); @@ -12,20 +12,29 @@ LeftPanel::LeftPanel(Gtk::Window *parent1){ panel_builder->get_widget("btnvlc",btnvlc); panel_builder->get_widget("btn_note",btnnote); panel_builder->get_widget("btn_vlc",btnvlc_win32); + panel_builder->get_widget("btngame",btngame); + panel_builder->get_widget("panel_game",panelgame); + //Add timer + paneltimer=Glib::signal_timeout().connect(sigc::mem_fun(*this,&LeftPanel::on_timeout),100); + //Link Signals btnaud->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btnaud_clicked)); btngedit->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btngedit_clicked)); btnvlc->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btnvlc_clicked)); btnnote->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btnnote_clicked)); btnvlc_win32->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::winvlc_clicked)); - parent=parent1; + btngame->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btngame_clicked)); + panelgame->signal_clicked().connect(sigc::mem_fun(*this,&LeftPanel::btngame_clicked)); } -void LeftPanel::add_panel(Gtk::Overlay &overlay){ +void LeftPanel::add_panel(Gtk::Window *parent1,Gtk::Overlay &overlay){ + //Pack the panel btnbox->set_halign(Gtk::ALIGN_START); btnbox->set_valign(Gtk::ALIGN_START); - overlay.add_overlay(*btnbox); + overlay.add_overlay(*btnbox); + //Set Parent Window + parent=parent1; } void LeftPanel::btnaud_clicked(){ @@ -57,3 +66,23 @@ void LeftPanel::winvlc_clicked(){ fifth.detach(); popover->popdown(); } + +void LeftPanel::btngame_clicked(){ + if(game1.minimized==true||game1.running==false){ + game1.show_game_window(*parent); + game1.minimized=false; + }else{ + game1.hide_game_window(); + game1.minimized=true; + } +} + +bool LeftPanel::on_timeout(){ + //When Game running and closed,use different icons + if(game1.running){ + panelgame->set_image_from_icon_name("game_running",Gtk::ICON_SIZE_DIALOG); + }else{ + panelgame->set_image_from_icon_name("game",Gtk::ICON_SIZE_DIALOG); + } + return true; +} diff --git a/Gtkmm3/src/LeftPanel.hh b/Gtkmm3/src/LeftPanel.hh index f2dc461..b295dd3 100644 --- a/Gtkmm3/src/LeftPanel.hh +++ b/Gtkmm3/src/LeftPanel.hh @@ -1,24 +1,30 @@ #pragma once #include +#include "Game.hh" class LeftPanel{ public: - LeftPanel(Gtk::Window *parent1); - void add_panel(Gtk::Overlay &overlay); + LeftPanel(); + void add_panel(Gtk::Window *parent,Gtk::Overlay &overlay); private: //LeftPanel Builder Glib::RefPtr panel_builder; //Child widgets Gtk::Box *btnbox; Gtk::Popover *popover; - Gtk::Button *btnaud,*btngedit,*btnvlc,*btnnote,*btnvlc_win32; + Gtk::Button *btnaud,*btngedit,*btnvlc,*btnnote,*btnvlc_win32,*btngame,*panelgame; //Parent Window Gtk::Window *parent; + Game game1; + //Timer for panel monitor + sigc::connection paneltimer; + bool on_timeout(); //Signal Handlers for application start void btnaud_clicked(); void btngedit_clicked(); void btnvlc_clicked(); void btnnote_clicked(); void winvlc_clicked(); + void btngame_clicked(); }; diff --git a/Gtkmm3/src/MyStack.cc b/Gtkmm3/src/MyStack.cc index 1315db7..735f0fa 100644 --- a/Gtkmm3/src/MyStack.cc +++ b/Gtkmm3/src/MyStack.cc @@ -2,8 +2,7 @@ MyStack::MyStack(Gtk::Window *parent1) :toplabel("My GtkUI Desktop"), -labelbox(Gtk::ORIENTATION_HORIZONTAL,5), -panel2(parent) +labelbox(Gtk::ORIENTATION_HORIZONTAL,5) { //Create a builder ref_builder=Gtk::Builder::create_from_resource("/GtkUI/main_stack.ui"); @@ -31,7 +30,7 @@ panel2(parent) main_overlay->add_overlay(panel1); //Add LeftPanel - panel2.add_panel(*main_overlay); + panel2.add_panel(parent1,*main_overlay); //Bind Parent Window parent=parent1;