Update gtk141
This commit is contained in:
parent
0fe6139b45
commit
556a544ef9
|
@ -30,20 +30,33 @@ set(SOURCE_FILE src/main.cc src/MineSweeper.cc)
|
|||
|
||||
#Compile Resource
|
||||
|
||||
# set(RESOURCE_LIST
|
||||
# text_menu.xml)
|
||||
set(RESOURCE_LIST
|
||||
icons/scalable/status/1mines.svg
|
||||
icons/scalable/status/2mines.svg
|
||||
icons/scalable/status/3mines.svg
|
||||
icons/scalable/status/4mines.svg
|
||||
icons/scalable/status/5mines.svg
|
||||
icons/scalable/status/6mines.svg
|
||||
icons/scalable/status/7mines.svg
|
||||
icons/scalable/status/8mines.svg
|
||||
icons/scalable/status/exploded.svg
|
||||
icons/scalable/status/flag.svg
|
||||
icons/scalable/status/incorrect.svg
|
||||
icons/scalable/status/maybe.svg
|
||||
icons/scalable/status/mine.svg
|
||||
minesweeper.ui)
|
||||
|
||||
# compile_gresources(RESOURCE_FILE
|
||||
# XML_OUT
|
||||
# TYPE EMBED_C
|
||||
# RESOURCES ${RESOURCE_LIST}
|
||||
# PREFIX "/org/gtk/daleclack"
|
||||
# SOURCE_DIR ${PROJECT_SOURCE_DIR}/res)
|
||||
compile_gresources(RESOURCE_FILE
|
||||
XML_OUT
|
||||
TYPE EMBED_C
|
||||
RESOURCES ${RESOURCE_LIST}
|
||||
PREFIX "/org/gtk/daleclack"
|
||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/res)
|
||||
|
||||
# Add a custom target to the makefile. Now make builds our resource file.
|
||||
# It depends on the output RESOURCE_FILE.
|
||||
|
||||
# add_custom_target(resource ALL DEPENDS ${RESOURCE_FILE})
|
||||
add_custom_target(resource ALL DEPENDS ${RESOURCE_FILE})
|
||||
|
||||
#For win32 platform,use rc resource and .ico icon
|
||||
if(WIN32)
|
||||
|
@ -52,12 +65,12 @@ if(WIN32)
|
|||
set_property(SOURCE ../icon.rc APPEND PROPERTY
|
||||
OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/../icon.ico
|
||||
)
|
||||
add_executable(${PROJECT_NAME} WIN32 ${app_WINRC} ${SOURCE_FILE})
|
||||
add_executable(${PROJECT_NAME} WIN32 ${app_WINRC} ${SOURCE_FILE} ${RESOURCE_FILE})
|
||||
add_custom_command( TARGET ${PROJECT_NAME}
|
||||
COMMAND echo * > ${CMAKE_BINARY_DIR}/.gitignore
|
||||
COMMAND echo **/* > ${CMAKE_BINARY_DIR}/.hgignore)
|
||||
else()
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILE})
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILE} ${RESOURCE_FILE})
|
||||
add_custom_command( TARGET ${PROJECT_NAME}
|
||||
COMMAND echo \"*\" > ${CMAKE_BINARY_DIR}/.gitignore
|
||||
COMMAND echo \"**/*\" > ${CMAKE_BINARY_DIR}/.hgignore)
|
||||
|
|
|
@ -60,7 +60,9 @@ void MineSweeper::reset_game()
|
|||
{
|
||||
for (int j = 0; j < 7; j++)
|
||||
{
|
||||
cell[i * 7 + j].set_label("?");
|
||||
//cell[i * 7 + j].set_label("?");
|
||||
cell[i * 7 + j].set_image_from_icon_name("");
|
||||
cell[i * 7 + j].set_always_show_image();
|
||||
cell[i * 7 + j].mines_around = 0;
|
||||
cell[i * 7 + j].has_mine = false;
|
||||
cell[i * 7 + j].cleared = false;
|
||||
|
@ -129,7 +131,7 @@ void MineSweeper::calc_mines()
|
|||
void MineSweeper::show_mines(){
|
||||
for(int i = 0; i < 49; i++){
|
||||
if(cell[i].has_mine){
|
||||
cell[i].set_label("x");
|
||||
cell[i].set_image_from_icon_name("mine");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,12 +166,13 @@ void MineSweeper::cell_clicked(MineCell *cell)
|
|||
// std::cout << mines_clear << std::endl;
|
||||
if (cell->mines_around == 0)
|
||||
{
|
||||
cell->set_label(" ");
|
||||
// cell->set_label(" ");
|
||||
cell->set_image_from_icon_name("");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *label = g_strdup_printf("%d", cell->mines_around);
|
||||
cell->set_label(label);
|
||||
char *label = g_strdup_printf("%dmines", cell->mines_around);
|
||||
cell->set_image_from_icon_name(label);
|
||||
g_free(label);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue