Example #1
0
//---------------------------------------------------------------------------
// fetch the character attributes for the first character of the range
//
void __fastcall TTaeTextAttributes::GetAttributes(TCharFormat& Format)
{
  InitFormat(Format);
  if (!FRichEdit->HandleAllocated()) return;
  SendMessage(FRichEdit->Handle, EM_GETCHARFORMAT,
    (WPARAM) FType == atSelected, (LPARAM) &Format);
}
Example #2
0
//---------------------------------------------------------------------------
// set the character set of the font
//
void __fastcall TTaeTextAttributes::SetCharset(TFontCharset Value)
{
  TCharFormat Format;

  InitFormat(Format);
  Format.dwMask = CFM_CHARSET;
  Format.bCharSet = Value;
  SetAttributes(Format);
}
Example #3
0
//---------------------------------------------------------------------------
// set the text size in points
//
void __fastcall TTaeTextAttributes::SetSize(int Value)
{
  TCharFormat Format;

  InitFormat(Format);
  Format.dwMask = CFM_SIZE;
  Format.yHeight = Value * 20;
  SetAttributes(Format);
}
Example #4
0
//---------------------------------------------------------------------------
// set or clear the protected state of the text
//
void __fastcall TTaeTextAttributes::SetProtected(bool Value)
{
  TCharFormat Format;

  InitFormat(Format);
  Format.dwMask = CFM_PROTECTED;
  if (Value) Format.dwEffects = CFE_PROTECTED;
  SetAttributes(Format);
}
Example #5
0
//---------------------------------------------------------------------------
// set the text font by font name
//
void __fastcall TTaeTextAttributes::SetName(TFontName Value)
{
  TCharFormat Format;

  InitFormat(Format);
  Format.dwMask = CFM_FACE;

  ::strncpy(Format.szFaceName, Value.c_str(), LF_FACESIZE);
  SetAttributes(Format);
}
Example #6
0
//---------------------------------------------------------------------------
// set the text color to the value (or auto-color if the value is the
// same as normal text)
//
void __fastcall TTaeTextAttributes::SetColor(TColor Value)
{
  TCharFormat Format;

  InitFormat(Format);
  Format.dwMask = CFM_COLOR;
  if (Value == clWindowText) Format.dwEffects = CFE_AUTOCOLOR;
  else Format.crTextColor = ColorToRGB(Value);
  SetAttributes(Format);
}
void AudioCaptureThread::InitAudio()
{
    InitFormat();

    m_pWaveHdrs = (PWAVEHDR*) malloc(sizeof(PWAVEHDR*) * SOUND_RECORD_BUFFER_COUNT);
    for (int i=0; i < SOUND_RECORD_BUFFER_COUNT; i++)
        m_pWaveHdrs[i] = (WAVEHDR*)malloc(sizeof(WAVEHDR));

    m_pBuffers = (BYTE**) malloc(sizeof(BYTE*) * SOUND_RECORD_BUFFER_COUNT);
}
Example #8
0
//---------------------------------------------------------------------------
// set the style attributes of the text
//
// warning:  I spent days trying to isolate a problem that turned out to be
// in this method.  the problem was with the original signature,
// SetStyle(TFontStyles Value).  Sets (TFontStyles is of type Set)
// do not always correctly pass unless passed by reference?
//
// note that this is an inconsistent problem.  elsewhere in this project,
// passing sets by value works just fine.  it may have something to do with
// the way TFont works (TFont manages the font resource in a rather odd way).
//
void __fastcall TTaeTextAttributes::SetStyle(TFontStyles& Value)
{
  TCharFormat Format;

  InitFormat(Format);
  Format.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_STRIKEOUT;
  if (Value.Contains(fsBold)) Format.dwEffects |= CFE_BOLD;
  if (Value.Contains(fsItalic)) Format.dwEffects |= CFE_ITALIC;
  if (Value.Contains(fsUnderline)) Format.dwEffects |= CFE_UNDERLINE;
  if (Value.Contains(fsStrikeOut)) Format.dwEffects |= CFE_STRIKEOUT;
  SetAttributes(Format);
}
Example #9
0
bool DXVA2Decoder::Init(MythRenderD3D9* render)
{
    bool ok = true;
    CREATE_CHECK(m_width > 0,  "Invalid width.")
    CREATE_CHECK(m_height > 0, "Invalid height.")
    CREATE_CHECK(CreateVideoService(render), "Failed to create video service.")
    CREATE_CHECK(GetInputOutput(), "Failed to find input/output combination.")
    InitFormat();
    CREATE_CHECK(GetDecoderConfig(), "Failed to find a raw input bitstream.")
    CREATE_CHECK(CreateSurfaces(), "Failed to create surfaces.")
    CREATE_CHECK(CreateDecoder(), "Failed to create decoder.")
    return ok;
}
Example #10
0
tbool CDeviceWaveIO::Start()
{
	if ((mpCallback) && (mppfOutputs) && (mppfInputs) && (!mbStarted)) {
		mbBlocked_volatile = false;

		WAVEFORMATEX format;
		InitFormat(format, (tint32)mfSampleRate);
		// Open driver - will invoke waveOutProc_static with uMsg == WOM_OPEN
		MMRESULT mmres = MMSYSERR_ERROR; // Default => unspecified error
		if (mbOutput) {
			mmres = waveOutOpen(
				&mhandle_out,
				muiDevIndex,
				&format,
				(DWORD)&waveOutProc_static,
				(DWORD)this,
				CALLBACK_FUNCTION
			);
		}
		if (mbInput) {
			mmres = waveInOpen(
				&mhandle_in,
				muiDevIndex,
				&format,
				(DWORD)&waveInProc_static,
				(DWORD)this,
				CALLBACK_FUNCTION
			);
		}
		/*
MMSYSERR_ALLOCATED Specified resource is already allocated. 
MMSYSERR_BADDEVICEID Specified device identifier is out of range. 
MMSYSERR_NODRIVER No device driver is present. 
MMSYSERR_NOMEM Unable to allocate or lock memory. 
WAVERR_BADFORMAT 
		*/
		if (mmres == MMSYSERR_NOERROR) {
			mmres = StartBuffers();
		}
		mbStarted = (mmres == MMSYSERR_NOERROR);
		if (!mbStarted)
			mbBlocked_volatile = true;
	}

	return mbStarted;
} // Start
void CEngine::Main()
{
	InitFormat();

    QtInterface window;
	m_pWindow = &window;
    window.resize(1024, 578);
    window.show();
	window.raise(); // Bring to front

	Script()->PostInit();

    while ( !window.shouldClose() )
    {
        m_pApp->processEvents();
		FrameAdvance();

        if ( Input()->KeyPressed( KEY_ESC ) )
        {
            break;
        }
		else if (Input()->KeyHeld( KEY_ALT ) && ( Input()->KeyReleased( KEY_ENTER ) || Input()->KeyReleased( KEY_RETURN ) ) )
		{
			if ( window.isFullScreen() ) 
			{
				window.showNormal();
			}
			else
			{
				window.showFullScreen();
			}
		}
        
		window.Render();

        for (int i = 0; i < m_vecGameSystems.size(); i++)
        {
            m_vecGameSystems[i]->PostRender();
        }

        // We don't really need more than 100 fps, so sleep for 0.01 sec
        msleep(0);
    }

    Message("Engine Main End\n");
}
Example #12
0
//---------------------------------------------------------------------------
// set the font pitch (default, fixed, or variable)
//
void __fastcall TTaeTextAttributes::SetPitch(TFontPitch Value)
{
  TCharFormat Format;

  InitFormat(Format);
  switch (Value) {
    case fpVariable:
      Format.bPitchAndFamily = VARIABLE_PITCH;
      break;
    case fpFixed:
      Format.bPitchAndFamily = FIXED_PITCH;
      break;
    default:
      Format.bPitchAndFamily = DEFAULT_PITCH;
      break;
    }
  SetAttributes(Format);
}
Example #13
0
//---------------------------------------------------------------------------
// Fetch the CHARFORMAT attributes and return a set that indicates which
// attributes are consistent throughout the range of text
//
TConsistentAttributes __fastcall TTaeTextAttributes::GetConsistentAttributes(void)
{
  TCharFormat Format;

  TConsistentAttributes Result;
  Result.Clear();        // necessary?
  if (FRichEdit->HandleAllocated() && FType == atSelected) {
    InitFormat(Format);
    ::SendMessage(FRichEdit->Handle, EM_GETCHARFORMAT,
      (WPARAM) FType == atSelected, (LPARAM) &Format);
    if (Format.dwMask & CFM_BOLD) Result = Result << caBold;
    if (Format.dwMask & CFM_COLOR) Result = Result << caColor;
    if (Format.dwMask & CFM_FACE) Result = Result << caFace;
    if (Format.dwMask & CFM_ITALIC) Result = Result << caItalic;
    if (Format.dwMask & CFM_SIZE) Result = Result << caSize;
    if (Format.dwMask & CFM_STRIKEOUT) Result = Result << caStrikeOut;
    if (Format.dwMask & CFM_UNDERLINE) Result = Result << caUnderline;
    if (Format.dwMask & CFM_PROTECTED) Result = Result << caProtected;
    }

  return Result;
}
Example #14
0
tbool CDeviceWaveIO::TestWaveOutCaps(tuint32* puiDevID, tint32 iHz)
{
	WAVEFORMATEX format;
	InitFormat(format, iHz);
	
	MMRESULT mmres;
	if (*puiDevID != WAVE_MAPPER) {
		// Real device ID - Just query
		mmres = waveOutOpen(
			NULL,
			*puiDevID,
			&format,
			0,
			0,
			WAVE_FORMAT_QUERY
		);
	}
	else {
		// For wave mapper we need to actually open and then close
		HWAVEOUT handle;
		mmres = waveOutOpen(
			&handle,
			*puiDevID,
			&format,
			0,
			0,
			CALLBACK_NULL
		);
		if (mmres == MMSYSERR_NOERROR) {
			// Success! 
			// Save device ID
			waveOutGetID(handle, puiDevID);
			// Now close it again
			waveOutClose(handle);
		}
	}
	return (mmres == MMSYSERR_NOERROR);
} // CDeviceWaveIO::TestWaveOutCaps