Example #1
0
/*virtual*/ void Framework3D::ToggleFullscreen()
{
	bool NewFullScreen = !m_Display->m_Fullscreen;

	// HACKHACK: At least for now, Linux doesn't do fullscreen at non desktop resolutions well.
	// So switch to desktop res when going fullscreen.
#if BUILD_LINUX
	if( NewFullScreen )
	{
		SetResolution( m_Display->m_ScreenWidth, m_Display->m_ScreenHeight );
	}
#endif

	PRINTF( "Framework3D::ToggleFullscreen %s\n", NewFullScreen ? "true" : "false" );

	if( !NewFullScreen &&
		(	m_Display->m_Width > m_Display->m_ScreenWidth ||
			m_Display->m_Height > m_Display->m_ScreenHeight ) )
	{
		PRINTF( "Automatically setting resolution to screen size.\n" );
		SetResolution( m_Display->m_ScreenWidth, m_Display->m_ScreenHeight );
	}

	m_Display->SetFullScreen( NewFullScreen );
	m_Display->UpdateDisplay();

	m_Window->SetFullscreen( NewFullScreen );

	m_Renderer->SetFullScreen( NewFullScreen );
	m_Renderer->Reset();

	// Set size after resetting renderer to be sure screen-to-client transform is correct
	RefreshWindowSize();
}
Example #2
0
int Settings::ParseArguments()
{
	for(int i = 1; i < myArgc; ++i)
	{
		std::string argument = myArgv[i];
		
		if(argument == "--fullscreen" || argument == "-full")
		{
			mySettings["Window"]["Style"] = WindowStyleFullscreen;
		}
		else if(argument == "--fullscreenemulation" || argument == "-fsemu")
		{
			mySettings["Window"]["Style"] = WindowStyleEmulation;
			SetDesktopResolution();
		}
		else if(argument == "--window" || argument == "-win")
		{
			mySettings["Window"]["Style"] = WindowStyleClose;
		}
		else if(argument == "--desktop-mode")
		{
			SetDesktopResolution();
		}
		else if(argument.substr(0,13) == "--resolution=" && argument.length() > 18)
		{
			std::string string(argument.substr(13));
			SetResolution(string);
		}
		else if(argument.substr(0,5) == "-res=" && argument.length() > 10)
		{
			std::string string(argument.substr(5));
			SetResolution(string);
		}
		else if(argument == "--help" || argument == "-h")
		{
			Help();
			return 1;
		}
		else
		{
			std::cout << myArgv[0] << ": invalid optin '" << argument << "'.\n";
			std::cout << "Try '" << myArgv[0] << " --help' to get more information." << std::endl;
			return -1;
		}
	}
	
	return 0;
}
void
MonitorView::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case UPDATE_DESKTOP_MSG:
		{
			int32 width, height;
			if (message->FindInt32("width", &width) == B_OK
				&& message->FindInt32("height", &height) == B_OK)
				SetResolution(width, height);
			break;
		}

		case UPDATE_DESKTOP_COLOR_MSG:
		{
			BScreen screen(Window());
			rgb_color color = screen.DesktopColor(current_workspace());
			if (color != fDesktopColor) {
				fDesktopColor = color;
				Invalidate();
			}
			break;
		}

		default:
			BView::MessageReceived(message);
			break;
	}
}
Example #4
0
	void Graphics::SetResolution(unsigned int width, unsigned int height)
	{
		DXGI_MODE_DESC modeDesc;
		DXGI_SWAP_CHAIN_DESC swapChainDesc;

		m_screenSize.cx = width;
		m_screenSize.cy = height;

		if(m_swapChain != NULL)
		{
			m_swapChain->GetDesc(&swapChainDesc);
			if(IsFullscreen() && swapChainDesc.Windowed)
			{
				SetResolution(800, 600);
			}
			else if(swapChainDesc.BufferDesc.Width != width || swapChainDesc.BufferDesc.Height != height)
			{
				m_isReady = false;
				SAFE_RELEASE(m_depthStencilView);
				SAFE_RELEASE(m_depthStencilState);
				SAFE_RELEASE(m_depthStencilBuffer);
				SAFE_RELEASE(m_renderTargetView);
				
				ZeroMemory(&modeDesc, sizeof(modeDesc));
				modeDesc.Format = DXGI_FORMAT_UNKNOWN;
				modeDesc.Width = width;
				modeDesc.Height = height;
				
				m_swapChain->ResizeTarget( &modeDesc );
			}
		}
	}
Example #5
0
/*
Called to acquire images from the source. parameter numImages i the
numberof images that you an handle concurrently
*/
BOOL CTwain::Acquire(int numImages, TW_UINT16 duplex, TW_UINT16 size, TW_UINT16 pixel, TW_UINT16 resolution, BOOL bShowUI, int nAutoCut)
{
	if(DSOpen() || OpenSource())
	{
		_bTwainContinue = TRUE;
//		BOOL ret_value=SetCapability(CAP_DUPLEXENABLED,duplex,TRUE);
		if (duplex == 1)
			duplex = TRUE;
		else
			duplex = FALSE;	// CAP_DUPLEX
		BOOL ret_value = SetOneValueCapability(CAP_DUPLEXENABLED, TWTY_BOOL, duplex);	//单双面扫描控制	//duplex, TRUE


//		ret_value = SetCapability(CAP_DUPLEX, duplex, TRUE);

		ret_value=SetCapability(ICAP_SUPPORTEDSIZES,size,TRUE);
		ret_value=SetCapability(ICAP_PIXELTYPE,pixel,TRUE);
		ret_value=SetResolution(ICAP_XRESOLUTION,resolution);
		ret_value=SetResolution(ICAP_YRESOLUTION,resolution);
		
		ret_value = SetCapability(ICAP_AUTOMATICBORDERDETECTION, nAutoCut, TRUE);	//自动裁剪

		TW_UINT16 nRotate = 1;
		ret_value = SetCapability(ICAP_AUTOMATICDESKEW, nRotate, TRUE);		//自动纠偏

#if 0
		TW_UINT16 nBright = (135 - 128) / 0.125;
		ret_value = SetCapability(ICAP_BRIGHTNESS, nBright, TRUE);		//亮度调节

		TW_UINT16 nContrast = (135 - 128) / 0.125;
		ret_value = SetCapability(ICAP_CONTRAST, nContrast, TRUE);		//对比度调节
#endif

		if(SetImageCount(numImages))
		{
			if (EnableSource(bShowUI))
			{
				return TRUE;
			}
		}
	}
	return FALSE;
}
Example #6
0
void PS3Graphics::ChangeResolution(uint32_t resId, uint16_t pal60Hz)
{
	cellDbgFontExit();
	PSGLDeInitDevice();
	
	PSGLInitDevice(resId, pal60Hz);
	PSGLInit();
	InitDbgFont();
	SetResolution();
}
void UAURVideoScreenBackground::OnCameraPropertiesChange(UAURDriver* Driver)
{
	Super::OnCameraPropertiesChange(Driver);

	if (VideoDriver && VideoDriver->IsConnected())
	{
		SetResolution(VideoDriver->GetResolution());
		SetSizeForFOV(VideoDriver->GetFieldOfView().X);
	}
}
Example #8
0
void VideoEngine::SetInitialResolution(int32 width, int32 height)
{
    // Get the current system color depth and resolution
    const SDL_VideoInfo *video_info(0);
    video_info = SDL_GetVideoInfo();

    if(video_info) {
        // Set the resolution to be the highest possible (lower than the user one)
        if(video_info->current_w >= width && video_info->current_h >= height) {
            SetResolution(width, height);
        } else if(video_info->current_w >= 1024 && video_info->current_h >= 768) {
            SetResolution(1024, 768);
        } else if(video_info->current_w >= 800 && video_info->current_h >= 600) {
            SetResolution(800, 600);
        } else {
            SetResolution(640, 480);
        }
    } else {
        // Default resoltion if we could not retrieve the resolution of the user
        SetResolution(width, height);
    }
}
Example #9
0
	void Graphics::SetFullscreen( bool fullscreen )
	{
		if(IsFullscreen() != fullscreen)
		{
			if(m_swapChain != NULL)
			{
				if(fullscreen)
				{
					SetResolution(1680, 1050);
					m_fullscreen = fullscreen;
					m_swapChain->SetFullscreenState(fullscreen, NULL);
				}
				else
				{
					m_fullscreen = fullscreen;
					m_swapChain->SetFullscreenState(fullscreen, NULL);
					SetResolution(800, 600);
				}
			}
		}

		return;
	}
Example #10
0
void PS3Graphics::Init()
{
	PSGLInitDevice(NULL, m_pal60Hz);
	int32_t ret = PSGLInit();

	if (ret == CELL_OK)
	{
		SetResolution();
	}
	GetAllAvailableResolutions();

	// TODO : Initially set to false. This will be overridden later
	SetAspectRatio(false);
}
Example #11
0
UPoint Settings::ToggleResolution() {
    UPoint resolution;

    if(m_resolution.x < 800)
	resolution = UPoint(800, 600);
    else if(m_resolution.x < 1024)
	resolution = UPoint(1024, 768);
    else
	resolution = UPoint(640, 480);

    SetResolution(resolution);

    return m_resolution;
}
Example #12
0
void CMouseStat::Initialize()
{
/*
	歌方:
		1、
		
	卦指:
		1、
		
	傍苧:
		1、
*/
	// Set the default resolution (PAL)
	SetResolution(720, 576, 1, 1);
}
Example #13
0
NaoCamera::NaoCamera(int _id, std::string _name, cv::Size _resolution, float _fps)
{
	id = _id;
	name = _name;
	fps_rate = NULL;

	if(id >= 0)
	{
		cap = new cv::VideoCapture(id);
	}
	else
	{
		cap = new cv::VideoCapture(name);
	}
	SetResolution(_resolution);
	SetFPS(_fps);

}
void
MultiresControlAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("MultiresControlAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("resolution")) != 0)
        SetResolution(node->AsInt());
    if((node = searchNode->GetNode("maxResolution")) != 0)
        SetMaxResolution(node->AsInt());
    if((node = searchNode->GetNode("info")) != 0)
        SetInfo(node->AsString());
}
Example #15
0
XnStatus XnPixelStream::SetYRes(XnUInt32 nYRes)
{
    XnStatus nRetVal = XN_STATUS_OK;

    XnResolutions res = XnDDKGetResolutionFromXY(GetXRes(), nYRes);

    // set resolution (this will also set X and Y resolution)
    nRetVal = SetResolution(res);
    XN_IS_STATUS_OK(nRetVal);

    if (res == XN_RESOLUTION_CUSTOM)
    {
        // update Y res ourselves
        nRetVal = m_YRes.UnsafeUpdateValue(nYRes);
        XN_IS_STATUS_OK(nRetVal);
    }

    return (XN_STATUS_OK);
}
Example #16
0
void CMouse::Initialize(void *appData)
{
  if (m_mouseDevice)
    return; // nothing to do

  // create the mouse device
#ifdef _XBOX
  m_mouseDevice = new CXBoxMouse();
#elif defined (HAS_SDL)
  m_mouseDevice = new CSDLMouse();
#else
  m_mouseDevice = new CDirectInputMouse();
#endif

  if (m_mouseDevice)
    m_mouseDevice->Initialize(appData);

  // Set the default resolution (PAL)
  SetResolution(720, 576, 1, 1);
}
Example #17
0
/*virtual*/ void Framework3D::SetResolution( const uint DisplayWidth, const uint DisplayHeight )
{
	// HACKHACK: At least for now, Linux doesn't do fullscreen at non desktop resolutions well.
	// So if we're in fullscreen mode, promote all resolution changes to desktop resolution.
#if BUILD_LINUX
	if( m_Display->m_Fullscreen &&
		( DisplayWidth != m_Display->m_ScreenWidth || DisplayHeight != m_Display->m_ScreenHeight ) )
	{
		SetResolution( m_Display->m_ScreenWidth, m_Display->m_ScreenHeight );
		return;
	}
#endif

	PRINTF( "Framework3D::SetResolution %d %d\n", DisplayWidth, DisplayHeight );

	ASSERT( DisplayWidth <= m_Display->m_ScreenWidth || m_Display->m_Fullscreen );
	ASSERT( DisplayHeight <= m_Display->m_ScreenHeight || m_Display->m_Fullscreen );

	m_Display->SetResolution( DisplayWidth, DisplayHeight );
	m_Display->UpdateDisplay();

	// HACKHACK: SDL
	m_Window->SetFullscreen( false );

	RefreshWindowSize();

	// HACKHACK: SDL
	m_Window->SetFullscreen( m_Display->m_Fullscreen );

	m_Renderer->Reset();

	if( m_TargetManager )
	{
		m_TargetManager->ReleaseTargets();
		m_TargetManager->CreateTargets( m_Display->m_Width, m_Display->m_Height );
	}

	m_UIManager->Reinitialize();
}
Example #18
0
bool Graphics::init(int resolution)
{
	if (use_palette)
	{
		screen_bpp = 8;
	}
	else
	{
		screen_bpp = 16;	// the default
		/*
        #ifndef __SDLSHIM__
        const SDL_VideoInfo *info;
		
		// // it's faster if we create the SDL screen at the bpp of the real screen.
		// // max fps went from 120 to 160 on my X11 system this way.
		if ((info = SDL_GetVideoInfo()))
        {
        stat("videoinfo: desktop bpp %d", info->vfmt->BitsPerPixel);
		 	if (info->vfmt->BitsPerPixel > 8)
		 		screen_bpp = info->vfmt->BitsPerPixel;
        }
		 #endif
         */
	}
	
	palette_reset();
	
	if (SetResolution(resolution, false))
		return 1;
	
	if (Tileset::Init())
		return 1;
	
	if (Sprites::Init())
		return 1;
	
	return 0;
}
Example #19
0
	void Screen::SetResolution(uint32 w, uint32 h)
	{
		SetResolution(w, h, !IsWindowed());
	}
Example #20
0
int main(int argc, char *argv[])

{
	int ntotal,external;
	NodeList hull, intern, boundary, given;

	HNN=MakeHashTable();
	HEL=MakeHashTable();
	HLI=MakeHashTable();
	NEL=MakeListTable();
	CM=MakeQueueTable();

 	SetOptions(argc,argv);

	ReadFiles(argc,argv);
	/* CheckBoundary(); */

	ntotal = CheckInput();
	hull = MakeNodeList(ntotal);
	intern = MakeNodeList(ntotal);

	printf("Making convex hull... %d\n",hull->count);
	ConvexHull(hull,intern);
/*
	CheckConvex(hull,intern);
	PrintNodeList("hull",hull);
	PrintNodeList("intern",intern);
*/

	printf("Making maxi elements...\n");
	MakeMaxiTriang(hull);
	CheckNeibor(-1);

	printf("Inserting convex hull... %d\n",hull->count);
	InsertBoundaryNodes(hull);
	CheckCircumCircle();
	CheckNeibor(-2);

	WriteAll("M_hull.grd",hull);
	CheckNeibor(-3);

	printf("Inserting internal boundary points... %d\n",intern->count);
	InsertBoundaryNodes(intern);
	CheckCircumCircle();
	CheckNeibor(-4);
	WriteAll("M_orgbound.grd",NULL);

	SetResolution(hull);
	CopyBoundaryLine();

	printf("Recovering boundary lines 1...\n");
	RecoverBoundary();
	CheckCircumCircle();
	CheckNeibor(-43);
	WriteAll("M_bndrecover.grd",NULL);

	printf("Refining boundary points 1...\n");
	boundary = RefineBoundary();

	if( boundary ) {
	    printf("Inserting new boundary points... %d\n",boundary->count);
	    InsertBoundaryNodes(boundary);
	    CheckCircumCircle();
	    CheckCircumCircleProperty();
	    CheckNeibor(-5);
	}

	TestVersion();

	printf("Marking external elements...");
	external=MarkExternalElements( hull );
	printf(" %d / %d\n",external,NTotElems);
	WriteGrd("M_finebound.grd");

/*
	printf("Marking outer elements...");
	external=MarkOuterElements();
	printf(" %d / %d\n",external,NTotElems);
	WriteGrd("M_test.grd");
*/

	FreeNodeList(hull);
	FreeNodeList(intern);
	FreeNodeList(boundary);

	given = GivenNodes();
	printf("Inserting internal given points... %d\n",given->count);
	InsertNodes(given);
	FreeNodeList(given);
	CheckCircumCircle();
	CheckNeibor(-44);
	WriteAll("M_given.grd",NULL);

	printf("Recovering boundary lines 2...\n");
	RecoverBoundary();
	CheckCircumCircle();
	CheckNeibor(-45);
	WriteAll("M_intrecover.grd",NULL);

	CheckArea();
	printf("Inserting internal points...\n");
	InsertInternalNodes();
	CheckCircumCircle();
	CheckCircumCircleProperty();
	WriteGrd("M_insert.grd");

	TestVersion();

	CheckArea();
	printf("Refining internal points... %f\n",OpAspect);
	RefineInternalNodes();
	CheckArea();
	CheckCircumCircle();
	CheckCircumCircleProperty();
	WriteGrd("M_refine.grd");

	CheckArea();
	printf("Recovering boundary lines 3...\n");
	RecoverBoundary();
	printf("Recovering fault lines...\n");
	RecoverInternalFault();
	CheckCircumCircle();
	CheckNeibor(-48);
	WriteAll("M_intrecover2.grd",NULL);

	printf("Marking outer elements...");
	external=MarkOuterElements();
	printf(" %d / %d\n",external,NTotElems);
	printf("Marking outer nodes...");
	external=MarkOuterNodes();
	printf(" %d / %d\n",external,NTotNodes);
	WriteGrd("M_test.grd");

	TestVersion();

	CheckArea();
	printf("Smoothing internal points... %f\n",OpSmoothOmega);
	SmoothInternalNodes();
	CheckArea();
	WriteGrd("final.grd");

	return 0;
}
Example #21
0
bool VideoCapture::InitCamera(int iDevice, int iResolution)
{
	if (cameraInitialized) return false;

	HRESULT hr;
	bool ans;
	int iWidth = devices_resolutions[iDevice].x[iResolution];
	int iHeight = devices_resolutions[iDevice].y[iResolution];

    USES_CONVERSION;

	CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
		  IID_ISampleGrabber, (void**)&pGrabber);
	if( !pGrabber ) return false;
    
	hr = pNull.CoCreateInstance(CLSID_NullRenderer);
	
    CComQIPtr< IBaseFilter, &IID_IBaseFilter > pGrabberBase( pGrabber );

	ans = BindFilter(iDevice, &pSource);
	if( !pSource ) return false;
	
	hr = pGraph.CoCreateInstance( CLSID_FilterGraph );
	if (hr!=S_OK) return false;

	hr = pGraph->AddFilter( pSource, L"Source" );
	if (hr!=S_OK) return false;
	hr = pGraph->AddFilter( pGrabberBase, L"Grabber" );
    if (hr!=S_OK) return false;
	hr = pGraph->AddFilter( pNull, L"NullRenderer" );
	if (hr!=S_OK) return false;
	
	// Tell the grabber to grab 24-bit video. Must do this
    // before connecting it
    CMediaType GrabType;

	GrabType.SetType( &MEDIATYPE_Video );
	GrabType.SetSubtype( &MEDIASUBTYPE_RGB24 );

	hr = pGrabber->SetMediaType( &GrabType );
	if (hr!=S_OK) return false;

    CComPtr< IPin > pGrabPinIn;
    CComPtr< IPin > pGrabPinOut;
    CComPtr< IPin > pNullPinIn;

    pSourcePin = GetOutPin( pSource, 0 );
    pGrabPinIn   = GetInPin( pGrabberBase, 0 );
    pGrabPinOut  = GetOutPin( pGrabberBase, 0 );
    pNullPinIn  = GetInPin( pNull, 0 );

	CComPtr <ICaptureGraphBuilder2> pCaptB;
	pCaptB.CoCreateInstance(CLSID_CaptureGraphBuilder2);
	pCaptB->SetFiltergraph(pGraph);

	hr = pCaptB->FindInterface(&PIN_CATEGORY_CAPTURE,
		&MEDIATYPE_Video,pSource, 
		IID_IAMStreamConfig, (void**)&pConfig);
	if (hr!=S_OK) return false;

	SetResolution(iDevice, iResolution);
    // ... and connect them
    //
    hr = pGraph->Connect( pSourcePin, pGrabPinIn);
    if (hr!=S_OK) return false;
	
	hr = pGraph->Connect( pGrabPinOut, pNullPinIn );
	if (hr!=S_OK) return false;
	
	// Ask for the connection media type so we know its size
    //
    AM_MEDIA_TYPE mt;
	hr = pGrabber->GetConnectedMediaType( &mt );
	if (hr!=S_OK) return false;

    VIDEOINFOHEADER * vih = (VIDEOINFOHEADER*) mt.pbFormat;
    callback.im_width  = iWidth;
    callback.im_height = iHeight;
    FreeMediaType( mt );

	// Write the bitmap format
    //   
    memset( &(callback.cbInfo.bih), 0, sizeof( callback.cbInfo.bih ) );
    callback.cbInfo.bih.biSize = iWidth*iHeight*3;
    callback.cbInfo.bih.biWidth = iWidth;
    callback.cbInfo.bih.biHeight = iHeight;
    callback.cbInfo.bih.biPlanes = 1;
    callback.cbInfo.bih.biBitCount = 24;

	callback.cbInfo.pBuffer = new byte[callback.cbInfo.bih.biSize];
	    
	hr = pGrabber->SetBufferSamples( FALSE );
	hr = pGrabber->SetOneShot( FALSE );
    hr = pGrabber->SetCallback( &callback, 1);

	hr = pGraph->QueryInterface(IID_IMediaControl,(LPVOID *) &pControl);

	hr = pControl->Run( );

	cameraInitialized = true;
	return true;	
}
Example #22
0
	void Screen::SetWindowed(bool windowed)
	{
		int cx = GetFramebufferWidth();
		int cy = GetFramebufferHeight();
		SetResolution(cx, cy, !windowed);
	}
Example #23
0
void CMouseStat::Initialize()
{
  // Set the default resolution (PAL)
  SetResolution(720, 576, 1, 1);
}
Example #24
0
int ENGINEAPI EngineMain(TSTR *lp, int c)
{
    int exitcode=0;

    dwIconID = IDI_GAME;

    //ugh.
    //CoInitializeEx(NULL, 0);

    if(InitBase(TEXT("Game")))
    {
        DWORD newWidth, newHeight, newFreq;
        BOOL bUseFullscreen = AppConfig->GetInt(TEXT("Display"), TEXT("Fullscreen"));

        if(!bUseFullscreen)
        {
            DisplayMode currentMode;
            OSGetDisplaySettings(&currentMode);

            if(currentMode.dwBitsPerPixel != 32)
                ErrOut(TEXT("Your display settings must be set to 32bit mode."));
        }

        SS->SetEffectsVol(AppConfig->GetFloat(TEXT("Sound"), TEXT("EffectsVolume"), 1.0f));
        MM->SetVolume(AppConfig->GetFloat(TEXT("Sound"), TEXT("MusicVolume"), 1.0f));

        List<DisplayMode> DisplayModes;
        zero(&DisplayModes, 8);

        OSEnumDisplayModes(DisplayModes);

        newWidth  = AppConfig->GetInt(TEXT("Display"), TEXT("Width"));
        newHeight = AppConfig->GetInt(TEXT("Display"), TEXT("Height"));
        newFreq   = AppConfig->GetInt(TEXT("Display"), TEXT("Frequency"));

        BOOL bFoundDisplayMode = FALSE;
        DisplayMode mode;

        for(int i=0; i<DisplayModes.Num(); i++)
        {
            if( (DisplayModes[i].dwHeight == newHeight) &&
                (DisplayModes[i].dwWidth  == newWidth) )
            {
                if(DisplayModes[i].dwFrequency == newFreq)
                {
                    bFoundDisplayMode = TRUE;
                    mcpy(&mode, &DisplayModes[i], sizeof(DisplayMode));
                    break;
                }
            }
        }

        mode.dwBitsPerPixel = 32;

        if(!bFoundDisplayMode)
        {
            mode.dwFrequency = 60;
            mode.dwWidth     = 640;
            mode.dwHeight    = 480;
            Log(TEXT("Monitor does not support %dx%d resolution or doesn't support %d frequency"), newHeight, newWidth, newFreq);
        }

        SetResolution(mode, TRUE);

        if(bUseFullscreen)
            ToggleFullScreen();

        DisplayModes.Clear();

        float gamma      = AppConfig->GetFloat(TEXT("Display"), TEXT("Gamma"),      1.0f);
        float brightness = AppConfig->GetFloat(TEXT("Display"), TEXT("Brightness"), 1.0f);
        float contrast   = AppConfig->GetFloat(TEXT("Display"), TEXT("Contrast"),   1.0f);
        AdjustDisplayColors(gamma, brightness, contrast);

        GS->ClearColorBuffer();

        GameModule *module = (GameModule*)CreateFactoryObject(TEXT("MainGameModule"));
        if(!module)
            OSMessageBox(TEXT("Could not load the class 'MainGameModule'."));
        else
        {
            if(module->ModuleStartup(lp, c))
            {
                //loop
                exitcode = BaseLoop();

                module->ModuleExit();
            }

            DestroyObject(module);
        }

        TerminateBase();
    }

    //CoUninitialize();

    return 0;
}
Example #25
0
BOOL
bOutputHeader(
    PDEVDATA pdev
)

/*++

Routine Description:

    Send PostScript output header to the printer

Arguments:

    pdev - Pointer to our DEVDATA

Return Value:

    TRUE if successful, FALSE otherwise

--*/

{
    CHAR           *pstr;
    HPPD            hppd = pdev->hppd;
    ENG_TIME_FIELDS localtime;

    //
    // Process information in the public devmode fields and map it to printer
    // feature selections. This must be called before PsSelectPrinterFeatures.
    //

    HandlePublicDevmodeOptions(pdev);

    //
    // Spit out job control stuff at the beginning of a job if necessary
    //

    if (! bPageIndependence(pdev) &&
            ! (pdev->dm.dmPrivate.dwFlags & PSDEVMODE_NO_JOB_CONTROL))
    {
        if (PpdSupportsProtocol(hppd, PROTOCOL_PJL)) {

            // Universal exit language

            if (hppd->pJclBegin != NULL) {

                psputs(pdev, hppd->pJclBegin);
            } else {

                DBGMSG(DBG_LEVEL_TERSE, "No JCLBegin code.\n");
                psputs(pdev, "\033%-12345X");
            }

            // If the printer uses PJL commands to set resolution,
            // then do it before the job.

            SetResolution(pdev, pdev->dm.dmPublic.dmPrintQuality, RESTYPE_JCL);

            // Select printer specific features - JCLSetup

            PsSelectPrinterFeatures(pdev, ODS_JCLSETUP);

            // if the printer supports job switching, put the printer into
            // postscript mode now.

            if (hppd->pJclToPs != NULL) {

                psputs(pdev, hppd->pJclToPs);
            } else {

                DBGMSG(DBG_LEVEL_TERSE, "No JCLToPSInterpreter code.\n");
                psputs(pdev, "@PJL ENTER LANGUAGE=POSTSCRIPT\n");
            }

        } else if (PpdSupportsProtocol(hppd, PROTOCOL_SIC)) {

            // directly call pswrite to output the necessary escape commands.
            // psputs will NOT output '\000'.

            pswrite(pdev, "\033\133\113\030\000\006\061\010\000\000\000\000\000", 13);
            pswrite(pdev, "\000\000\000\000\000\000\000\000\004\033\133\113\003", 13);
            pswrite(pdev, "\000\006\061\010\004", 5);

        } else if (pdev->dm.dmPrivate.dwFlags & PSDEVMODE_CTRLD_BEFORE) {

            // send a ^D before the job

            pswrite(pdev, "\004", 1);
        }
    }

    psputs(pdev, "%!PS-Adobe-3.0\n");

    // output the title of the document.

    if (pdev->pwstrDocName) {

        CHAR    buf[128];

        CopyUnicode2Str(buf, pdev->pwstrDocName, 128);

        psprintf(pdev, "%%%%Title: %s\n", buf);
    } else
        psputs(pdev, "%%Title: Untitled Document\n");

    // let the world know who we are.

    psputs(pdev, "%%Creator: Windows NT 4.0\n");

    // print the date and time of creation.

    EngQueryLocalTime(&localtime);

    psprintf(pdev, "%%%%CreationDate: %d:%d %d/%d/%d\n",
             localtime.usHour,
             localtime.usMinute,
             localtime.usMonth,
             localtime.usDay,
             localtime.usYear);

    if (! (pdev->dwFlags & PDEV_EPSPRINTING_ESCAPE))
        psputs(pdev, "%%Pages: (atend)\n");

    // mark the bounding box of the document.

    psputs(pdev, "%%BoundingBox: ");

    psprintf(pdev, "%d %d %d %d\n",
             PSREAL2INT(pdev->CurForm.ImageArea.left),
             PSREAL2INT(pdev->CurForm.ImageArea.bottom),
             PSREAL2INT(pdev->CurForm.ImageArea.right),
             PSREAL2INT(pdev->CurForm.ImageArea.top));


    if (pdev->cCopies > 1)
        psprintf(pdev, "%%%%Requirements: numcopies(%d) collate\n", pdev->cCopies);

    DscLanguageLevel(pdev, pdev->hppd->dwLangLevel);
    DscOutputFontComments(pdev, FALSE);

    // we are done with the comments portion of the document.

    psputs(pdev, "%%EndComments\n");

    // If the printer uses exitserver commands to set
    // resolution, then do it before any other PS code.

    SetResolution(pdev, pdev->dm.dmPublic.dmPrintQuality, RESTYPE_EXITSERVER);

    // define our procedure set.

    if (!(pdev->dwFlags & PDEV_EPSPRINTING_ESCAPE)) {

        psputs(pdev, "%%BeginProlog\n");
        DownloadNTProcSet(pdev, TRUE);
        psputs(pdev, "%%EndProlog\n");
    }

    // do the device setup.

    psputs(pdev, "%%BeginSetup\n");

    // set job and wait timeout values

    SetTimeoutValues(pdev);

    // Set number of copies

    psprintf(pdev, "/#copies %d def\n", pdev->cCopies);

    // Select printer specific features - DocumentSetup and AnySetup

    PsSelectPrinterFeatures(pdev, ODS_DOCSETUP|ODS_ANYSETUP);

    // The implemention of EPSPRINTING escape here just follows Win31

    if ((pdev->dwFlags & PDEV_EPSPRINTING_ESCAPE) &&
            (pdev->dm.dmPublic.dmOrientation == DMORIENT_LANDSCAPE))
    {
        SetLandscape(pdev, TRUE, pdev->CurForm.PaperSize.height, pdev->CurForm.PaperSize.width);
    }

    //
    // Invert the default transfer function if Negative Output option is selected
    //

    if (pdev->dm.dmPrivate.dwFlags & PSDEVMODE_NEG) {

        psputs(pdev, "[currenttransfer /exec load {1 exch sub} /exec load] cvx settransfer\n");
    }

    psputs(pdev, "%%EndSetup\n");

    // the form-tray information has already been sent for the first page.

    pdev->dwFlags &= ~PDEV_RESETPDEV;

    return(TRUE);
}
void TiePieHS3::sample_after_external_trigger(double _rate, size_t _samples, double _sensitivity ,size_t _resolution) {
  ADC_Abort();
  /* set autoranging off */
  SetAutoRanging(Ch1,0);
  SetAutoRanging(Ch2,0);

  samples=_samples;
  if (samples==0 || _rate<=0) return;
  unsigned short int retval;
  //samples=1024*1024*1024; // impossible value... provoke error
  retval=SetRecordLength(samples);
  if (0!=retval) {
    char buffer[256];
    snprintf(buffer, sizeof(buffer), "could not set record length: SetRecrodLength(%d) returned %d", samples, retval);
    throw ADC_exception(std::string(buffer));
  }
  if (0!=SetPostSamples(samples)){
    throw ADC_exception("could not set post sample number");
  }
  fprintf(stderr,"set sample number to %d\n",samples);

  /* set sampling frequency */
  unsigned int freq=(unsigned int)fabs(floor(_rate)+0.5);
  unsigned int freq_req=freq;
  SetSampleFrequency(&freq_req);
  if (freq!=freq_req)
    throw ADC_exception("requested frequency could not be set");
  rate=freq_req;
  fprintf(stderr,"set rate to %g\n",rate);

  /* set resolution */
  if (0!=SetResolution(_resolution))
    throw ADC_exception("could not set resolution");
  unsigned char resolution_set;
  GetResolution(&resolution_set);
  if (_resolution!=resolution_set)
    throw ADC_exception("requested resolution not supported");
  resolution=_resolution;
  fprintf(stderr,"set resolution to %d\n",resolution);

#if 0
  /* set DC level value to zero */
  const double dclevel_req=-2.0;
  if (E_NO_ERRORS!=SetDcLevel(1, dclevel_req))
    throw ADC_exception("could not set dc level for channel 1");
  if (E_NO_ERRORS!=SetDcLevel(2, dclevel_req))
    throw ADC_exception("could not set dc level for channel 2");
#endif

  /* set input sensitivity for both channels */
  double sensitivity_req1=_sensitivity;
  SetSensitivity(1,&sensitivity_req1);
  double sensitivity_req2=_sensitivity;
  SetSensitivity(2,&sensitivity_req2);
  if (sensitivity_req1!=_sensitivity || sensitivity_req2!=_sensitivity)
    throw ADC_exception("requested sensitivity could not be set");
  sensitivity=_sensitivity;
  fprintf(stderr,"set sensitivity to %g\n",sensitivity);

  /* set input coupling to DC */
  if (0!=SetCoupling(Ch1, ctDC) || 0!=SetCoupling(Ch2, ctDC))
    throw ADC_exception("could not set coupling to dc");

  /* what to measure */
  if (E_NO_ERRORS!=SetMeasureMode(mmCh12))   /* Channel 1 and 2 */
    throw ADC_exception("could not set measurement mode");
  /* the trigger source */
  if (E_NO_ERRORS!=SetTriggerSource(tsExternal)) /* external trigger */
    throw ADC_exception("could not set trigger source");
  /* which slope to trigger */
  if (E_NO_ERRORS!=SetTriggerMode(tmRising))   /* 0=Rising slope */
    throw ADC_exception("could not set trigger source");
  /* set transfer mode */
  if (E_NO_ERRORS!=SetTransferMode(tmBlock))
    throw ADC_exception("could not set transfer mode");

  /* finally start the measurement */
  if (0!=ADC_Start())
    throw ADC_exception("could not start triggered adc measurement");
   fprintf(stderr,"started triggered adc measurement with %d samples, rate=%g, sensitivity=%g, resolution=%d\n",samples,rate,sensitivity,resolution);
}
Example #27
0
MultimediaClock::MultimediaClock(uint32 ms)
{
	Init();
	SetResolution(ms);
}
Example #28
0
void SetValue(CONTROL_ID id, double value)
{
    switch(id)
    {
	case CONTROL_WBR:
	{
		SetWBRed((int)value);
		break;
	}
	case CONTROL_WBG:
	{
		SetWBGreen((int)value);
		break;
	}
	case CONTROL_WBB:
	{
		SetWBBlue((int)value);
		break;
	}
	case CONTROL_EXPOSURE:
	{
		SetExposeTime(value);
		break;
	}
	case CONTROL_GAIN:
	{
		SetGain((unsigned short)value);
		break;
	}
	case CONTROL_OFFSET:
	{
		SetOffset((unsigned char)value);
		break;
	}
	case CONTROL_SPEED:
	{
		if((int)value)
			SetSpeed(true);
		else
			SetSpeed(false);
		break;
	}
	case CONTROL_USBTRAFFIC:
	{
		if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5II || qhyusb->QCam.CAMERA == DEVICETYPE_QHY5LII)
		{
		    SetUSBTraffic(value);
			
		    SetExposeTime(qhyusb->QCam.camTime);
		    SetGain(qhyusb->QCam.camGain);
		    if(qhyusb->QCam.isColor)
		    {
			SetWBRed(qhyusb->QCam.wbred);
			SetWBBlue(qhyusb->QCam.wbblue);
			SetWBGreen(qhyusb->QCam.wbgreen);
		    }
		}
		break;
	}
	case CONTROL_TRANSFERBIT:
	{
		SetTransferBit((int)value);
		break;
	}
	case CONTROL_ROWNOISERE:
	{
    		if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5II)
		{
		    if((int)value)
        	    	q5ii->QHY5II_DeNoise(true);
		    else
			q5ii->QHY5II_DeNoise(false);
		    SetResolution(qhyusb->QCam.cameraW,qhyusb->QCam.cameraH);
		}
		break;
	}
	case CONTROL_HDRMODE:
	{
		if((int)value)
		    q5lii->SetQHY5LIIHDR(true);
		else
		    q5lii->SetQHY5LIIHDR(false);
		if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5LII)
		{
		    if((int)value)
  			q5lii->SetQHY5LIIHDR(true);
		    else
		    {
			q5lii->SetQHY5LIIHDR(false);
			usleep(100000);
		   	q5lii->SetQHY5LIIHDR(true);
			usleep(100000);
		   	q5lii->SetQHY5LIIHDR(false);
			usleep(100000);
		    }
		}
		break;
	}
	case CONTROL_COOLER:
	{
		value = (value/100)*255;
		BeginCooler((unsigned char)value);
		break;
	}
    }	 
}
Example #29
0
void InitCamera(void)
{
    unsigned char buf[4];

    switch(qhyusb->QCam.CAMERA)
    {
        case DEVICETYPE_QHY5II:
	case DEVICETYPE_QHY5LII:
    	{
            qhyusb->qhyccd_vTXD(qhyusb->QCam.ccd_handle,0xc1,buf,4);
            SetUSBTraffic(30);
            SetSpeed(false);
            if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5LII)
            {
                SetResolution(1280,960);
                q5lii->SetExposureTime_QHY5LII(1000);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY5II)
            {
                SetResolution(1280,1024);
	        q5ii->SetExposureTime_QHY5II(1000);
            }
	    break;
    	}
        case DEVICETYPE_QHY6:
    	case DEVICETYPE_QHY9:
	case DEVICETYPE_IC8300:
        case DEVICETYPE_QHY11:
    	case DEVICETYPE_QHY22:
    	case DEVICETYPE_QHY21:
    	case DEVICETYPE_QHY23:
        {
    	    SetExposeTime(1000.0);
    	    SetGain(0);
    	    SetOffset(130);
    	    SetSpeed(false);
    	    if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY6)
            {
                SetResolution(800,298);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY9 || qhyusb->QCam.CAMERA == DEVICETYPE_IC8300)
            {
                SetResolution(3584,2574);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY11)
            {
                SetResolution(4096,2720);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY22)
            {
    	        SetResolution(3072,2240);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY21)
            {
    	        SetResolution(2048,1500);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY23)
            {
    	        SetResolution(3468,2728);
            }
            else if(qhyusb->QCam.CAMERA == DEVICETYPE_QHY16000)
            {
    	        SetResolution(4960,3328);
            }
	    break;
        }
        
    }
    InitOthers();
}