void SystemStub_SDL::switchGfxMode(bool fullscreen, uint8 scaler) {
	SDL_FreeSurface(_screenSurface);
	_fullscreen = fullscreen;
	_currentScaler = scaler;
	prepareGfxMode();
	forceGfxRedraw();
}
void SystemStub_SDL::prepareGfxMode() {
	int w = _screenW * _scalers[_currentScaler].factor;
	int h = _screenH * _scalers[_currentScaler].factor;
	_screenSurface = SDL_SetVideoMode(w, h, 16, _fullscreen ? (SDL_FULLSCREEN | SDL_HWSURFACE) : SDL_HWSURFACE);
	if (!_screenSurface) {
		error("SystemStub_SDL::prepareGfxMode() Unable to allocate _screen buffer");
	}
	forceGfxRedraw();
}
void SystemStub_SDL::flipGfx() {
	uint16 scanline[256];
	assert(_screenW <= 256);
	uint16 *p = (uint16 *)_offscreen + _screenW + 1;
	for (int y = 0; y < _screenH; ++y) {
		p += _screenW;
		for (int x = 0; x < _screenW; ++x) {
			scanline[x] = *--p;
		}
		memcpy(p, scanline, _screenW * sizeof(uint16));
		p += _screenW;
	}
	forceGfxRedraw();
}
void SystemStub_SDL::prepareGfxMode() {
	int w = _screenW * _scalers[_scaler].factor;
	int h = _screenH * _scalers[_scaler].factor;
	_screen = SDL_SetVideoMode(w, h, 16, _fullscreen ? (SDL_FULLSCREEN | SDL_HWSURFACE) : SDL_HWSURFACE);
	if (!_screen) {
		error("SystemStub_SDL::prepareGfxMode() Unable to allocate _screen buffer");
	}
	const SDL_PixelFormat *pf = _screen->format;
	_sclscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 16, pf->Rmask, pf->Gmask, pf->Bmask, pf->Amask);
	if (!_sclscreen) {
		error("SystemStub_SDL::prepareGfxMode() Unable to allocate _sclscreen buffer");
	}
	forceGfxRedraw();
}
Exemplo n.º 5
0
void SystemStub_SDL::prepareGfxMode() {
	
	int w = _screenW * _scalers[_scaler].factor;
	int h = _screenH * _scalers[_scaler].factor;
	
	//_screen = SDL_SetVideoMode(w, h, 16, _fullscreen ? (SDL_FULLSCREEN | SDL_HWSURFACE) : SDL_HWSURFACE);
	debug(DBG_INFO, "Requesting video %dx%d", w, h);
	_screen = SDL_SetVideoMode(w, h, 16, SDL_SWSURFACE);
	if (!_screen) {
		error("SystemStub_SDL::prepareGfxMode() Unable to allocate _screen buffer");
	}
	const SDL_PixelFormat *pf = _screen->format;
	// Android TODO: get rid of filthy scaler and draw directly to Android surface
	_sclscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 16, pf->Rmask, pf->Gmask, pf->Bmask, pf->Amask);
	//_sclscreen = _screen; // Android hack
	if (!_sclscreen) {
		error("SystemStub_SDL::prepareGfxMode() Unable to allocate _sclscreen buffer");
	}
	forceGfxRedraw();
}
Exemplo n.º 6
0
void MoSyncStub::prepareGfxMode() {
	forceGfxRedraw();
}
Exemplo n.º 7
0
void MoSyncStub::processEvents() {
	MAEvent ev;
	while (maGetEvent(&ev)) {
		switch (ev.type) {
		case EVENT_TYPE_CLOSE:
			_pi.quit = true;
			maExit(0);
			break;
		case EVENT_TYPE_KEY_RELEASED:
			if(ev.key == MAK_UP || ev.key == MAK_DOWN || ev.key == MAK_LEFT || ev.key == MAK_RIGHT) {
				ev.key = FrameBuffer_getArrowKeyForOrientation(ev.key);
			}
			switch (ev.key) {
			case MAK_LEFT:
				_pi.dirMask &= ~PlayerInput::DIR_LEFT;
				break;
			case MAK_RIGHT:
				_pi.dirMask &= ~PlayerInput::DIR_RIGHT;
				break;
			case MAK_UP:
				_pi.dirMask &= ~PlayerInput::DIR_UP;
				break;
			case MAK_DOWN:
				_pi.dirMask &= ~PlayerInput::DIR_DOWN;
				break;
			case MAK_SOFTLEFT:
				_pi.space = false;
				break;
			case MAK_SOFTRIGHT:
				_pi.shift = false;
				break;
			case MAK_FIRE:
				_pi.enter = false;
				break;
			case MAK_POUND:
				_pi.escape = false;
				break;
			case MAK_4:
				orientation++;
				FrameBuffer_setOrientation(orientation);
				forceGfxRedraw();
				updateScreen(0);
				break;
			default:
				break;
			}
			break;
		case EVENT_TYPE_KEY_PRESSED:
			if(ev.key == MAK_UP || ev.key == MAK_DOWN || ev.key == MAK_LEFT || ev.key == MAK_RIGHT) {
				ev.key = FrameBuffer_getArrowKeyForOrientation(ev.key);
			}

			_pi.lastChar = ev.key;
			switch (ev.key) {
			case MAK_1:
					_pi.save = true;
				break;
			case MAK_3:
					_pi.load = true;
				break;
			case MAK_LEFT:
				_pi.dirMask |= PlayerInput::DIR_LEFT;
				break;
			case MAK_RIGHT:
				_pi.dirMask |= PlayerInput::DIR_RIGHT;
				break;
			case MAK_UP:
				_pi.dirMask |= PlayerInput::DIR_UP;
				break;
			case MAK_DOWN:
				_pi.dirMask |= PlayerInput::DIR_DOWN;
				break;

			case MAK_STAR:
				_pi.backspace = true;
				break;

			case MAK_SOFTLEFT:
				_pi.space = true;
				break;
			case MAK_SOFTRIGHT:
				_pi.shift = true;
				break;
			case MAK_FIRE:
				_pi.enter = true;
				break;
			case MAK_POUND:
				_pi.escape = true;
				break;
			default:
				break;
			}
			break;
		case EVENT_TYPE_AUDIOBUFFER_FILL:
		{
			uint8 *b = buffer;
			if(audioCallback) {
				audioCallback(audioParam, buffer, BUFFERSIZE);
			}
			maAudioBufferReady();
		}
			break;
		default:
			break;
		}
	}
}