void init(Object boardplat, String clsname) { _clsname = clsname; Class[] ctorarg = new Class[1]; try { ctorarg[0] = Object.class; _inst = (WBStateI) Class.forName(_clsname).getConstructor(ctorarg).newInstance(boardplat); } catch (Exception e) { WDev.log(1, e.getMessage()); WDev.wassert(false); } }
void setState(Object trigger_owner, String clsname) { for (_State s : _State.values()) if (clsname.equals(s.clsname())) { setState(trigger_owner, s.getInstance()); return; } WDev.wassert(false); }
void initScreen(int width, int height) { if (_rar.isEmpty()) { WDev.wassert(null == _pixels); // This should not be called more than once!!! _allocateScreenCanvas(width, height); initUiState(); } else if (null == _pixels) { // usually from restore.... _allocateScreenCanvas(_rar.width(), _rar.height()); moveActiveRegionTo(this, _ar.l, _ar.t); } }
void add(int x0, int y0, int x1, int y1, byte thick, int color) { // TODO : change 8888 -> 565 WDev.wassert(thick < WConstants.LIMIT_THICK); _nativeAdd(_native_sheet, x0, y0, x1, y1, thick, rgb32to16(color)); }
int init(int divW, int divH, int colN, int rowN) { WDev.wassert(divW * colN < _MAX_V && divH * rowN < _MAX_V); _boundary.set(0, 0, divW * colN, divH * rowN); return _nativeInitWsheet(_native_sheet, divW, divH, colN, rowN); }
private void _allocateScreenCanvas(int width, int height) { _sw = width; _sh = height; WDev.wassert(null == _pixels); _pixels = new int[_sw * _sh]; }