-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
224 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include "Game.hh" | ||
#include <ctime> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
|
||
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <gtkmm.h> | ||
|
||
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<Gtk::Builder> 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(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
#pragma once | ||
|
||
#include <gtkmm.h> | ||
#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<Gtk::Builder> 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(); | ||
}; |
Oops, something went wrong.