Пример #1
0
void WIMP_PumpEvents(_THIS)
{
	WIMP_Poll(this, 0);
	if (hasFocus) RISCOS_PollKeyboard();
	if (mouseInWindow) WIMP_PollMouse(this);
	DRenderer_FillBuffers();
	if (SDL_timer_running) RISCOS_CheckTimer();
}
Пример #2
0
void WIMP_PumpEvents(_THIS)
{
	WIMP_Poll(this, 0);
	if (hasFocus) RISCOS_PollKeyboard();
	if (mouseInWindow) WIMP_PollMouse(this);
#if SDL_THREADS_DISABLED
	if (SDL_timer_running) RISCOS_CheckTimer();
#endif
}
Пример #3
0
/** Run background task while in a sleep command */
void RISCOS_BackgroundTasks(void)
{
	if (current_video && current_video->hidden->window_handle)
	{
		WIMP_Poll(current_video, 0);
	}
	/* Keep sound buffers running */
	DRenderer_FillBuffers();
	if (SDL_timer_running) RISCOS_CheckTimer();
}
Пример #4
0
/** Run background task while in a sleep command */
void RISCOS_BackgroundTasks(void)
{
	if (current_video && current_video->hidden->window_handle)
	{
		WIMP_Poll(current_video, 0);
	}
#if SDL_THREADS_DISABLED
	if (SDL_timer_running) RISCOS_CheckTimer();
#endif
}
Пример #5
0
SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current,
				int width, int height, int bpp, Uint32 flags)
{
   Uint32 Rmask = 0;
   Uint32 Gmask = 0;
   Uint32 Bmask = 0;
   char *buffer = NULL;
   int bytesPerPixel = 1;

   /* Don't support double buffering in Wimp mode */
   flags &= ~SDL_DOUBLEBUF;
   flags &= ~SDL_HWSURFACE;

   switch(bpp)
   {
	case 8:
		/* Emulated palette using ColourTrans */
		flags |= SDL_HWPALETTE;
		break;

	case 15:
	case 16:
		Bmask = 0x00007c00;
		Gmask = 0x000003e0;
		Rmask = 0x0000001f;
		bytesPerPixel = 2;
		break;

	case 32:
		Bmask = 0x00ff0000;
		Gmask = 0x0000ff00;
		Rmask = 0x000000ff;
		bytesPerPixel = 4;
		break;

	default:
		SDL_SetError("Pixel depth not supported");
		return NULL;
		break;
   }

/* 	printf("Setting mode %dx%d\n", width, height);*/

	/* Allocate the new pixel format for the screen */
	if ( ! SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0) ) {
		SDL_SetError("Couldn't allocate new pixel format for requested mode");
		return(NULL);
	}

	/* Set up the new mode framebuffer */
	current->w = width;
	this->hidden->height = current->h = height;

	if (bpp == 15) bpp = 16;
	buffer = WIMP_CreateBuffer(width, height, bpp);
	if (buffer == NULL)
	{
		SDL_SetError("Couldn't create sprite for video memory");
		return (NULL);
	}

	this->hidden->bank[0] = buffer + 60; /* Start of sprite data */
	if (bpp == 8) this->hidden->bank[0] += 2048; /* 8bpp sprite have palette first */

	this->hidden->bank[1] = buffer;      /* Start of buffer */

	/* Remember sprite buffer so it can be freed later */
	if (this->hidden->alloc_bank) SDL_free(this->hidden->alloc_bank);
	this->hidden->alloc_bank = buffer;

	current->pitch = width * bytesPerPixel;
	if ((current->pitch & 3))
	{
		/* Sprites are 32bit word aligned */
		current->pitch += (4 - (current->pitch & 3));
	}

  	current->flags = flags | SDL_PREALLOC;

	WIMP_ReadModeInfo(this);
	
    SDL_memset(this->hidden->bank[0], 0, height * current->pitch);

	this->hidden->current_bank = 0;
	current->pixels = this->hidden->bank[0];


	if (WIMP_SetupWindow(this, current) == 0)
	{
		SDL_SetError("Unable to create window to display surface");
		return NULL;
	}

	/* Reset device functions for the wimp */
	WIMP_SetDeviceMode(this);

	/* Needs to set up plot info after window has been created */
	/* Not sure why, but plots don't work if I do it earlier */
	WIMP_SetupPlotInfo(this);

	/* Poll until window is shown */
	{
	   /* We wait until it gets the focus, but give up after 5 seconds
	      in case the focus is prevented in any way.
	   */
	   Uint32 now = SDL_GetTicks();
	   while (!hasFocus && SDL_GetTicks() - now < 5000)
	   {
	      WIMP_Poll(this, 0);
	   }
	}

	/* We're done */
	return(current);
}