mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-04 14:05:32 +02:00
Catch exceptions in Window.update (Fixes #43)
This commit is contained in:
parent
07548ff9d6
commit
0af061edf1
1 changed files with 60 additions and 60 deletions
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
** window-binding.cpp
|
** window-binding.cpp
|
||||||
**
|
**
|
||||||
** This file is part of mkxp.
|
** This file is part of mkxp.
|
||||||
**
|
**
|
||||||
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
|
||||||
**
|
**
|
||||||
** mkxp is free software: you can redistribute it and/or modify
|
** mkxp is free software: you can redistribute it and/or modify
|
||||||
** it under the terms of the GNU General Public License as published by
|
** it under the terms of the GNU General Public License as published by
|
||||||
** the Free Software Foundation, either version 2 of the License, or
|
** the Free Software Foundation, either version 2 of the License, or
|
||||||
** (at your option) any later version.
|
** (at your option) any later version.
|
||||||
**
|
**
|
||||||
** mkxp is distributed in the hope that it will be useful,
|
** mkxp is distributed in the hope that it will be useful,
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
** GNU General Public License for more details.
|
** GNU General Public License for more details.
|
||||||
**
|
**
|
||||||
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
||||||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "disposable-binding.h"
|
#include "disposable-binding.h"
|
||||||
|
@ -31,25 +31,25 @@ DEF_ALLOCFUNC(Window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RB_METHOD(windowInitialize) {
|
RB_METHOD(windowInitialize) {
|
||||||
Window *w = viewportElementInitialize<Window>(argc, argv, self);
|
Window *w = viewportElementInitialize<Window>(argc, argv, self);
|
||||||
|
|
||||||
setPrivateData(self, w);
|
setPrivateData(self, w);
|
||||||
|
|
||||||
w->initDynAttribs();
|
w->initDynAttribs();
|
||||||
|
|
||||||
wrapProperty(self, &w->getCursorRect(), "cursor_rect", RectType);
|
wrapProperty(self, &w->getCursorRect(), "cursor_rect", RectType);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
RB_METHOD(windowUpdate) {
|
RB_METHOD(windowUpdate) {
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
|
||||||
Window *w = getPrivateData<Window>(self);
|
Window *w = getPrivateData<Window>(self);
|
||||||
|
|
||||||
w->update();
|
GUARD_EXC(w->update(););
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_PROP_OBJ_REF(Window, Bitmap, Windowskin, "windowskin")
|
DEF_PROP_OBJ_REF(Window, Bitmap, Windowskin, "windowskin")
|
||||||
|
@ -71,32 +71,32 @@ DEF_PROP_I(Window, BackOpacity)
|
||||||
DEF_PROP_I(Window, ContentsOpacity)
|
DEF_PROP_I(Window, ContentsOpacity)
|
||||||
|
|
||||||
void windowBindingInit() {
|
void windowBindingInit() {
|
||||||
VALUE klass = rb_define_class("Window", rb_cObject);
|
VALUE klass = rb_define_class("Window", rb_cObject);
|
||||||
#if RAPI_FULL > 187
|
#if RAPI_FULL > 187
|
||||||
rb_define_alloc_func(klass, classAllocate<&WindowType>);
|
rb_define_alloc_func(klass, classAllocate<&WindowType>);
|
||||||
#else
|
#else
|
||||||
rb_define_alloc_func(klass, WindowAllocate);
|
rb_define_alloc_func(klass, WindowAllocate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
disposableBindingInit<Window>(klass);
|
disposableBindingInit<Window>(klass);
|
||||||
viewportElementBindingInit<Window>(klass);
|
viewportElementBindingInit<Window>(klass);
|
||||||
|
|
||||||
_rb_define_method(klass, "initialize", windowInitialize);
|
_rb_define_method(klass, "initialize", windowInitialize);
|
||||||
_rb_define_method(klass, "update", windowUpdate);
|
_rb_define_method(klass, "update", windowUpdate);
|
||||||
|
|
||||||
INIT_PROP_BIND(Window, Windowskin, "windowskin");
|
INIT_PROP_BIND(Window, Windowskin, "windowskin");
|
||||||
INIT_PROP_BIND(Window, Contents, "contents");
|
INIT_PROP_BIND(Window, Contents, "contents");
|
||||||
INIT_PROP_BIND(Window, Stretch, "stretch");
|
INIT_PROP_BIND(Window, Stretch, "stretch");
|
||||||
INIT_PROP_BIND(Window, CursorRect, "cursor_rect");
|
INIT_PROP_BIND(Window, CursorRect, "cursor_rect");
|
||||||
INIT_PROP_BIND(Window, Active, "active");
|
INIT_PROP_BIND(Window, Active, "active");
|
||||||
INIT_PROP_BIND(Window, Pause, "pause");
|
INIT_PROP_BIND(Window, Pause, "pause");
|
||||||
INIT_PROP_BIND(Window, X, "x");
|
INIT_PROP_BIND(Window, X, "x");
|
||||||
INIT_PROP_BIND(Window, Y, "y");
|
INIT_PROP_BIND(Window, Y, "y");
|
||||||
INIT_PROP_BIND(Window, Width, "width");
|
INIT_PROP_BIND(Window, Width, "width");
|
||||||
INIT_PROP_BIND(Window, Height, "height");
|
INIT_PROP_BIND(Window, Height, "height");
|
||||||
INIT_PROP_BIND(Window, OX, "ox");
|
INIT_PROP_BIND(Window, OX, "ox");
|
||||||
INIT_PROP_BIND(Window, OY, "oy");
|
INIT_PROP_BIND(Window, OY, "oy");
|
||||||
INIT_PROP_BIND(Window, Opacity, "opacity");
|
INIT_PROP_BIND(Window, Opacity, "opacity");
|
||||||
INIT_PROP_BIND(Window, BackOpacity, "back_opacity");
|
INIT_PROP_BIND(Window, BackOpacity, "back_opacity");
|
||||||
INIT_PROP_BIND(Window, ContentsOpacity, "contents_opacity");
|
INIT_PROP_BIND(Window, ContentsOpacity, "contents_opacity");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue