예제 #1
0
파일: i_video.c 프로젝트: bigzed/uGFX
//
// I_StartTic
//
void I_StartTic (void)
{
	I_GetEvent();

#if 0
    // Warp the pointer back to the middle of the window
    //  or it will wander off - that is, the game will
    //  loose input focus within X11.
    if (grabMouse)
    {
	if (!--doPointerWarp)
	{
	    XWarpPointer( X_display,
			  None,
			  X_mainWindow,
			  0, 0,
			  0, 0,
			  X_width/2, X_height/2);

	    doPointerWarp = POINTER_WARP_COUNTDOWN;
	}
    }
#endif

    mousemoved = false;
}
예제 #2
0
void I_StartTic (void)
{
  I_GetEvent();

  I_ReadMouse();

  I_PollJoystick();
}
예제 #3
0
static void I_WaitShm(void)
{
// we sync this up anyway
  while (!shmFinished) {
    if(XPending(X_display))
      I_GetEvent();
    else
      usleep(1000);
  }
}
예제 #4
0
//
// I_StartTicInWindow
//
void I_StartTicInWindow(SDL_Window *window)
{
   I_RunDeferredEvents();
   I_GetEvent(window);
   I_UpdateHaptics();

   if(usemouse && ((mouseAccel_type == ACCELTYPE_CHOCO) ||
                   (mouseAccel_type == ACCELTYPE_CUSTOM)))
      I_ReadMouse(window);
}
예제 #5
0
파일: i_video.c 프로젝트: CaptainHIT/prboom
void I_StartTic (void)
{
  SDL_Event Event;

  I_PrepareMouse(0);

  while ( SDL_PollEvent(&Event) )
    I_GetEvent(&Event);

  I_PollJoystick();
}
예제 #6
0
//
// I_StartTic
//
void I_StartTic (void)
{
    if (!initialized)
    {
        return;
    }

    I_GetEvent();

    if (usemouse && !nomouse)
    {
        I_ReadMouse();
    }

    I_UpdateJoystick();
}
예제 #7
0
//
// I_StartTic
//
void I_StartTic (void)
{
    if (!initialized)
    {
        return;
    }

    I_GetEvent();

    if (usemouse && !nomouse && window_focused)
    {
        I_ReadMouse();
    }

    if (joywait < I_GetTime())
    {
        I_UpdateJoystick();
    }
}
예제 #8
0
//
// I_StartTic
//
void I_StartTic (void)
{
	I_GetEvent ();
}
예제 #9
0
//
// I_StartTic
//
void I_StartTic (void)
{
  
  if (!X_display)
    return;

#ifndef POLL_POINTER
  newmouse = lastmouse;
#endif  

  while (XPending(X_display))
    I_GetEvent();
  
  if (grabbed) {
#ifndef POLL_POINTER
    if (newmouse.y != lastmouse.y || newmouse.x != lastmouse.x) {
      event.type = ev_mouse;
      event.data1 = buttons;
#else
    unsigned int mask;
    if (I_QueryPointer(&newmouse, &mask)) {
      // It only reaches here if pointer is on our screen
      event.data1 = ((mask & Button1Mask) ? 1 : 0)
	| ((mask & Button2Mask) ? 2 : 0)
	| ((mask & Button3Mask) ? 4 : 0);
#endif
      event.type  = ev_mouse;
      event.data2 = (newmouse.x - lastmouse.x) << 5; /*mead: make lxdoom move */
      event.data3 = (lastmouse.y - newmouse.y) << 5; /* more like lsdoom */

      D_PostEvent(&event);
    }
  }

  I_VerifyPointerGrabState();
  I_PollJoystick();
}

//
// I_StartFrame
//
void I_StartFrame (void)
{
}

//
// I_XInitInputs
//

static void I_XInitInputs(void)
{
  // Make sure we have focus
  XSetInputFocus(X_display, X_mainWindow, RevertToParent, CurrentTime);

  // check if the user wants to grab the mouse (quite unnice)
#ifdef INTERNETC // F*****g irritating mouse pointer here
	grabMouse=false;
	usemouse=false;
#endif

  grabMouse = M_CheckParm("-nomouse") ? false : 
    usemouse ? true : false;

  I_VerifyPointerGrabState();
  
  I_InitJoystick();
}
예제 #10
0
파일: i_system.cpp 프로젝트: Tox86/gzdoom
static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut)
{
	if (edit == NULL && StdOut == NULL)
		return;

	char buf[256];
	wchar_t wbuf[countof(buf)];
	int bpos = 0;
	CHARRANGE selection;
	CHARRANGE endselection;
	LONG lines_before = 0, lines_after;
	CHARFORMAT format;

	if (edit != NULL)
	{
		// Store the current selection and set it to the end so we can append text.
		SendMessage(edit, EM_EXGETSEL, 0, (LPARAM)&selection);
		endselection.cpMax = endselection.cpMin = GetWindowTextLength(edit);
		SendMessage(edit, EM_EXSETSEL, 0, (LPARAM)&endselection);

		// GetWindowTextLength and EM_EXSETSEL can disagree on where the end of
		// the text is. Find out what EM_EXSETSEL thought it was and use that later.
		SendMessage(edit, EM_EXGETSEL, 0, (LPARAM)&endselection);

		// Remember how many lines there were before we added text.
		lines_before = (LONG)SendMessage(edit, EM_GETLINECOUNT, 0, 0);
	}

	while (*cp != 0)
	{
		// 28 is the escape code for a color change.
		if ((*cp == 28 && bpos != 0) || bpos == 255)
		{
			buf[bpos] = 0;
			if (edit != NULL)
			{
				ToEditControl(edit, buf, wbuf, bpos);
			}
			if (StdOut != NULL)
			{
				DWORD bytes_written;
				WriteFile(StdOut, buf, bpos, &bytes_written, NULL);
			}
			bpos = 0;
		}
		if (*cp != 28)
		{
			buf[bpos++] = *cp++;
		}
		else
		{
			const BYTE *color_id = (const BYTE *)cp + 1;
			EColorRange range = V_ParseFontColor(color_id, CR_UNTRANSLATED, CR_YELLOW);
			cp = (const char *)color_id;

			if (range != CR_UNDEFINED)
			{
				// Change the color of future text added to the control.
				PalEntry color = V_LogColorFromColorRange(range);
				if (StdOut != NULL && FancyStdOut)
				{
					// Unfortunately, we are pretty limited here: There are only
					// eight basic colors, and each comes in a dark and a bright
					// variety.
					float h, s, v, r, g, b;
					WORD attrib = 0;

					RGBtoHSV(color.r / 255.f, color.g / 255.f, color.b / 255.f, &h, &s, &v);
					if (s != 0)
					{ // color
						HSVtoRGB(&r, &g, &b, h, 1, 1);
						if (r == 1)  attrib  = FOREGROUND_RED;
						if (g == 1)  attrib |= FOREGROUND_GREEN;
						if (b == 1)  attrib |= FOREGROUND_BLUE;
						if (v > 0.6) attrib |= FOREGROUND_INTENSITY;
					}
					else
					{ // gray
						     if (v < 0.33) attrib = FOREGROUND_INTENSITY;
						else if (v < 0.90) attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
						else			   attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
					}
					SetConsoleTextAttribute(StdOut, attrib);
				}
				if (edit != NULL)
				{
					// GDI uses BGR colors, but color is RGB, so swap the R and the B.
					swapvalues(color.r, color.b);
					// Change the color.
					format.cbSize = sizeof(format);
					format.dwMask = CFM_COLOR;
					format.dwEffects = 0;
					format.crTextColor = color;
					SendMessage(edit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&format);
				}
			}
		}
	}
	if (bpos != 0)
	{
		buf[bpos] = 0;
		if (edit != NULL)
		{
			ToEditControl(edit, buf, wbuf, bpos);
		}
		if (StdOut != NULL)
		{
			DWORD bytes_written;
			WriteFile(StdOut, buf, bpos, &bytes_written, NULL);
		}
	}

	if (edit != NULL)
	{
		// If the old selection was at the end of the text, keep it at the end and
		// scroll. Don't scroll if the selection is anywhere else.
		if (selection.cpMin == endselection.cpMin && selection.cpMax == endselection.cpMax)
		{
			selection.cpMax = selection.cpMin = GetWindowTextLength (edit);
			lines_after = (LONG)SendMessage(edit, EM_GETLINECOUNT, 0, 0);
			if (lines_after > lines_before)
			{
				SendMessage(edit, EM_LINESCROLL, 0, lines_after - lines_before);
			}
		}
		// Restore the previous selection.
		SendMessage(edit, EM_EXSETSEL, 0, (LPARAM)&selection);
		// Give the edit control a chance to redraw itself.
		I_GetEvent();
	}
	if (StdOut != NULL && FancyStdOut)
	{ // Set text back to gray, in case it was changed.
		SetConsoleTextAttribute(StdOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	}
}
예제 #11
0
void I_OsPolling(void)
{
	I_GetEvent();
}
예제 #12
0
//
// I_StartTic
//
void I_StartTic (void)
{
	I_UpdateFocus();
	I_UpdateInputGrabbing();
	I_GetEvent();
}