示例#1
0
QPixmap& MainWindow::loadLogo()
{
    QPixmap* logoOriginal = new QPixmap(":/logo.jpg");
    int logoWidth = logoOriginal->width();

    if (logoWidth > getScreenWidth() - 30)
    {
        QPixmap* logoScaled = new QPixmap();

        *logoScaled = logoOriginal->scaled(getScreenWidth() - 30, getScreenHeight(), Qt::KeepAspectRatio);
        return *logoScaled;
    }
    else return *logoOriginal;
}
示例#2
0
void Win32Factory::getMonitorInfo( int numScreen, int* p_x, int* p_y,
                                   int* p_width, int* p_height ) const
{
    HMONITOR hmon = NULL;
    std::list<HMONITOR>::const_iterator it = m_monitorList.begin();
    for( int i = 0; it != m_monitorList.end(); ++it, i++ )
    {
        if( i == numScreen )
        {
            hmon = *it;
            break;
        }
    }
    MONITORINFO mi;
    mi.cbSize = sizeof( MONITORINFO );
    if( hmon && GetMonitorInfo( hmon, &mi ) )
    {
        *p_x = mi.rcMonitor.left;
        *p_y = mi.rcMonitor.top;
        *p_width = mi.rcMonitor.right - mi.rcMonitor.left;
        *p_height = mi.rcMonitor.bottom - mi.rcMonitor.top;
    }
    else
    {
        *p_x = 0;
        *p_y = 0;
        *p_width = getScreenWidth();
        *p_height = getScreenHeight();
    }
}
示例#3
0
void X11Factory::getMonitorInfo( int numScreen,
                                 int* p_x, int* p_y,
                                 int* p_width, int* p_height ) const
{
    // initialize to default geometry
    *p_x = 0;
    *p_y = 0;
    *p_width = getScreenWidth();
    *p_height = getScreenHeight();

    // try to detect the requested screen via Xinerama
    if( numScreen >= 0 )
    {
        int num;
        Display *pDisplay = m_pDisplay->getDisplay();
        XineramaScreenInfo* info = XineramaQueryScreens( pDisplay, &num );
        if( info )
        {
            if( numScreen < num )
            {
                *p_x = info[numScreen].x_org;
                *p_y = info[numScreen].y_org;
                *p_width = info[numScreen].width;
                *p_height = info[numScreen].height;
            }
            XFree( info );
        }
    }
}
bool GameDriver::handleMouseMotion(float frameTime, const SDL_MouseMotionEvent& ev)
{
	if(mSteeringWithMouse) {
#if 0
		mSteering += ev.xrel * 0.01f;
		mThrottle -= mBrake;
		mThrottle -= ev.yrel * 0.01f;
		if(mThrottle < 0.0f) {
			mBrake = -mThrottle;
			mThrottle = 0.0f;
		}
#else
		mSteering = (ev.x / (float)getScreenWidth() * 2.0f) - 1.0f;
		float y = ((1.0f - ev.y / (float)getScreenHeight()) * 2.0f) - 1.0f;
		mThrottle = std::max(0.0f, y);
		mBrake = std::max(0.0f, -y);
#endif

		mSteering = Common::clamp(-1.0f, mSteering, 1.0f);
		mThrottle = Common::clamp(0.0f, mThrottle, 1.0f);
		mBrake = Common::clamp(0.0f, mBrake, 1.0f);
	}

	return false;
}
示例#5
0
文件: Gui.cpp 项目: eoma/totem-edk
void Gui::render()
{
	auto engine = Engine::getSingleton();
	auto player = engine->getPlayer();

	// clear the GUI console
    con->setDefaultBackground(TCODColor::black);
    con->clear();

	// mouse look
	renderMouseLook();

	// draw the health bar
	renderBar(1,1,BAR_WIDTH,"HP",player->getOwner()->get<float>("HP").get(), player->getOwner()->get<float>("MaxHP").get(), TCODColor::lightRed,TCODColor::darkerRed);

	// draw the message log
	int y=1;
	float colorCoef=0.4f;
	for (unsigned int i = 0; i < log.size(); i++)
	{
		auto message = log[i];
		con->setDefaultForeground(message->col * colorCoef);
		con->print(MSG_X,y,message->text.c_str());
		y++;
		if ( colorCoef < 1.0f )
			colorCoef+=0.3f;
	}

	// blit the GUI console on the root console
	TCODConsole::blit(con,0,0,engine->getScreenWidth(),PANEL_HEIGHT, TCODConsole::root,0,engine->getScreenHeight()-PANEL_HEIGHT);
}
示例#6
0
void Client::updateClientParameters(void)
{
	std::string string = "";
	// client-version
	string.append("client-version=").append(getVersion());
	
	// screen
	char screen[32];
	memset(screen, 0, 32);
	snprintf(screen, 32, "%dx%d", getScreenWidth(), getScreenHeight());
	string.append("&screen=").append(screen);
	
	// os
	std::string os = std::string(getSystemName()).append("/").append(getSystemVersion());
	UrlUtils::escape(os);
	string.append("&os=").append(os);
	
	// device
	std::string device = std::string(getDeviceModel()).append("/").append(getHardware());
	UrlUtils::escape(device);
	string.append("&device=").append(device);
	
	// imei
	string.append("&imei=").append(getDeviceIdentifier());
	
	m_sClientParameters = string;
}
SkinsRect OS2Factory::getWorkArea() const
{
    // TODO : calculate Desktop Workarea excluding WarpCenter

    // Fill a Rect object
    return  SkinsRect( 0, 0, getScreenWidth(), getScreenHeight());
}
void InputRemapperSystem::touchDown(float x, float y)
{
    TimeSystem* pTime = getSystem<TimeSystem>();
    const float time = pTime->getGameTime();

    Vector2 motion(x, y);
    int xAxis = GameButtons::BUTTON_leftAxisX;
    int yAxis = GameButtons::BUTTON_leftAxisY;
    if (x <= getScreenWidth() / 2)
    {
        motion -= getLeftThumbStickCenter();
    }
    else
    {
        motion -= getRightThumbStickCenter();
        xAxis = GameButtons::BUTTON_rightAxisX;
        yAxis = GameButtons::BUTTON_rightAxisY;
    }

    motion[0] = Clamp(motion[0], -getThumbStickRadius(), getThumbStickRadius());
    motion[1] = Clamp(motion[1], -getThumbStickRadius(), getThumbStickRadius());


    motion /= getThumbStickRadius();

    mButtons[xAxis]->updateDeflection(motion[0], time);
    mButtons[yAxis]->updateDeflection(motion[1], time);
}
示例#9
0
文件: main.cpp 项目: Emiluren/voxel
void render()
{
    // Render floor
    float ar = float(getScreenWidth()) / float(getScreenHeight());
    Vector3f camPos = camera->GetPosition();

    textured->Use(dirLight);

    for (int x = 0; x < ChunkManager::WORLD_SIZE_X; x++)
    {
        for (int z = 0; z < ChunkManager::WORLD_SIZE_Z; z++)
        {
            Matrix4f world = translate(x * 16, 0, z * 16) * scale(1.0f, 1.0f, 1.0f);
            Matrix4f wvp = persProj(ar, 0.1f, 100.0f, 45.0f) * camera->GetTransformation() * world;
            textured->SetWVP(wvp);
            textured->SetWorld(world);
            ChunkManager::getChunk(x, z)->Render(textured);
        }
    }

    checkGLErrors("render chunk");

    textured->StopUsing();

    glUseProgram(0);
}
示例#10
0
void CTDuelInvite::Show(){
	POINT pt;
	pt.x = (getScreenWidth() / 2) - (GetWidth() / 2);
	pt.y = (getScreenHeight() / 2) - (GetHeight() / 2);
	MoveWindow(pt);

	CTDialog::Show();
}
示例#11
0
void OS2Factory::getMonitorInfo( int numScreen, int* p_x, int* p_y,
                                   int* p_width, int* p_height ) const
{
    *p_x = 0;
    *p_y = 0;
    *p_width = getScreenWidth();
    *p_height = getScreenHeight();
}
示例#12
0
void X11Factory::getMonitorInfo( const GenericWindow &rWindow,
                                 int* p_x, int* p_y,
                                 int* p_width, int* p_height ) const
{
    // initialize to default geometry
    *p_x = 0;
    *p_y = 0;
    *p_width = getScreenWidth();
    *p_height = getScreenHeight();

    // Use Xinerama to determine the monitor where the video
    // mostly resides (biggest surface)
    Display *pDisplay = m_pDisplay->getDisplay();
    Window wnd = (Window)rWindow.getOSHandle();
    Window root = DefaultRootWindow( pDisplay );
    Window child_wnd;

    int x, y;
    unsigned int w, h, border, depth;
    XGetGeometry( pDisplay, wnd, &root, &x, &y, &w, &h, &border, &depth );
    XTranslateCoordinates( pDisplay, wnd, root, 0, 0, &x, &y, &child_wnd );

    int num;
    XineramaScreenInfo* info = XineramaQueryScreens( pDisplay, &num );
    if( info )
    {
        Region reg1 = XCreateRegion();
        XRectangle rect1 = { (short)x, (short)y, (unsigned short)w, (unsigned short)h };
        XUnionRectWithRegion( &rect1, reg1, reg1 );

        unsigned int surface = 0;
        for( int i = 0; i < num; i++ )
        {
            Region reg2 = XCreateRegion();
            XRectangle rect2 = { info[i].x_org, info[i].y_org,
                                 (unsigned short)info[i].width, (unsigned short)info[i].height };
            XUnionRectWithRegion( &rect2, reg2, reg2 );

            Region reg = XCreateRegion();
            XIntersectRegion( reg1, reg2, reg );
            XRectangle rect;
            XClipBox( reg, &rect );
            unsigned int surf = rect.width * rect.height;
            if( surf > surface )
            {
               surface = surf;
               *p_x = info[i].x_org;
               *p_y = info[i].y_org;
               *p_width = info[i].width;
               *p_height = info[i].height;
            }
            XDestroyRegion( reg );
            XDestroyRegion( reg2 );
        }
        XDestroyRegion( reg1 );
        XFree( info );
    }
}
示例#13
0
void OS2Factory::getMonitorInfo( const GenericWindow &rWindow,
                                 int* p_x, int* p_y,
                                 int* p_width, int* p_height ) const
{
    *p_x = 0;
    *p_y = 0;
    *p_width = getScreenWidth();
    *p_height = getScreenHeight();
}
示例#14
0
文件: config.cpp 项目: Xangis/magma
void displayEditConfigMenu(void)
{
  char strn[2048];


  _clearscreen(7,0);

  _settextposition(1, 1);

  sprintf(strn,
"&n&+gEditing miscellaneous config options\n"
"\n"
"   &+YA&+L.&n &+wCheck all vnums and vnum input to make sure they exist?   %s&n\n"
"   &+YB&+L.&n &+wUpon loading, check all .WLD zone flags vs. .ZON numb?    %s&n\n"
"\n"
"   &+YC&+L.&n &+wShow extra info about entity being edited on menus?       %s&n\n"
"   &+YD&+L.&n &+wEnable 'create room as you walk' creation?                %s&n\n"
"   &+YE&+L.&n &+wSave vnum of current room for reentrance when reloading?  %s&n\n"
"   &+YF&+L.&n &+wConsider exits with destinations of -1 out of zone?       %s&n\n"
"   &+YG&+L.&n &+wShow shop prices adjusted for mob's sell percentage?      %s&n\n"
"   &+YH&+L.&n &+wAutomatically save zone based on 'save when' below?       %s&n\n"
"   &+YI&+L.&n &+wIf autosave is on, save every X commands ...              %u&n\n"
"\n"
"   &+YJ&+L.&n &+wScreen height                                             %u&n\n"
"   &+YK&+L.&n &+wScreen width                                              %u&n\n"
"\n"
"   &+YL&+L.&n &+wExternal desc editor - '%s'&n\n"
"   &+YM&+L.&n &+wMenu prompt - '%s'&n\n"
"   &+YN&+L.&n &+wMain prompt - '%s'&n\n"
"\n"
MENU_COMMON
"\n"
"%s",
             getYesNoStrn(getVnumCheckVal()),
             getYesNoStrn(getCheckZoneFlagsVal()),

             getYesNoStrn(getShowMenuInfoVal()),
             getYesNoStrn(getWalkCreateVal()),
             getYesNoStrn(getStartRoomActiveVal()),
             getYesNoStrn(getNegDestOutofZoneVal()),
             getYesNoStrn(getShowPricesAdjustedVal()),
             getYesNoStrn(getSaveEveryXCommandsVal()),
             getSaveHowOftenVal(),

             getScreenHeight(),
             getScreenWidth(),

             getEditorName(),
             getMenuPromptName(),
             getMainPromptStrn(),

             getMenuPromptName());

  displayColorString(strn);
}
	void drawCenteredText(std::string text, int xOffset, int y, unsigned int color, Font* font)
	{
		int w, h;
		font->sizeText(text, &w, &h);

		int x = getScreenWidth() - w;
		x = x / 2;
		x += xOffset / 2;

		drawText(text, x, y, color, font);
	}
示例#16
0
void DrawEngine::stopOpenGL()
{
	if ( !mbGLEnable )
		return;

	mbGLEnable = false;

	RenderUtility::stopOpenGL();
	setupBuffer( getScreenWidth() , getScreenHeight() );
	mGLContext.cleanup();
}
示例#17
0
void TMMUI_TestApp::init() throw(int) {

    Rectangle *bg = new Rectangle(NULL, 0, 0, getScreenWidth(), getScreenHeight(), 1.0, 1.0, 1.0,1.0,1.0,1.0,1.0);
    getTenUI()->addDisplayObject(bg);

    initChildrenTest();
    //initLotsOfRectanglesTest();
    //initInteractiveRectangleTest();
    //initRectangleTest();
    //initLineTest();
    //initTextTest();
    //initRasterTest();
}
示例#18
0
void RunDuelCountdown(){
	clock_t dt = clock() - gDuelStart;
	gDuelCountdown = (dt / 1000);

	if(gDuelCountdown >= 0 && gDuelCountdown <= 10){
		int y = (getScreenHeight() / 4);
		int x = (getScreenWidth() / 2);

		int timer = CResourceMgr::GetInstance()->GetImageNID(IMAGE_RES_UI, "TIMER_0");
		ResetTransform(0, 0);
		DrawImpl::Instance()->Draw2D(x, y, IMAGE_RES_UI, timer + (10 - gDuelCountdown), 0xFFFFFFFF);
	} else
		gDuelCountdown = -1;
}
void DisplayWindowMupen64plus::_swapBuffers()
{
	// if emulator defined a render callback function, call it before buffer swap
	if (renderCallback != nullptr) {
		gfxContext.resetShaderProgram();
		if (config.frameBufferEmulation.N64DepthCompare == 0) {
			gfxContext.setViewport(0, getHeightOffset(), getScreenWidth(), getScreenHeight());
			gSP.changed |= CHANGED_VIEWPORT;
		}
		gDP.changed |= CHANGED_COMBINE;
		(*renderCallback)((gDP.changed&CHANGED_CPU_FB_WRITE) == 0 ? 1 : 0);
	}
	CoreVideo_GL_SwapBuffers();
}
void OGLVideoMupenPlus::_swapBuffers()
{
	// if emulator defined a render callback function, call it before buffer swap
	if (renderCallback != NULL) {
		glUseProgram(0);
		if (config.frameBufferEmulation.N64DepthCompare == 0) {
			glViewport(0, getHeightOffset(), getScreenWidth(), getScreenHeight());
			gSP.changed |= CHANGED_VIEWPORT;
		}
		gDP.changed |= CHANGED_COMBINE;
		(*renderCallback)((gDP.changed&CHANGED_CPU_FB_WRITE) == 0 ? 1 : 0);
	}
	CoreVideo_GL_SwapBuffers();
}
void NSRPopplerDocument::renderPage(int page)
{
	double dpix, dpiy;

	if (_doc == NULL || page > getNumberOfPages() || page < 1)
		return;

	_page = _catalog->getPage(page);

	if (isTextOnly()) {
		PDFRectangle	*rect;
		GooString	*text;
		TextOutputDev	*dev;

		dev = new TextOutputDev (0, gFalse, gFalse, gFalse);

		_doc->displayPageSlice(dev, _page->getNum(), 72, 72, 0, gFalse, gTrue, gFalse, -1, -1, -1, -1);

		rect = _page->getCropBox();
		text = dev->getText(rect->x1, rect->y1, rect->x2, rect->y2);
		_text = processText(QString::fromUtf8(text->getCString()));

		delete text;
		delete dev;
		_readyForLoad = true;

		return;
	}

	if (isZoomToWidth()) {
		double wZoom = ((double) getScreenWidth() / (double) _page->getCropWidth() * 100.0);
		setZoomSilent((int) wZoom);
	}

	if (getZoom() > getMaxZoom())
		setZoomSilent (getMaxZoom());
	else if (getZoom() < getMinZoom())
		setZoomSilent (getMinZoom());

	if (_readyForLoad)
		_dev->startPage(0, NULL);

	dpix = _dpix * getZoom() / 100.0;
	dpiy = _dpiy * getZoom() / 100.0;

	_page->display(_dev, dpix, dpiy, getRotation(), gFalse, gFalse, gTrue, _catalog);

	_readyForLoad = true;
}
示例#22
0
文件: Game.cpp 项目: vill0255/Final
void Game::paint()
{	

	//While the game is loading, the load method will be called once per update
	if (isLoading() == true)
	{
		//Cache the screen width and height
		float screenWidth = getScreenWidth();
		float screenHeight = getScreenHeight();

		//Draw a black background, you could replace this
		//in the future with a full screen background texture
		OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorBlack());
		OpenGLRenderer::getInstance()->drawRectangle(0.0f, 0.0f, screenWidth, screenHeight);

		//Calculate the bar width and height, don't actually hard-code these
		float barWidth = 200.0f * getScale();
		float barHeight = 40.0f * getScale();
		float barX = (screenWidth - barWidth) / 2.0f;
		float barY = (screenHeight - barHeight) / 2.0f;

		//
		float percentageLoaded = (float)m_LoadStep / (float)(GameLoadStepCount - 1);
		float loadedWidth = barWidth * percentageLoaded;
		OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorYellow());
		OpenGLRenderer::getInstance()->drawRectangle(barX, barY, loadedWidth, barHeight);

		//
		OpenGLRenderer::getInstance()->setForegroundColor(OpenGLColorWhite());
		OpenGLRenderer::getInstance()->drawRectangle(barX, barY, barWidth, barHeight, false);

		return;
	}

	OpenGLRenderer::getInstance()->drawTexture(m_BackgroundTexture,0.0f,0.0f);

#if _DEBUG
	if (m_World != NULL)
	{
		m_World->DrawDebugData();
	}
#endif

	//Paint the game's game objects
	for (int i = 0; i < m_GameObjects.size(); i++)
	{
		m_GameObjects.at(i)->paint();
	}
}
示例#23
0
void verifyTerminalSize(void)
{
        setScreenHeight(MIN_LINESIZE);
        setScreenWidth(MIN_COLUMNSIZE);
        
        if (FileOutput)
        {
                struct winsize ws;
                int FileOutputFD = fileno(FileOutput);
                
                if (ioctl(FileOutputFD, TIOCGWINSZ, &ws) < 0)
                {
                        fprintf(FileOutput, "La taille de votre terminal "
                                "doit faire au moins [%dx%d] et n'a pas pu etre determinee\n"
                                "Agrandissez maintenant la fenetre et appuyez sur ENTREE\n",
                                MIN_COLUMNSIZE, MIN_LINESIZE);
                        fflush(stdin);
                        getchar();     
                        fflush(stdin);
                        
                        setScreenHeight(MIN_LINESIZE);
                        setScreenWidth(MIN_COLUMNSIZE);
                }
                else
                {
                        fprintf(FileOutput, "La taille de votre terminal "
                                "doit faire au moins [%dx%d] et fait actuellement [%dx%d]\n"
                                "Agrandissez maintenant la fenetre et appuyez sur ENTREE\n",
                                MIN_COLUMNSIZE, MIN_LINESIZE,
                                ws.ws_col, ws.ws_row);
                        fflush(stdin);
                        getchar();     
                        fflush(stdin);
                        
                        
                        ioctl(FileOutputFD, TIOCGWINSZ, &ws);
                        
                        setScreenHeight(ws.ws_row);
                        setScreenWidth(ws.ws_col);
                        
                        fprintf(FileOutput, "La taille de votre terminal "
                                "enregistrée est : [%dx%d].\nLancement dans 1 seconde...\n",
                                getScreenWidth(), getScreenHeight());
                        sleep(1);       
                }
        }
}
示例#24
0
文件: GUI.cpp 项目: smistad/FAST
GUI::GUI() {

    IGTLinkStreamer::pointer streamer = IGTLinkStreamer::New();

    setWidth(getScreenWidth());
    setHeight(getScreenHeight());
    enableMaximized();
    setTitle("FAST Neural Network Despeckling");

    auto resizer = ImageResizer::New();
    resizer->setInputConnection(streamer->getOutputPort());
    resizer->setWidth(512);
    resizer->setHeight(512);

    UltrasoundImageEnhancement::pointer enhancer1 = UltrasoundImageEnhancement::New();
    enhancer1->setInputConnection(resizer->getOutputPort());
    ImageRenderer::pointer renderer1 = ImageRenderer::New();
    renderer1->addInputConnection(enhancer1->getOutputPort());
    View* viewOrig = createView();
    viewOrig->setBackgroundColor(Color::Black());
    viewOrig->set2DMode();
    viewOrig->addRenderer(renderer1);


    ImageToImageNetwork::pointer network = ImageToImageNetwork::New();
    network->load("/home/smistad/Downloads/filname_test.pb");
    network->addOutputNode(0, "activation_8/Tanh:0", NodeType::TENSOR);
    network->setSignedInputNormalization(true);
    network->setScaleFactor(1.0f/255.0f);
    network->setInputConnection(streamer->getOutputPort());

    UltrasoundImageEnhancement::pointer enhancer2 = UltrasoundImageEnhancement::New();
    enhancer2->setInputConnection(network->getOutputPort());
    ImageRenderer::pointer renderer2 = ImageRenderer::New();
    renderer2->addInputConnection(enhancer2->getOutputPort());
    View* view = createView();
    view->setBackgroundColor(Color::Black());
    view->set2DMode();
    view->addRenderer(renderer2);


    QHBoxLayout* layout = new QHBoxLayout;
    layout->addWidget(viewOrig);
    layout->addWidget(view);
    mWidget->setLayout(layout);
}
void InputRemapperSystem::touchUp(float x, float y)
{
    TimeSystem* pTime = getSystem<TimeSystem>();
    const float time = pTime->getGameTime();

    if (x <= getScreenWidth() / 2)
    {
        mButtons[GameButtons::BUTTON_leftAxisX]->release(time);
        mButtons[GameButtons::BUTTON_leftAxisY]->release(time);
    }
    else
    {
        mButtons[GameButtons::BUTTON_rightAxisX]->release(time);
        mButtons[GameButtons::BUTTON_rightAxisY]->release(time);
    }

}
bool ApplicationWin32Imp::createWindow()
{
    if( isWindowCreated() ) return false;

    hInstance_ = ( HINSTANCE )GetModuleHandle( NULL );

    if( false == MyRegisterClass( hInstance_ ) )
        return false;

    const int x = getScreenX();
    const int y = getScreenY();
    const int width = getScreenWidth();
    const int height = getScreenHeight();
    hWnd_ = InitInstance( hInstance_, SW_SHOW, x, y, width, height );

    return NULL != hWnd_;
}
示例#27
0
bool DrawEngine::startOpenGL( bool useGLEW )
{
	if ( mbGLEnable )
		return true;

	setupBuffer( getScreenWidth() , getScreenHeight() );
	if ( !mGLContext.init( getWindow().getHDC() , WGLContext::InitSetting() ) )
		return false;

	if ( glewInit() != GLEW_OK )
		return false;

	RenderUtility::startOpenGL();
	mbGLEnable = true;

	return true;
}
void ApplicationWin32Imp::start() {
    if( false == createWindow() )
        throw exception();

    render_->setHWND( getHWND() );

    if( false == render_->createDevice( isWindowedMode(), getScreenWidth(), getScreenHeight() ) ) {
        destroyWindow();
        throw exception();
    }

    mainLoop();

    render_->destroyDevice();

    destroyWindow();
}
示例#29
0
void DrawEngine::setupBuffer( int w , int h )
{
	if ( mbGLEnable )
	{
		int bitsPerPixel = GetDeviceCaps( getWindow().getHDC() , BITSPIXEL );

		switch (bitsPerPixel) 
		{
		case 8:
			/* bmiColors is 256 WORD palette indices */
			//bmiSize += (256 * sizeof(WORD)) - sizeof(RGBQUAD);
			break;
		case 16:
			/* bmiColors is 3 WORD component masks */
			//bmiSize += (3 * sizeof(DWORD)) - sizeof(RGBQUAD);
			break;
		case 24:
		case 32:
		default:
			/* bmiColors not used */
			break;
		}

		BITMAPINFO bmpInfo;
		bmpInfo.bmiHeader.biSize     = sizeof(BITMAPINFOHEADER);
		bmpInfo.bmiHeader.biWidth    = getScreenWidth();
		bmpInfo.bmiHeader.biHeight   = getScreenHeight();
		bmpInfo.bmiHeader.biPlanes   = 1;
		bmpInfo.bmiHeader.biBitCount = bitsPerPixel;
		bmpInfo.bmiHeader.biCompression = BI_RGB;
		bmpInfo.bmiHeader.biXPelsPerMeter = 0;
		bmpInfo.bmiHeader.biYPelsPerMeter = 0;
		bmpInfo.bmiHeader.biSizeImage = 0;


		if ( !mBufferDC->create( getWindow().getHDC() , &bmpInfo ) )
			return;
	}
	else
	{
		mBufferDC->create( getWindow().getHDC() , w , h );
	}

	mScreenGraphics->setTargetDC( mBufferDC->getDC() );
}
示例#30
0
void OBEngine::init()
{
	m_screenW = getScreenWidth();
	m_screenH = getScreenHeight();

	// init the font
	m_font.init("smallfont.png", "smallfont.font");

	// init graphics metrics
	double r = MARS_APOGEE*1.05;
	double width = r*2.0;
	m_kmPerPixel = width/(double)m_screenW;

	// start off centered at 0,0
	m_center.setXY(0.0, 0.0);

	// sun and earth
	FGDoubleVector pos;
	FGDoubleVector vel;

	// the sun is in the middle and doesn't move
	pos.setXY(0.0, 0.0);
	vel.setXY(0.0, 0.0);
	m_sun.initOrbitee(SUN_SGP, pos, 0xffffff, 8);

	// start the planets
	m_venus.initOrbiter(&m_sun, VENUS_APOGEE, VENUS_APOGEE_VEL, VENUS_AOP, 0xffff7f, 1);
	m_earth.initOrbiter(&m_sun, EARTH_APOGEE, EARTH_APOGEE_VEL, EARTH_AOP, 0x7f7fff, 1);
	m_mars.initOrbiter(&m_sun, MARS_APOGEE, MARS_APOGEE_VEL, MARS_AOP, 0xff7f7f, 1);

	/************ PATHS *****************/
	// July 7, 2035
	m_venusPath.initNoAcc(&m_venus, 1.4623927498);
	m_earthPath.initNoAcc(&m_earth, 4.9745875522);
	m_marsPath.initNoAcc(&m_mars, 5.4429575522);
	m_ship.init(&m_sun, m_earthPath.m_startPos, m_earthPath.m_startVel, 0x7f7f7f, 5);

	// internals
	m_hoverPathPointIdx = -1;
	m_hoverAccelPoint = NULL;
	m_uiMode = UI_INERT;
	m_bShowVenus = false;
}