mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
Merge remote-tracking branch 'mathewv/master'
This commit is contained in:
commit
b0b024a01a
4 changed files with 57 additions and 37 deletions
|
|
@ -23,10 +23,12 @@ RB_METHOD(oneshotMsgBox)
|
|||
RB_UNUSED_PARAM;
|
||||
|
||||
int type;
|
||||
const char *body;
|
||||
const char *title = 0;
|
||||
rb_get_args(argc, argv, "iz|z", &type, &body, &title RB_ARG_END);
|
||||
return rb_bool_new(shState->oneshot().msgbox(type, body, title));
|
||||
VALUE body;
|
||||
VALUE title = Qnil;
|
||||
rb_get_args(argc, argv, "iS|S", &type, &body, &title RB_ARG_END);
|
||||
std::string bodyStr = std::string(RSTRING_PTR(body), RSTRING_LEN(body));
|
||||
std::string titleStr = (title == Qnil) ? "" : std::string(RSTRING_PTR(title), RSTRING_LEN(title));
|
||||
return rb_bool_new(shState->oneshot().msgbox(type, bodyStr.c_str(), titleStr.c_str()));
|
||||
}
|
||||
|
||||
RB_METHOD(oneshotResetObscured)
|
||||
|
|
|
|||
2
mkxp.pro
2
mkxp.pro
|
|
@ -58,7 +58,7 @@ win32 {
|
|||
|
||||
PKGCONFIG += sigc++-2.0 pixman-1 zlib \
|
||||
sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile freetype2
|
||||
LIBS += -lphysfs -lsecur32
|
||||
LIBS += -lphysfs -lsecur32 -lwinmm
|
||||
|
||||
release {
|
||||
RC_FILE = assets/resources.rc
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
module EdText
|
||||
def self.blue_understand
|
||||
Oneshot.msgbox Oneshot::Msg::YESNO, tr("Do you understand what this means?")
|
||||
self.msgbox(Oneshot::Msg::YESNO, tr("Do you understand what this means?"))
|
||||
end
|
||||
|
||||
def self.info(text)
|
||||
if(Graphics.fullscreen == true)
|
||||
Graphics.fullscreen = false
|
||||
$console = false
|
||||
end
|
||||
sleep 0.2
|
||||
Graphics.update
|
||||
text.gsub!("\\p", $game_oneshot.player_name)
|
||||
Oneshot.msgbox Oneshot::Msg::INFO, tr(text)
|
||||
Graphics.frame_reset
|
||||
# TODO tr text
|
||||
self.msgbox(Oneshot::Msg::INFO, text)
|
||||
end
|
||||
|
||||
def self.yesno(text)
|
||||
if(Graphics.fullscreen == true)
|
||||
Graphics.fullscreen = false
|
||||
$console = false
|
||||
end
|
||||
sleep 0.2
|
||||
Graphics.update
|
||||
text.gsub!("\\p", $game_oneshot.player_name)
|
||||
result = Oneshot.msgbox Oneshot::Msg::YESNO, tr(text)
|
||||
Graphics.frame_reset
|
||||
return result
|
||||
# TODO tr text
|
||||
self.msgbox(Oneshot::Msg::YESNO, text)
|
||||
end
|
||||
|
||||
def self.err(text)
|
||||
if(Graphics.fullscreen == true)
|
||||
Graphics.fullscreen = false
|
||||
$console = false
|
||||
end
|
||||
sleep 0.2
|
||||
Graphics.update
|
||||
text.gsub!("\\p", $game_oneshot.player_name)
|
||||
result = Oneshot.msgbox Oneshot::Msg::ERR, tr(text)
|
||||
Graphics.frame_reset
|
||||
return result
|
||||
# TODO tr text
|
||||
self.msgbox(Oneshot::Msg::ERR, text)
|
||||
end
|
||||
|
||||
def self.msgbox(type, text)
|
||||
if Graphics.fullscreen
|
||||
Graphics.fullscreen = false
|
||||
$console = false
|
||||
sleep 0.2
|
||||
end
|
||||
result = nil
|
||||
thread = Thread.new do
|
||||
result = Oneshot.msgbox(type, text
|
||||
.gsub(/\s+\n\s+/, " ")
|
||||
.gsub("\\p", $game_oneshot.player_name) +
|
||||
" " * 10)
|
||||
# HACK: Fuck
|
||||
end
|
||||
while thread.alive?
|
||||
Graphics.update
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#define SECURITY_WIN32
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <security.h>
|
||||
#include <shlobj.h>
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
|
|
@ -660,7 +661,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
|||
{
|
||||
if (!title)
|
||||
title = "";
|
||||
#if defined OS_W32
|
||||
#if 0
|
||||
//Get native window handle
|
||||
SDL_SysWMinfo wminfo;
|
||||
SDL_version version;
|
||||
|
|
@ -690,7 +691,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
|||
//Create message box
|
||||
WCHAR *wbody = w32_toWide(body);
|
||||
WCHAR *wtitle = w32_toWide(title);
|
||||
int result = MessageBoxW(hwnd, wbody, wtitle, flags);
|
||||
int result = MessageBoxW(N, wbody, wtitle, flags);
|
||||
delete [] title;
|
||||
delete [] body;
|
||||
|
||||
|
|
@ -722,19 +723,32 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
|||
data.colorScheme = 0;
|
||||
data.title = title;
|
||||
data.message = body;
|
||||
#ifdef OS_W32
|
||||
DWORD sound;
|
||||
#endif
|
||||
|
||||
//Set type
|
||||
switch (type)
|
||||
{
|
||||
case MSG_INFO:
|
||||
case MSG_YESNO:
|
||||
default:
|
||||
data.flags = SDL_MESSAGEBOX_INFORMATION;
|
||||
#ifdef OS_W32
|
||||
sound = SND_ALIAS_SYSTEMQUESTION;
|
||||
#endif
|
||||
break;
|
||||
case MSG_WARN:
|
||||
data.flags = SDL_MESSAGEBOX_WARNING;
|
||||
#ifdef OS_W32
|
||||
sound = SND_ALIAS_SYSTEMEXCLAMATION;
|
||||
#endif
|
||||
break;
|
||||
case MSG_ERR:
|
||||
data.flags = SDL_MESSAGEBOX_WARNING;
|
||||
#ifdef OS_W32
|
||||
sound = SND_ALIAS_SYSTEMASTERISK;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -744,6 +758,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
|||
case MSG_INFO:
|
||||
case MSG_WARN:
|
||||
case MSG_ERR:
|
||||
default:
|
||||
data.numbuttons = 1;
|
||||
data.buttons = buttonsOk;
|
||||
break;
|
||||
|
|
@ -754,6 +769,9 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
|||
}
|
||||
|
||||
//Show messagebox
|
||||
#ifdef OS_W32
|
||||
PlaySoundW((LPCWSTR)sound, NULL, SND_ALIAS_ID | SND_ASYNC);
|
||||
#endif
|
||||
int button;
|
||||
SDL_ShowMessageBox(&data, &button);
|
||||
return button ? true : false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue