Beispiel #1
0
//--------------------------------------------------------------
void ofChanelApp::setup()
{
	ofBackground(0);
	ofSetVerticalSync(true);

	//Leap Motion
	_LeapController.addListener(_LeapListener);

	//Theatre
	_Theatre.setup();
	ofAddListener(_Theatre._TheatreEvent, this, &ofChanelApp::onChanelTheatreEvent);
	
	//Cursor
	setupCursor();

	//Timer
	_fMainTimer = ofGetElapsedTimef();
	_IdleTimer = -1;
	
	//BGM
	setupBGM();
	
	_useLeap = true;
	_showMouse = true;

#ifndef _DEBUG
	ofToggleFullscreen();
	ofHideCursor();
	_showMouse = false;
#endif//_DEBUG

	
}
void VirtualKeyboardGUI::run() {
	if (_firstRun) {
		_firstRun = false;
		moveToDefaultPosition();
	}

	if (!g_gui.isActive()) {
		_system->showOverlay();
		_system->clearOverlay();
	}
	_overlayBackup.create(_screenW, _screenH, sizeof(OverlayColor));
	_system->grabOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w);

	setupCursor();

	forceRedraw();
	_displaying = true;
	mainLoop();

	removeCursor();

	_system->copyRectToOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h);
	if (!g_gui.isActive()) _system->hideOverlay();

	_overlayBackup.free();
	_dispSurface.free();
}
TextDomArea::TextDomArea(const TextDomArea &source) :
	Inherited(source),
	_CurrentCaretBlinkElps(0.0),
	_Font(source._Font),
    _DrawCaret(false),
    _TheUndoManager(source._TheUndoManager),
    _TheCommandManager(source._TheCommandManager)
{
	setupCursor();
}
void EditableTextComponent::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if((whichField & EnabledFieldMask) || (whichField & EditableFieldMask))
    {
        setupCursor();
    }
}
TextDomArea::TextDomArea(void) :
    Inherited(),
	_CurrentCaretBlinkElps(0.0),
	_Font(NULL),
    _DrawCaret(false)
{
	createDefaultFont();
	createDefaultLayer();
	setupCursor();
	_TheUndoManager = UndoManager::create();
	_TheCommandManager = CommandManager::create(_TheUndoManager);
}
EditableTextComponent::EditableTextComponent(const EditableTextComponent &source) :
    Inherited(source)
{
    setupCursor();
}
EditableTextComponent::EditableTextComponent(void) :
    Inherited()
{
    setupCursor();
}
Beispiel #8
0
Common::Error MutationOfJBEngine::run() {
	initGraphics(320, 200);

	_console = new Console(this);
	_screen = new Graphics::Screen();
	_game = new Game(this);

	setupCursor();

	_game->changeScene(13, false); // Initial scene.

	while (!shouldQuit()) {
		Common::Event event;
		while (_eventMan->pollEvent(event)) {
			switch (event.type) {
			case Common::EVENT_KEYDOWN: {
				if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) ||
						event.kbd.ascii == '~' || event.kbd.ascii == '#') {
					_console->attach();
				}
				if (event.kbd.keycode == Common::KEYCODE_F5 && event.kbd.hasFlags(0)) {
					openMainMenuDialog();
				}
				break;
			}
			case Common::EVENT_KEYUP: {
				switch (event.kbd.ascii) {
				case 'g':
					_game->setCurrentAction(ActionInfo::Walk);
					break;
				case 'r':
					_game->setCurrentAction(ActionInfo::Talk);
					break;
				case 's':
					_game->setCurrentAction(ActionInfo::Look);
					break;
				case 'b':
					_game->setCurrentAction(ActionInfo::Use);
					break;
				case 'n':
					_game->setCurrentAction(ActionInfo::PickUp);
					break;
				}
				break;
			}
			default:
				break;
			}

			if (!_game->isCurrentSceneMap()) {
				handleNormalScene(event);
			} else {
				handleMapScene(event);
			}
		}

		_console->onFrame();
		_game->update();
		_system->delayMillis(10);
		_screen->update();
	}

	return Common::kNoError;
}