Beispiel #1
0
LONGLONG CReader::ScanAudioHeader()
{
	CAutoLock lock(&m_csec);

	DWORD cbLeft, cbRead;
	BYTE bInput[SCAN_BUFFER_SIZE];

	LPBYTE pbCurrent = bInput;
	LONGLONG llRet = SetPointer(0, FILE_CURRENT);

	Read(pbCurrent, SCAN_BUFFER_SIZE, &cbRead);
	cbLeft = cbRead; 
	while (cbLeft > 3)
	{
		while (cbLeft > 3)
		{
			if (CheckAudioHeader(pbCurrent))
			{
				llRet = SetPointer(0, FILE_CURRENT) - cbLeft;
				SetPointer(llRet, FILE_BEGIN);
				return llRet;
			}
			pbCurrent++;
			cbLeft--;
		}
		memmove(bInput, pbCurrent, cbLeft);
		pbCurrent = bInput + cbLeft;
		cbRead = SCAN_BUFFER_SIZE - cbLeft;
		Read(pbCurrent, cbRead, &cbRead);
		cbLeft += cbRead;
		pbCurrent = bInput;
	}
	return MAXLONGLONG;
}
GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& _vtx_decl)
{
  this->vtx_decl = _vtx_decl;
  u32 vertex_stride = _vtx_decl.stride;

  // We will not allow vertex components causing uneven strides.
  if (vertex_stride & 3)
    PanicAlert("Uneven vertex stride: %i", vertex_stride);

  VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get());

  glGenVertexArrays(1, &VAO);
  glBindVertexArray(VAO);

  // the element buffer is bound directly to the vao, so we must it set for every vao
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->m_index_buffers);
  glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);

  SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, _vtx_decl.position);

  for (int i = 0; i < 3; i++)
    SetPointer(SHADER_NORM0_ATTRIB + i, vertex_stride, _vtx_decl.normals[i]);

  for (int i = 0; i < 2; i++)
    SetPointer(SHADER_COLOR0_ATTRIB + i, vertex_stride, _vtx_decl.colors[i]);

  for (int i = 0; i < 8; i++)
    SetPointer(SHADER_TEXTURE0_ATTRIB + i, vertex_stride, _vtx_decl.texcoords[i]);

  SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, _vtx_decl.posmtx);

  vm->m_last_vao = VAO;
}
Beispiel #3
0
//---------------------------------------------------------------------------
//! @brief	  	フロントバッファとバックバッファを入れ替える
//! @param		pSample : サンプル。この中のポインタを変更する
//----------------------------------------------------------------------------
void TBufferRenderer::SwapBuffer( IMediaSample *pSample )
{
	CAutoLock cAutoLock(&m_BufferLock);	// クリティカルセクション
	if( m_FrontBuffer == 1 )
	{
		SetPointer( pSample, m_Buffer[1] );
		m_FrontBuffer = 0;
	}
	else
	{
		SetPointer( pSample, m_Buffer[0] );
		m_FrontBuffer = 1;
	}
}
wchar_t EasyUnicodeFileLE::readWchar( )//读取一个宽字符
{
	if( !IsReadMode ) return L'';//输出模式不允许读入
	if( IsEOF( ) ) return L'';//如果已经在文件尾了,就不读了

	wchar_t Temp2[ 2 ];
	wchar_t tempWC[ 2 ];
	try {
		F.read( (char *)tempWC, 2 );
		tempWC[ 1 ] = L'\0';

		if( tempWC[ 0 ] == L'\x000D' ) {
			F.read( (char *)Temp2, 2 );
			Temp2[ 1 ] = L'\0';
			if( Temp2[ 0 ] == L'\x000A' ) return L'\n';
			else {
				SetPointer( -1, ios_base::cur );
				return tempWC[ 0 ];
			}
		}
		else return tempWC[ 0 ];
	}
	catch( ... ) {
		cout << "ERROR_EUFLE008 - Unknown error." << endl;
		system( "PAUSE" );
		return L'';
	}
	return tempWC[ 0 ];
}
Beispiel #5
0
/*********************************************************************
* Function: WORD Bar(SHORT left, SHORT top, SHORT right, SHORT bottom)
*
* PreCondition: none
*
* Input: left,top - top left corner coordinates,
*        right,bottom - bottom right corner coordinates
*
* Output: For NON-Blocking configuration:
*         - Returns 0 when device is busy and the shape is not yet completely drawn.
*         - Returns 1 when the shape is completely drawn.
*         For Blocking configuration:
*         - Always return 1.
*
* Side Effects: none
*
* Overview: draws rectangle filled with current color
*
* Note: none
*
********************************************************************/
WORD Bar(SHORT left, SHORT top, SHORT right, SHORT bottom){
SHORT  x,y;

    #ifndef USE_NONBLOCKING_CONFIG
        while(IsDeviceBusy() != 0); /* Ready */
    #else
        if(IsDeviceBusy() != 0) return 0;
    #endif

    if(_clipRgn){
        if(left<_clipLeft)
           left = _clipLeft;
        if(right>_clipRight)
           right= _clipRight;
        if(top<_clipTop)
           top = _clipTop;
        if(bottom>_clipBottom)
           bottom = _clipBottom;
    }

    CS_LAT_BIT = 0;
  
    SetPointer(left,top,right,bottom);
    WriteCommand(CMD_WRITE);
    for(y=top; y<bottom+1; y++){
        for(x=left; x<right+1; x++){
            WriteData(_color.v[1]);
            WriteData(_color.v[0]);
        }
    }

    CS_LAT_BIT = 1;
    return 1;
}
Beispiel #6
0
/*********************************************************************
* Function: WORD GetPixel(SHORT x, SHORT y)
*
* PreCondition: none
*
* Input: x,y - pixel coordinates 
*
* Output: pixel color
*
* Side Effects: none
*
* Overview: return pixel color at x,y position
*
* Note: none
*
********************************************************************/
WORD GetPixel(SHORT x, SHORT y){
WORD_VAL  result;

    CS_LAT_BIT = 0;

    SetPointer(x,y,GetMaxX(),GetMaxY());
    
    WriteCommand(CMD_READ);

    // Start read cycle for LSB
    result.v[0] = PMDIN1;

    // Wait for reading is done
    Nop(); Nop();

    // Get LSB and start read cycle for MSB
    result.v[0] = PMDIN1;

    // Wait for reading is done
    Nop(); Nop();

    // Disable LCD (it will not accept extra /RD pulse)
    CS_LAT_BIT = 1;

    // Read MSB
    result.v[1] = PMDIN1;

    // Wait for dummy reading is done
    Nop(); Nop();

    return result.Val;
}
Beispiel #7
0
void EntryView::ConvertToPointer()
{
	int64 p;
	// create text
	if (Prefs.display_time == DISPLAY_SAMPLES){
		sscanf(Text(), "%Ld", &p);
	}else
	if (Prefs.display_time == DISPLAY_TIME){
		char t[255], s[255];
		int seconds = 0;
		int minutes = 0;
		float time = 0;
		sscanf(Text(), "%d:%d.%s", &minutes, &seconds, t);
		sprintf(s, "0.");
		strcat(s, t);
		sscanf(s, "%f", &time);

		if (time<0) time = 0;
		if (minutes<0) minutes = 0;
		if (seconds<0) seconds = 0;
		if (minutes>59) minutes = 0;
		if (seconds>59) seconds = 0;

		p = (int64)(Pool.frequency * (minutes*60+seconds+time));
	}
	SetPointer(p);
}
Beispiel #8
0
// Window::CreationWindow should be set
LRESULT CALLBACK InitialisationProc( HWND hWnd, UINT iMessage, WPARAM wParam,
											LPARAM lParam )
{
	Window *CW=Window::CreationWindow;
	if ( iMessage == WM_CREATE )
	{
		// Store a pointer to this object in the window's extra bytes;
		// this will enable us to access this object (and its member
		// functions) in WndProc where we are
		// given only a handle to identify the window.
		Window::CreationWindow=NULL;
		SetPointer( hWnd, CW );
		// make sure hWnd is set of correct handling of WM_CREATE
		CW->hWnd=hWnd;
		// Now let the object perform whatever
		// initialization it needs for WM_CREATE in its own
		// WndProc.
		SetWindowLong(hWnd,GWL_WNDPROC,(long) MainWndProc);

		TMSG Msg={iMessage,wParam,lParam,0};
		if (CW->WndProc(Msg)) return Msg.RetVal;
	}
	// The messages that
	// precede WM_CREATE must be processed without using pWindow so we
	// pass them to DefProc.
	return CW->DefProc( hWnd, iMessage, wParam, lParam );
}
Beispiel #9
0
void CBotVar::SetInit(CBotVar::InitType initType)
{
    m_binit = initType;
    if (initType == CBotVar::InitType::IS_POINTER ) m_binit = CBotVar::InitType::DEF;                    // cas spécial

    if ( m_type.Eq(CBotTypPointer) && initType == CBotVar::InitType::IS_POINTER )
    {
        CBotVarClass* instance = GetPointer();
        if ( instance == nullptr )
        {
            instance = new CBotVarClass(CBotToken(), m_type);
//            instance->SetClass((static_cast<CBotVarPointer*>(this))->m_classes);
            SetPointer(instance);
        }
        instance->SetInit(CBotVar::InitType::DEF);
    }

    if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) )
    {
        CBotVar*    p = (static_cast<CBotVarClass*>(this))->m_pVar;
        while( p != nullptr )
        {
            p->SetInit(initType);
            p->m_pMyThis = static_cast<CBotVarClass*>(this);
            p = p->GetNext();
        }
    }
}
Beispiel #10
0
void CBotVar::SetVal(CBotVar* var)
{
    switch (var->GetType())
    {
    case CBotTypBoolean:
        SetValInt(var->GetValInt());
        break;
    case CBotTypInt:
        SetValInt(var->GetValInt(), (static_cast<CBotVarInt*>(var))->m_defnum);
        break;
    case CBotTypFloat:
        SetValFloat(var->GetValFloat());
        break;
    case CBotTypString:
        SetValString(var->GetValString());
        break;
    case CBotTypPointer:
    case CBotTypNullPointer:
    case CBotTypArrayPointer:
        SetPointer(var->GetPointer());
        break;
    case CBotTypClass:
        {
            delete (static_cast<CBotVarClass*>(this))->m_pVar;
            (static_cast<CBotVarClass*>(this))->m_pVar = nullptr;
            Copy(var, false);
        }
        break;
    default:
        assert(0);
    }

    m_binit = var->m_binit;        // copie l'état nan s'il y a
}
Beispiel #11
0
void CBotVar::SetInit(int bInit)
{
    m_binit = bInit;
    if ( bInit == 2 ) m_binit = IS_DEF;                    // cas spécial

    if ( m_type.Eq(CBotTypPointer) && bInit == 2 )
    {
        CBotVarClass* instance = GetPointer();
        if ( instance == NULL )
        {
            instance = new CBotVarClass(NULL, m_type);
//            instance->SetClass((static_cast<CBotVarPointer*>(this))->m_pClass);
            SetPointer(instance);
        }
        instance->SetInit(1);
    }

    if ( m_type.Eq(CBotTypClass) || m_type.Eq(CBotTypIntrinsic) )
    {
        CBotVar*    p = (static_cast<CBotVarClass*>(this))->m_pVar;
        while( p != NULL )
        {
            p->SetInit( bInit );
            p->m_pMyThis = static_cast<CBotVarClass*>(this);
            p = p->GetNext();
        }
    }
}
Beispiel #12
0
void ATheHUD::SetNextAbility( Abilities nextAbility )
{
  NextAbility = nextAbility;

  // depending on the action style, set color
  switch( nextAbility )
  {
    case Abilities::Attack:
      SetCursorStyle( CrossHairs, FLinearColor::Red );
      break;
    case Abilities::Movement:
      SetCursorStyle( CrossHairs, FLinearColor::Blue );
      break;
    case Abilities::Stop:
      for( int i = 0; i < Selected.size(); i++ )
        Selected[i]->Stop();
      break;
    case Abilities::HoldGround:
      for( int i = 0; i < Selected.size(); i++ )
        Selected[i]->HoldGround();
      break;
    case Abilities::NotSet:
      SetPointer();
      break;
    default:
      error( FS( "Unrecognized ability %d", (int)NextAbility ) );
      break;
  }
}
Beispiel #13
0
/*********************************************************************
* Function: void PutImage1BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch)
*
* PreCondition: none
*
* Input: left,top - left top image corner, bitmap - image pointer,
*        stretch - image stretch factor
*
* Output: none
*
* Side Effects: none
*
* Overview: outputs monochrome image starting from left,top coordinates
*
* Note: image must be located in flash
*
********************************************************************/
void PutImage1BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch){
register FLASH_BYTE* flashAddress;
register FLASH_BYTE* tempFlashAddress;
BYTE temp;
WORD sizeX, sizeY;
WORD x,y;
BYTE stretchX,stretchY;
WORD pallete[2];
BYTE mask;

    // Move pointer to size information
    flashAddress = bitmap + 2;

    // Read image size
    sizeY = *((FLASH_WORD*)flashAddress);
    flashAddress += 2;
    sizeX = *((FLASH_WORD*)flashAddress);
    flashAddress += 2;
    pallete[0] = *((FLASH_WORD*)flashAddress);
    flashAddress += 2;
    pallete[1] = *((FLASH_WORD*)flashAddress);
    flashAddress += 2;

    CS_LAT_BIT = 0;
    for(y=0; y<sizeY; y++){
        tempFlashAddress = flashAddress;
        for(stretchY = 0; stretchY<stretch; stretchY++){
            flashAddress = tempFlashAddress;
            SetPointer(left, top+y, GetMaxX(), GetMaxY());
            WriteCommand(CMD_WRITE);
            mask = 0;
            for(x=0; x<sizeX; x++){
                // Read 8 pixels from flash
                if(mask == 0){
                    temp = *flashAddress;
                    flashAddress++;
                    mask = 0x80;
                }
                
                // Set color
                if(mask&temp){
                    SetColor(pallete[1]);
                }else{
                    SetColor(pallete[0]);
                }

                // Write pixel to screen
                for(stretchX=0; stretchX<stretch; stretchX++){
                    WriteData(_color.v[1]);
                    WriteData(_color.v[0]);
                }

                // Shift to the next pixel
                mask >>= 1;
           }
        }
    }
    CS_LAT_BIT = 1;
}
Beispiel #14
0
/*
===========
IN_HideMouse
===========
*/
void IN_HideMouse (void)
{
	if (window && pointermem && window->Pointer != pointermem)
	{
		SetPointer(window, pointermem, 1, 1, 0, 0);
		//Con_Printf("IN_HideMouseOK\n");
	}
}
void EasyUnicodeFileLE::open( string FileName, ios_base::open_mode OpenMode )
{
	/*先关闭试试*/
	if( F.is_open( ) ) {
		cout << "WARNING_EUFLE001 - Target opening file is open, and will be closed." << endl;
		cout << "                   ( File Name: " << FileName << " )" << endl;
		close( );
	}

	/*初始检测操作*/
	if( !Initialization( OpenMode ) ) return;

	/*判断读or写模式*/
	JudgeReadOrWrite( OpenMode );

	/*执行打开操作*/
	char Name[ 1000 ];
	Tools.StringToChars( FileName, Name );
	F.open( Name, OpenMode | ios_base::in | ios_base::binary ); //内部要进行读取操作
	if( !F.is_open( ) ) {
		cout << "ERROR_EUFLE004 - Cannot open file." << endl;
		cout << "                 ( File Name: " << Name << " )" << endl;
		system( "PAUSE" );
		return;
	}

	/*头部标记处理*/
	char Head[ 3 ] = "\xFF\xFE";
	if( IsReadMode ) {//读入模式
		if( DEBUG_FLAG ) cout << "File of in-mode." << endl;
		F.read( Head, 2 );
		if( strcmp( Head, "\xFF\xFE" ) ) {
			cout << "ERROR_EUFLE005 - Not a Little-Endian Unicode file." << endl;
			cout << "                 File Name: " << Name << endl;
			cout << "                 Encode:    " << testFileHeader( ) << endl;
			system( "PAUSE" );
			return;
		}
	}
	else {
		if( DEBUG_FLAG ) cout << "File of out-mode." << endl;
		if( ( ios_base::trunc | OpenMode ) == OpenMode ) F.write( Head, 2 );//覆写输出模式
		else { //不是覆写模式,要先验证FFFE
			F.seekg( 0, ios_base::beg );
			F.read( Head, 2 );
			if( strcmp( Head, "\xFF\xFE" ) ) {
				cout << "ERROR_EUFLE006 - Not a Little-Endian Unicode file." << endl;
			cout << "                 ( File Name: " << Name << " )" << endl;
				system( "PAUSE" );
				return;
			}
			SetPointer( 0, ios_base::end );
		}
	}

	return;
}
Beispiel #16
0
BOOL Mp4File::CheckStructure()
{
	MP4_HEADER hdr;
	SetPointer(0);
	if (sizeof(hdr) == Read(&hdr, sizeof(hdr))) {
		
	}
	return TRUE;
}
Beispiel #17
0
/*********************************************************************
* Function: void PutImage4BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch)
*
* PreCondition: none
*
* Input: left,top - left top image corner, bitmap - image pointer,
*        stretch - image stretch factor
*
* Output: none
*
* Side Effects: none
*
* Overview: outputs 16 color image starting from left,top coordinates
*
* Note: image must be located in flash
*
********************************************************************/
void PutImage4BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch){
register FLASH_BYTE* flashAddress;
register FLASH_BYTE* tempFlashAddress;
WORD sizeX, sizeY;
register WORD x,y;
BYTE temp;
register BYTE stretchX,stretchY;
WORD pallete[16];
WORD counter;

    // Move pointer to size information
    flashAddress = bitmap + 2;

    // Read image size
    sizeY = *((FLASH_WORD*)flashAddress);
    flashAddress += 2;
    sizeX = *((FLASH_WORD*)flashAddress);
    flashAddress += 2;

    // Read pallete
    for(counter=0;counter<16;counter++){
        pallete[counter] = *((FLASH_WORD*)flashAddress);
        flashAddress += 2;
    }

    CS_LAT_BIT = 0;     
    for(y=0; y<sizeY; y++){
        tempFlashAddress = flashAddress;
        for(stretchY = 0; stretchY<stretch; stretchY++){
            flashAddress = tempFlashAddress;
            SetPointer(left, top+y, GetMaxX(), GetMaxY());
            WriteCommand(CMD_WRITE);
            for(x=0; x<sizeX; x++){
                // Read 2 pixels from flash
                if((x&0x0001) == 0){
                    // Set color
                    SetColor(pallete[temp>>4]);
                }else{
                    temp = *flashAddress;
                    flashAddress++;
                    // Set color
                    SetColor(pallete[temp&0x0f]);
                }

                // Write pixel to screen       
                for(stretchX=0; stretchX<stretch; stretchX++){
                    WriteData(_color.v[1]);
                    WriteData(_color.v[0]);
                }

                // Shift to the next pixel
                temp >>= 4;
            }
        }
Beispiel #18
0
//---------------------------------------------------------------------------
//! @brief	  	バックバッファにバッファへのポインタを設定する
//! @param		buff : バッファへのポインタ
//----------------------------------------------------------------------------
void TBufferRenderer::SetBackBuffer( BYTE *buff )
{
	CAutoLock cAutoLock(&m_BufferLock);	// クリティカルセクション
	FreeBackBuffer();
	if( m_FrontBuffer == 1 )
		m_Buffer[0] = buff;
	else
		m_Buffer[1] = buff;
	
	SetPointer( buff );
}
Beispiel #19
0
/*********************************************************************
* Function: void ClearDevice(void)
*
* PreCondition: none
*
* Input: none
*
* Output: none
*
* Side Effects: none
*
* Overview: clears screen with current color 
*
* Note: none
*
********************************************************************/
void ClearDevice(void){
DWORD     counter;

    CS_LAT_BIT = 0;
    SetPointer(0,0,GetMaxX(),GetMaxY());
    WriteCommand(CMD_WRITE);
    for(counter=0; counter<(DWORD)(GetMaxX()+1)*(GetMaxY()+1); counter++){
        WriteData(_color.v[1]);
        WriteData(_color.v[0]);
    }
    CS_LAT_BIT = 1;
}
Beispiel #20
0
CBotVar* CBotVarArray::GetItem(int n, bool bExtend)
{
    if ( m_pInstance == nullptr )
    {
        if ( !bExtend ) return nullptr;
        // creates an instance of the table

        CBotVarClass* instance = new CBotVarClass(CBotToken(), m_type);
        SetPointer( instance );
    }
    return m_pInstance->GetItem(n, bExtend);
}
Beispiel #21
0
void CGUIWindowPointer::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
  bool active = g_Mouse.IsActive();
  if (active != m_active)
  {
    MarkDirtyRegion();
    m_active = active;
  }
  SetPosition((float)g_Mouse.GetX(), (float)g_Mouse.GetY());
  SetPointer(g_Mouse.GetState());
  return CGUIWindow::Process(currentTime, dirtyregions);
}
Beispiel #22
0
KBOOL Kylin::CursorEx::Initialize()
{

	//MyGUI::PointerManager::getInstance().load("Pointers.xml");
	
	SetPointer(CT_NORMAL);

	MyGUI::IntSize size = MyGUI::Gui::getInstance().getViewSize();
	Kylin::OgreRoot::GetSingletonPtr()->GetInputManager()->SetMousePosition(size.width / 2, size.height / 2);

	return true;
}
Beispiel #23
0
LONGLONG CReader::ScanAudioHeader(int nVersion, int nLayer)
{
	CAutoLock lock(&m_csec);

	DWORD cbLeft, cbRead;
	BYTE bInput[SCAN_BUFFER_SIZE];

	LPBYTE pbCurrent = bInput;
	LONGLONG llRet = SetPointer(0, FILE_CURRENT);

	Read(pbCurrent, SCAN_BUFFER_SIZE, &cbRead);
	cbLeft = cbRead; 
	while (cbLeft > 3)
	{
		while (cbLeft > 3)
		{
			if (CheckAudioHeader(pbCurrent))
			{
				int v = (*(pbCurrent + 1) & 0x10) ?
					2 - ((*(pbCurrent + 1) & 0x08) >> 3): 3;
				int l = 4 - (((*(pbCurrent + 1)) & 0x06) >> 1);
				if (v == nVersion && l == nLayer)
				{
					llRet = SetPointer(0, FILE_CURRENT) - cbLeft;
					SetPointer(llRet, FILE_BEGIN);
					return llRet;
				}
			}
			pbCurrent++;
			cbLeft--;
		}
		memmove(bInput, pbCurrent, cbLeft);
		pbCurrent = bInput + cbLeft;
		cbRead = SCAN_BUFFER_SIZE - cbLeft;
		Read(pbCurrent, cbRead, &cbRead);
		cbLeft += cbRead;
		pbCurrent = bInput;
	}
	return MAXLONGLONG;
}
Beispiel #24
0
void CGUIWindowPointer::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
  bool active = CInputManager::Get().IsMouseActive();
  if (active != m_active)
  {
    MarkDirtyRegion();
    m_active = active;
  }
  MousePosition pos = CInputManager::Get().GetMousePosition();
  SetPosition((float)pos.x, (float)pos.y);
  SetPointer(CInputManager::Get().GetMouseState());
  return CGUIWindow::Process(currentTime, dirtyregions);
}
Beispiel #25
0
/*
 * Set a String Value for the environment variable var in the
 * environment env to string with priority pri.  Space is allocated
 * for the string.
 *
 * If the string is null, free the old string (if one existed) and
 * then set the placeholder to NULL.
 */
	PGPError
pgpenvSetString (PGPEnv *env, PgpEnvStrings var,
		 char const *string, int pri)
{
	PGPError err = kPGPError_NoErr;

	pgpAssertAddrValid( env, PGPEnv );
	if ( env == NULL )
		return kPGPError_BadParams;

	if (var < PGPENV_BASE_STRING || var >= PGPENV_MAX_STRING)
		return kPGPError_BadParams;

	if (pri < env->confString[var-PGPENV_BASE_STRING].pri)
		return kPGPError_EnvPriorityTooLow;	/* not assigned */

	switch (var) {
	case PGPENV_CHARSET:
		{
			PGPByte const *toLocal, *toLatin1;

			err = pgpCharmaps (string, strlen (string), &toLocal,
					   &toLatin1);
			if (!err) {
				DoSetString (env, PGPENV_CHARSET, string, pri);
				SetPointer (env, PGPENV_CHARMAPTOLOCAL,
					    (void *)toLocal, 256);
				SetPointer (env, PGPENV_CHARMAPTOLATIN1,
					    (void *)toLatin1, 256);
			}
		}
		break;
	default:
		err = DoSetString (env, var, string, pri);
	}

	return err;
}
Beispiel #26
0
void pointer_hide(void)
{
  video_canvas_t *canvas;

  if (pointer_hidden == 1) {
    return;
  }

  for (canvas = canvaslist; canvas; canvas = canvas->next) {
    SetPointer(canvas->os->window, empty_pointer, 2, 16, 0, 0);
  }

  pointer_hidden = 1;
}
Beispiel #27
0
/************************************************************************
cMouse::Constructor()

Initialize DI device
*************************************************************************/
cMouse::cMouse(LPDIRECTINPUT8 pDI, HWND hwnd, bool isExclusive)
{
	cLog *Log = cLog::Instance();
	HRESULT hr;

	hr = pDI->CreateDevice(GUID_SysMouse, &m_pDIDev, NULL);
	if(FAILED(hr))
	{
		Log->Error(hr,"Creating mouse device");
	}
	hr = m_pDIDev->SetDataFormat(&c_dfDIMouse);
	if(FAILED(hr))
	{
		Log->Error(hr,"Setting mouse data format");
	}
	//DIMOUSESTATE Structure - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/input/ref/structs/dimousestate.asp
	
	DWORD flags;
	if (isExclusive)
	{
		flags = DISCL_FOREGROUND | DISCL_EXCLUSIVE | DISCL_NOWINKEY;
	}
	else
	{
		flags = DISCL_FOREGROUND | DISCL_NONEXCLUSIVE;
		//ShowCursor(false);
	}

	hr = m_pDIDev->SetCooperativeLevel(hwnd, flags);
	if (FAILED(hr))
	{
		Log->Error(hr,"Setting mouse cooperative level");
	}

	hr = m_pDIDev->Acquire();
	if(FAILED(hr))
	{
		Log->Error(hr,"Acquiring mouse");
	}

	hr = m_pDIDev->GetDeviceState(sizeof(DIMOUSESTATE), &m_state);
	if(FAILED(hr))
	{
		Log->Error(hr,"Getting mouse device state");
	}

	SetPointer(NORMAL);
	SetSelection(SELECT_NOTHING);
	InitAnim();
}
Beispiel #28
0
Window::~Window()
{
    //free memory
    if (Title) delete[] Title;
    if (Name) delete[] Name;
    if (HIWORD(Menu)) delete[] Menu;

    // no more messages, not even destroy
    SetWindowLong(hWnd,GWL_WNDPROC,(long) NullProc);
    SetPointer( hWnd, NULL );

    // only destroy if option 2) above
    if (!(Flags & W_DESTROYED)) DestroyWindow();
}
Beispiel #29
0
CBCGPKnob::CBCGPKnob(CBCGPVisualContainer* pContainer) :
    CBCGPCircularGaugeImpl(pContainer)
{
    m_bCacheImage = FALSE;
    m_bIsInteractiveMode = TRUE;
    m_nFrameSize = 2;
    m_bDrawTextBeforeTicks = TRUE;
    m_bDrawTicksOutsideFrame = TRUE;
    m_CapSize = 0.;

    SetColors(CBCGPCircularGaugeColors::BCGP_CIRCULAR_GAUGE_SILVER);

    SetInteractiveMode();
    SetPointer(CBCGPKnobPointer(), FALSE);
}
Beispiel #30
0
bool ColorCanvas::OnMouseButtonDown(int x, int y, Uint8 button)
{
	KrVector2T< GlFixed > object;
	getImage()->ScreenToObject( x, y, &object );

	KrRGBA *pixels = getCanvasResource()->Pixels(), color;
	color = pixels[ object.y.ToInt()*Width() + object.x.ToInt() ];

	((ColorPicker *)getParent())->SetColor(color.c.red, color.c.green, color.c.blue);
	SetPointer(object.x.ToInt(), object.y.ToInt());

	canPick = true;

	getCanvasResource()->Refresh();
	return false;
}