-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhearts.cpp
More file actions
45 lines (34 loc) · 1.2 KB
/
Copy pathhearts.cpp
File metadata and controls
45 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "hearts.h"
#include "main.h"
#include "resource.h"
#include "debug.h"
#include <wx/image.h>
#include <wx/xrc/xmlres.h>
#include <wx/filesys.h>
#include <wx/fs_mem.h>
#include <wx/fs_arc.h>
/* Compiled XRC archive embedded as C array by bin2c */
#include "xrc_data.h"
wxIMPLEMENT_APP(HeartsApp);
wxChar suitid[] = wxT("CDHS");
wxChar cardid[] = wxT("JQKA");
bool HeartsApp::OnInit()
{
wxInitAllImageHandlers();
/* Set up filesystem handlers for memory and ZIP archive access */
wxFileSystem::AddHandler(new wxMemoryFSHandler);
wxFileSystem::AddHandler(new wxArchiveFSHandler);
/* Register the compiled XRS archive in the memory filesystem */
wxMemoryFSHandler::AddFile(wxT("hearts.xrs"), xrc_data, sizeof(xrc_data));
/* Initialize XRC and load resources from the in-memory archive */
wxXmlResource::Get()->InitAllHandlers();
wxXmlResource::Get()->Load(wxT("memory:hearts.xrs"));
// Set up config
wxConfigBase::Set(new wxConfig(wxT("MSHearts")));
CMainWindow *frame = new CMainWindow();
frame->Show(true);
// Post welcome dialog
wxCommandEvent evt(wxEVT_MENU, IDM_WELCOME);
frame->GetEventHandler()->QueueEvent(evt.Clone());
return true;
}