Skip to content

Commit

Permalink
Set up images paths
Browse files Browse the repository at this point in the history
  • Loading branch information
henrykorir committed Jun 19, 2024
1 parent 31a2bb5 commit caea463
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ aux_source_directory(. SRC_LIST)

# Copy images to the binary directory during build

file(COPY
${PROJECT_SOURCE_DIR}/logo.png
${PROJECT_SOURCE_DIR}/mine.png
${PROJECT_SOURCE_DIR}/clock.xpm
${PROJECT_SOURCE_DIR}/red-flag.png
DESTINATION ${CMAKE_BINARY_DIR}
)
file(COPY ${PROJECT_SOURCE_DIR}/logo.png DESTINATION {PROJECT_BINARY_DIR})
file(COPY ${PROJECT_SOURCE_DIR}/mine.png DESTINATION {PROJECT_BINARY_DIR})
file(COPY ${PROJECT_SOURCE_DIR}/clock.xpm DESTINATION {PROJECT_BINARY_DIR})
file(COPY ${PROJECT_SOURCE_DIR}/red-flag.png DESTINATION {PROJECT_BINARY_DIR})

#find_package(wxWidgets REQUIRED COMPONENTS net core base)
#if(wxWidgets_USE_FILE) # not defined in CONFIG mode
Expand Down
6 changes: 3 additions & 3 deletions minesweeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ wxEND_EVENT_TABLE()
MainFrame::MainFrame(const wxString &title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxMINIMIZE_BOX)
{
SetIcon(wxIcon("mine.png",wxBITMAP_TYPE_PNG, -1,-1));
SetIcon(wxIcon("./mine.png",wxBITMAP_TYPE_PNG, -1,-1));
m_timer = new wxTimer(this, TIMER_ID);
m_timer->Start(1000);

Expand All @@ -33,7 +33,7 @@ MainFrame::MainFrame(const wxString &title)
clockSizer->Add(staticBitmap, 0, wxCENTER);
clockSizer->Add(clockText, 0, wxCENTER);

wxBitmap flag("red-flag.png", wxBITMAP_TYPE_PNG);
wxBitmap flag("./red-flag.png", wxBITMAP_TYPE_PNG);
wxBitmap::Rescale(flag, wxSize(24,24));
wxStaticBitmap* flagBitmap = new wxStaticBitmap(this, wxID_STATIC,flag);
flagText = new wxStaticText(this,wxID_ANY,wxT("0"), wxDefaultPosition,wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
Expand Down Expand Up @@ -194,7 +194,7 @@ void MainFrame::Reveal()
int index = minesLoci[i];
wxAnyButton * button = matrix[index / width][index % width]->GetButton();
button->SetForegroundColour(wxColor(255,0,0));
wxBitmap mine("logo.png",wxBITMAP_TYPE_PNG);
wxBitmap mine("./logo.png",wxBITMAP_TYPE_PNG);
button->SetBitmap(mine, wxLEFT);
}

Expand Down

0 comments on commit caea463

Please sign in to comment.