Commit eafebf2e authored by mercury233's avatar mercury233
parents 780a4122 1bf74487
......@@ -633,6 +633,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::EMIE_MOUSE_MOVED: {
int x = event.MouseInput.X;
int y = event.MouseInput.Y;
position2d<s32> mouse_pos = position2d<s32>(x, y);
irr::gui::IGUIElement* root = mainGame->env->getRootGUIElement();
if(root->getElementFromPoint(mouse_pos) != root)
break;
int pre_code = hovered_code;
if(x >= 314 && x <= 794 && y >= 164 && y <= 435) {
int lx = 10, px, py = (y - 164) / 68;
......
......@@ -451,6 +451,18 @@ bool Game::Initialize() {
btnClearDeck = env->addButton(rect<s32>(115, 99, 165, 120), wDeckEdit, BUTTON_CLEAR_DECK, dataManager.GetSysString(1304));
btnSideOK = env->addButton(rect<s32>(510, 40, 820, 80), 0, BUTTON_SIDE_OK, dataManager.GetSysString(1334));
btnSideOK->setVisible(false);
//
scrFilter = env->addScrollBar(false, recti(999, 161, 1019, 629), 0, SCROLL_FILTER);
scrFilter->setLargeStep(10);
scrFilter->setSmallStep(1);
scrFilter->setVisible(false);
//sort type
wSort = env->addStaticText(L"", rect<s32>(930, 132, 1020, 156), true, false, 0, -1, true);
cbSortType = env->addComboBox(rect<s32>(10, 2, 85, 22), wSort, COMBOBOX_SORTTYPE);
cbSortType->setMaxSelectionRows(10);
for(int i = 1370; i <= 1373; i++)
cbSortType->addItem(dataManager.GetSysString(i));
wSort->setVisible(false);
//filters
wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true);
wFilter->setVisible(false);
......@@ -513,17 +525,6 @@ bool Game::Initialize() {
btnCategoryOK = env->addButton(rect<s32>(135, 175, 235, 200), wCategories, BUTTON_CATEGORY_OK, dataManager.GetSysString(1211));
for(int i = 0; i < 32; ++i)
chkCategory[i] = env->addCheckBox(false, recti(10 + (i % 4) * 90, 10 + (i / 4) * 20, 100 + (i % 4) * 90, 30 + (i / 4) * 20), wCategories, -1, dataManager.GetSysString(1100 + i));
scrFilter = env->addScrollBar(false, recti(999, 161, 1019, 629), 0, SCROLL_FILTER);
scrFilter->setLargeStep(10);
scrFilter->setSmallStep(1);
scrFilter->setVisible(false);
//sort type
wSort = env->addStaticText(L"", rect<s32>(930, 132, 1020, 156), true, false, 0, -1, true);
cbSortType = env->addComboBox(rect<s32>(10, 2, 85, 22), wSort, COMBOBOX_SORTTYPE);
cbSortType->setMaxSelectionRows(10);
for(int i = 1370; i <= 1373; i++)
cbSortType->addItem(dataManager.GetSysString(i));
wSort->setVisible(false);
//replay window
wReplay = env->addWindow(rect<s32>(220, 100, 800, 520), false, dataManager.GetSysString(1202));
wReplay->getCloseButton()->setVisible(false);
......@@ -752,7 +753,9 @@ void Game::RefreshExpansionDB() {
if(fh != INVALID_HANDLE_VALUE) {
do {
if(!(fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
sprintf(fpath, "./expansions/%ls", fdataw.cFileName);
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
dataManager.LoadDB(fpath);
}
} while(FindNextFileW(fh, &fdataw));
......
......@@ -55,7 +55,15 @@ int main(int argc, char* argv[]) {
for(int i = 1; i < argc; ++i) {
if(argv[i][0] == '-' && argv[i][1] == 'e') {
#ifdef _WIN32
wchar_t fname[260];
MultiByteToWideChar(CP_ACP, 0, &argv[i][2], -1, fname, 260);
char fname2[260];
BufferIO::EncodeUTF8(fname, fname2);
ygo::dataManager.LoadDB(fname2);
#else
ygo::dataManager.LoadDB(&argv[i][2]);
#endif
} else if(!strcmp(argv[i], "-j") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-r") || !strcmp(argv[i], "-s")) {
exit_on_return = true;
irr::SEvent event;
......
......@@ -31,7 +31,11 @@ int SingleMode::SinglePlayThread(void* param) {
wchar_t fname[256];
myswprintf(fname, L"./single/%ls", name);
char fname2[256];
#ifdef _WIN32
size_t slen = WideCharToMultiByte(CP_ACP, 0, fname, -1, fname2, 256, NULL, NULL);
#else
size_t slen = BufferIO::EncodeUTF8(fname, fname2);
#endif
mtrandom rnd;
time_t seed = time(0);
rnd.reset(seed);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment