Example #1
0
void BadaAppForm::pushEvent(Common::EventType type, const Point &currentPosition) {
	BadaSystem *system = (BadaSystem *)g_system;
	BadaGraphicsManager *graphics = system->getGraphics();
	if (graphics) {
		// graphics could be NULL at startup or when
		// displaying the system error screen
		Common::Event e;
		e.type = type;
		e.mouse.x = currentPosition.x;
		e.mouse.y = currentPosition.y > MIN_TOUCH_Y ? currentPosition.y : 1;

		bool moved = graphics->moveMouse(e.mouse.x, e.mouse.y);

		_eventQueueLock->Acquire();

		if (moved && type != Common::EVENT_MOUSEMOVE) {
			Common::Event moveEvent;
			moveEvent.type = Common::EVENT_MOUSEMOVE;
			moveEvent.mouse = e.mouse;
			_eventQueue.push(moveEvent);
		}

		_eventQueue.push(e);
		_eventQueueLock->Release();
	}
}
Example #2
0
void BadaAppForm::pushEvent(Common::EventType type,
														const Point& currentPosition) {
	BadaSystem* system = (BadaSystem*) g_system;
	BadaGraphicsManager* graphics = system->getGraphics();
	if (graphics) {
		Common::Event e;
		e.type = type;
		e.mouse.x = currentPosition.x;
		e.mouse.y = currentPosition.y;
		
		bool moved = graphics->moveMouse(e.mouse.x, e.mouse.y);

		_eventQueueLock->Acquire();

		if (moved && type != Common::EVENT_MOUSEMOVE) {
			Common::Event moveEvent;
			moveEvent.type = Common::EVENT_MOUSEMOVE;
			moveEvent.mouse = e.mouse;
			_eventQueue.push(moveEvent);
		}

		_eventQueue.push(e);
		_eventQueueLock->Release();
	}
}
Example #3
0
BadaScummVM::~BadaScummVM() {
	logEntered();
	if (g_system) {
		BadaSystem *system = (BadaSystem *)g_system;
		system->destroyBackend();
		delete system;
		g_system = 0;
	}
}
Example #4
0
void BadaEventManager::init() {
	DefaultEventManager::init();

	// theme and vkbd should have now loaded - clear the splash screen
	BadaSystem *system = (BadaSystem *)g_system;
	BadaGraphicsManager *graphics = system->getGraphics();
	if (graphics) {
		graphics->setReady();
		graphics->updateScreen();
	}
}
Example #5
0
result BadaAppForm::OnDraw(void) {
	logEntered();

	if (g_system) {
		BadaSystem* system = (BadaSystem*) g_system;
		BadaGraphicsManager* graphics = system->getGraphics();
		if (graphics && graphics->isReady()) {
			g_system->updateScreen();
		}
	}

	return E_SUCCESS;
}
Example #6
0
//
// display a fatal error notification
//
void systemError(const char *message) {
	AppLog("Fatal system error: %s", message);

	ArrayList *args = new ArrayList();
	args->Construct();
	args->Add(*(new String(message)));
	Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR, args);

	if (g_system) {
		BadaSystem *system = (BadaSystem *)g_system;
		system->exitSystem();
	}
}
Example #7
0
result BadaAppForm::Construct() {
	result r = Form::Construct(Controls::FORM_STYLE_NORMAL);
	if (IsFailed(r)) {
		return r;
	}

	BadaSystem* badaSystem = null;
	_gameThread = null;

	badaSystem = new BadaSystem(this);
	r = badaSystem != null ? E_SUCCESS : E_OUT_OF_MEMORY;
	
	if (!IsFailed(r)) {
		r = badaSystem->Construct();
	}

	if (!IsFailed(r)) {
		_gameThread = new Thread();
		r = _gameThread != null ? E_SUCCESS : E_OUT_OF_MEMORY;
	}

	if (!IsFailed(r)) {
		r = _gameThread->Construct(*this);
	}

	if (IsFailed(r)) {
		if (badaSystem != null) {
			delete badaSystem;
		}
		if (_gameThread != null) {
			delete _gameThread;
			_gameThread = null;
		}
	}	else {
		g_system = badaSystem;
	}

	return r;
}
Example #8
0
int BadaEventManager::shouldQuit() const {
	BadaSystem *system = (BadaSystem *)g_system;
	return DefaultEventManager::shouldQuit() || system->isClosing();
}