• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Window类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Window的典型用法代码示例。如果您正苦于以下问题:C++ Window类的具体用法?C++ Window怎么用?C++ Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Window类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getWindow

co::CommandQueue* Channel::getCommandThreadQueue()
{
    Window* window = getWindow();
    LBASSERT( window );
    return window->getCommandThreadQueue();
}
开发者ID:whimlex,项目名称:Equalizer,代码行数:6,代码来源:channel.cpp


示例2: elm_main

EAPI_MAIN int elm_main(int argc, char **argv)
{
	Window window;
	WindowListener windowListener;

	window.create();

	window.setListener( &windowListener );

	MainContent mainContent( window.getEvasObject() );

	window.setContentLayout( mainContent.getLayout() );

	DrawingContent drawingContent( window.getEvasObject(), mainContent.getLayout() );

	GraphicObjectsContrucor::getInstance().setCanvas( drawingContent.getDrawingCanvas() );

	ToolbarContent toolbar( mainContent.getLayout() );
	{
		string title( "Save objects" );
		ToolbarContentButtonParams * params = new ToolbarContentButtonParams( title, on_save_objects, NULL );
		ToolbarContentItem * item = new ToolbarContentButton( *params );

		toolbar.addToolbarContentItem( *item );
	}

	{
		string title( "Sceleton Mode" );
		ToolbarContentRadioParams * params2 = new ToolbarContentRadioParams( title, on_sceleton_mode, &drawingContent, NULL, true );
		ToolbarContentItem * item2 = new ToolbarContentRadio( *params2 );

		toolbar.addToolbarContentItem( *item2 );

		title = "Run simulation";
		ToolbarContentRadioParams * params3 = new ToolbarContentRadioParams( title, on_run_simulation, &drawingContent, item2->getEvas(), false );
		ToolbarContentItem * item3 = new ToolbarContentRadio( *params3 );

		toolbar.addToolbarContentItem( *item3 );
	}
	{
		string title( "Test objects" );
		ToolbarContentButtonParams * params = new ToolbarContentButtonParams( title, on_construct_test_objects, &drawingContent );
		ToolbarContentItem * item = new ToolbarContentButton( *params );

		toolbar.addToolbarContentItem( *item );
	}
	{
		string title( "Clear" );
		ToolbarContentButtonParams * params = new ToolbarContentButtonParams( title, on_clear_objects, &drawingContent );
		ToolbarContentItem * item = new ToolbarContentButton( *params );

		toolbar.addToolbarContentItem( *item );
	}

	GeometrySceletonOperationTracking geoSceletonObjectTracking( drawingContent );
	SimulationOperationTracking   geoEditingObjectTracking( drawingContent );

	MouseListener mouseListener( NULL, drawingContent.getDrawingCanvas() );

	MouseTrackerManager::getInstance().setMouseListener( &mouseListener );
	MouseTrackerManager::getInstance().addTracker( &geoSceletonObjectTracking );
	MouseTrackerManager::getInstance().addTracker( &geoEditingObjectTracking );

	MouseTrackerManager::getInstance().setMouseListenerTrackerMode( SCELETON_MODE_E );

	window.setMaxSize( 800, 600 );

	srand( time ( 0 ) );

	elm_run();
	return 0;
}
开发者ID:virtual-creature,项目名称:sceleton_constructor,代码行数:72,代码来源:elm_dialog.cpp


示例3: onCancel

void LoadSaveWindow::onCancel() {
	Window* pParentWindow = dynamic_cast<Window*>(getParent());
	if(pParentWindow != NULL) {
		pParentWindow->closeChildWindow();
	}
}
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:6,代码来源:LoadSaveWindow.cpp


示例4: OSG_ASSERT

void WindowDrawTask::execute(HardwareContext *pContext, DrawEnv *pEnv)
{
    Window *pWindow = pEnv->getWindow();

    OSG_ASSERT(pWindow != NULL);

    switch(_uiTypeTask)
    {
        case Init:
        {
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "Init\n");
            fflush(stderr);
#endif
            if(_bCreatePrivateContext == true)
                pWindow->init();

            pWindow->doActivate   ();
            pWindow->doFrameInit  (_bReinitExtFunctions);
            pWindow->setupGL      ();
            pWindow->setOpenGLInit();

            if(_oInitFunc)
            {
                _oInitFunc();
            }
        }
        break;

        case Activate:
        {
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "Activate\n");
            fflush(stderr);
#endif
            pWindow->doActivate();
        }
        break;

        case FrameInit:
        {
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "FrameInit\n");
            fflush(stderr);
#endif

            pWindow->doFrameInit();
        }
        break;

        case FrameExit:
        {
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "FrameExit\n");
            fflush(stderr);
#endif
            pWindow->doFrameExit();

            commitChangesAndClear();
        }
        break;

        case WaitAtBarrier:
        {
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "WaitAtBarrier\n");
            fflush(stderr);
#endif
            OSG_ASSERT(_pBarrier != NULL);
            _pBarrier->enter();
        }
        break;

        case DeactivateAndWait:
        {
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "DeactivateAndWait\n");
            fflush(stderr);
#endif
            pWindow->doDeactivate();

            OSG_ASSERT(_pBarrier != NULL);
            _pBarrier->enter();
        }
        break;

        case Swap:
        {           
#ifdef OSG_DUMP_WINTASK
            fprintf(stderr, "Swap\n");
            fflush(stderr);
#endif
            pWindow->doSwap();

#ifdef OSG_SWAP_BARRIER
            OSG_ASSERT(_pBarrier != NULL);

            _pBarrier->enter();
#endif
        }
//.........这里部分代码省略.........
开发者ID:baibaiwei,项目名称:OpenSGDevMaster,代码行数:101,代码来源:OSGWindowDrawTask.cpp


示例5: match

 uint64_t match(Window aWin) { return aWin->WindowID(); }
开发者ID:luke-chang,项目名称:gecko-1,代码行数:1,代码来源:WebExtensionPolicy.cpp


示例6: getUrl

QUrl WindowsManager::getUrl() const
{
	Window *window = m_mainWindow->getWorkspace()->getActiveWindow();

	return (window ? window->getUrl() : QUrl());
}
开发者ID:insionng,项目名称:otter-browser,代码行数:6,代码来源:WindowsManager.cpp


示例7: WinMain

//Entry point of the program
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)
{
    //Create a window
    cWindow = Window(WindowProcedure, hThisInstance, "MealTrackApp", nCmdShow);
    cWindow.Create("MealTrack - Untitled", 462, 375);

    //Actually create the button with the window as its parent
    RECT rEditBox = {16, 280, 272, 24};
    cEditBox = EditBox(cWindow, rEditBox, "Disconnected");
    cEditBox.SetReadOnly(1);

    //Create the Button
    RECT rButton = {304, 280, 128, 24};
    cButton = Button(cWindow, rButton, "Start Meal", IDR_START_BUTTON);
    cButton.SetEnabled(0);

    //Create the listbox
    RECT rListBox = {16, 16, 272, 272};
    cListBox = ListBox(cWindow, rListBox, "MealListBox");

    //Meal wait box
    RECT rLabelDelay = {304, 16, 128, 16};
    RECT rEditDelay = {304, 32, 128, 24};
    cLabelDelay = Label(cWindow, rLabelDelay, "Meal wait (seconds)");
    cEditDelay = EditBox(cWindow, rEditDelay, "10");

    //Create Date format box
    RECT rLabelDate = {304, 64, 128, 16};
    RECT rComboDate = {304, 80, 128, 24};
    cLabelDate = Label(cWindow, rLabelDate, "Date format");
    cComboDate = ComboBox(cWindow, rComboDate, "ComboBoxDate");
    cComboDate.AddItem("12 Hour AM/PM");
    cComboDate.AddItem("24 Hour");
    cComboDate.SetDefaultItem(1);

    //Record format box
    RECT rLabelRecord = {304, 112, 128, 16};
    RECT rComboRecord = {304, 128, 128, 24};
    cLabelRecord = Label(cWindow, rLabelRecord, "Record change type");
    cComboRecord = ComboBox(cWindow, rComboRecord, "ComboBoxRecord");
    cComboRecord.AddItem("Increases");
    cComboRecord.AddItem("Decreases");
    cComboRecord.AddItem("Both");
    cComboRecord.SetDefaultItem(1);

    //Record format box
    RECT rLabelSensitivity = {304, 160, 128, 16};
    RECT rComboSensitivity = {304, 176, 128, 24};
    cLabelSensitivity = Label(cWindow, rLabelSensitivity, "Sensitivity");
    cComboSensitivity = ComboBox(cWindow, rComboSensitivity, "ComboBoxSensitivity");
    cComboSensitivity.AddItem("0.01 g");
    cComboSensitivity.AddItem("0.02 g");
    cComboSensitivity.AddItem("0.03 g");
    cComboSensitivity.AddItem("0.04 g");
    cComboSensitivity.AddItem("0.05 g");
    cComboSensitivity.AddItem("0.06 g");
    cComboSensitivity.AddItem("0.07 g");
    cComboSensitivity.AddItem("0.08 g");
    cComboSensitivity.AddItem("0.09 g");
    cComboSensitivity.SetDefaultItem(2);

    //Custom function to creeate window
    CreateWindowMenu(cWindow);

    //Message loop
    MSG msg;
    while (cWindow.GetMessage(&msg))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // The program return-value is 0 - The value that PostQuitMessage() gave
    return msg.wParam;
}
开发者ID:kirkbackus,项目名称:meal-track,代码行数:76,代码来源:main.cpp


示例8: glClearDepth

bool ClientEngine::initialize()
{
	// Setup Window
	m_Window.setName("void");
	
	// Connect to server
	ENetAddress address;
	if(enet_address_set_host(&address, "localhost") != 0)
		return false;
	address.port = 1234;
	if(!m_Client.connect(&address))
		return false;
	
	// Setup Resource Manager
	m_ResourceManager.registerResourceType<Texture2dFile>(RES_TEXTURE2D);
	
	// Setup OpenGL
	glClearDepth(1);
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
	
	// Setup camera
	m_Camera.setNear(0.1);
	m_Camera.setFar(100);
	m_Camera.setRotation(Quaternion(vec3f(1,0,0), -tools4k::Pi*0.5));
	m_Camera.setScreen(m_Window.size());
	m_Camera.setFov(90);
	
	// Setup shader
	if(!m_Shader.load("Shader.vert", "Shader.frag"))
		return false;
	m_Shader.setUniform("DiffuseMap", 0);
	
	// Setup map
	{
		int myTileMap = m_ClientMap.createTileMap();
		TileMap* tm = m_ClientMap.getTileMap(myTileMap);
		tm->diffuse = (Texture2dFile*)m_ResourceManager.loadResource(RES_TEXTURE2D, "tileset.png");
		tm->tileSize = 32;
		tm->width = 128;
		
		int id = m_ClientMap.createVoxelType("Rock");
		VoxelType* vt = m_ClientMap.getVoxelType(id);
		vt->collisionShape = VCSHAPE_CUBE;
		
		ClientVoxelType* cvt = m_ClientMap.getClientVoxelType(id);
		cvt->mesh = VCSHAPE_CUBE;
		cvt->renderMode = VRENDER_SOLID;
		cvt->tileMap = myTileMap;
		memset(cvt->faces, 0, sizeof(cvt->faces));
		cvt->faces[VFACE_BACK] = 1;
		cvt->faces[VFACE_TOP] = 4;
		
		Voxel voxel;
		voxel.typeId = id;
		m_ClientMap.setVoxel(vec3i(0,0,0), voxel);
		m_ClientMap.setVoxel(vec3i(1,1,1), voxel);
		
		m_ClientMap.updateModel(aabb3i(vec3i(0,0,0), vec3i(10,10,10)));
	}
	
	if(!loadPackage("Base"))
		return false;
	
	return true;
}
开发者ID:henry4k,项目名称:void,代码行数:67,代码来源:Main.cpp


示例9: main

int main(int argc, char* args[]) {
	Window window;

	if(!window.init()) {
		printf("Failed to initialise SDL and/or game window.\n");
		}

	else {
		Board board;

		if(!board.init()) {
			printf("Failed to intitialise board instance.\n");
		}

		else {
			GameController game_controller;

			if(!game_controller.init(board)) {
				printf("Failed to initialise game controller.\n");
			}

			else {
				// Draw initial board state to screen
				window.draw(board.board_tiles, 0);

				///////////////////////////
				///		 Main Loop      ///
				///////////////////////////
				bool quit = false;
				SDL_Event e;
				int pos_x, pos_y; //UNUSED: Maybe move SDL out to a higher level?
				std::set<Tile*> tiles_to_draw;
				Uint32 start_time = SDL_GetTicks();
				Uint32 current_time = start_time;
				Uint32 time_last_frame;
				Uint32 time_between_frames;
				
				int counted_frames = 0;
		
				while (!quit) {
					/// Frame Rate Cap ///
					time_last_frame = current_time;
					current_time = SDL_GetTicks();
					time_between_frames = current_time - time_last_frame;
					if (time_between_frames <= MINIMUM_FRAME_DURATION)
						SDL_Delay(MINIMUM_FRAME_DURATION - time_between_frames);
					
					/*
					if (current_time - start_time >= 1000) {
						printf("Frame Rate: %d\n", counted_frames);
						start_time = SDL_GetTicks();
						counted_frames = 0;
					}
					++counted_frames;
					*/

					switch(game_controller.phase) {

/*-->*/				case GameController::TILE_CLAIM:

						/// Highlight Hovered Over Tile ///
						board.tileInFocus = board.findTileInFocus();
						if (board.getUID(*board.tileInFocus) != board.getUID(*board.prevTileInFocus)) {
							if (board.getUID(*board.prevTileInFocus) != 0) { // 0->Invalid(NULL)
								window.drawUnhighlight(*board.prevTileInFocus);
							}
							if(board.getUID(*board.tileInFocus) != 0) {
								window.drawHighlight(*board.tileInFocus);
							}
							board.prevTileInFocus = board.tileInFocus;
						}
					
						/// User Event Handling ///
						while (SDL_PollEvent(&e) != 0) {       
							if (e.type == SDL_QUIT) {
								quit = true;
							}
							else if (e.button.type == SDL_MOUSEBUTTONUP) {
								game_controller.eventClick(board.tileInFocus, e.button);
								window.drawHighlight(*board.tileInFocus);
							}
							else if (e.type == SDL_KEYUP) { 
								if (e.key.keysym.sym == SDLK_SPACE) {
									window.drawUnhighlight(*board.tileInFocus);
									// END TURN
									game_controller.claimMarkedTiles();
									window.draw(*game_controller.current_player_prev_claimed, 0);
									// CHANGE STATE
									game_controller.phase = GameController::TERRITORY_EXPAND;
									game_controller.generateTilesToCheck(&board, *game_controller.current_player_prev_claimed);
									game_controller.current_player_prev_claimed->clear();
								}
								else if (e.key.keysym.sym == SDLK_r) { // Reset game
									for(auto it=board.board_tiles.begin(); it!=board.board_tiles.end(); ++it) {
										if (it->owner != Tile::UNOWNABLE) 
											it->owner = Tile::NEUTRAL;
									}
									game_controller.reset();
									window.draw(board.board_tiles, 0);
									window.drawHighlight(*board.tileInFocus);
//.........这里部分代码省略.........
开发者ID:Matidy,项目名称:1-col,代码行数:101,代码来源:main.cpp


示例10: test_hover2

void test_hover2 (void *data, Evas_Object *obj, void *event_info)
{
  Box *bx = NULL;
  Button *bt = NULL;

  Window *win = Window::factory ("hover2", ELM_WIN_BASIC);
  win->setTitle ("Hover 2");
  win->setAutoDel (true);

  Background *bg = Background::factory (*win);
  win->addObjectResize (*bg);
  bg->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  bg->show ();

  bx = Box::factory (*win);
  bx->setWeightHintSize (EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  win->addObjectResize (*bx);
  bx->show ();

  Hover *hv = Hover::factory (*win);
  hv->setStyle ("popout");

  bt = Button::factory (*win);
  bt->setText ("Button");
  bt->getEventSignal ("clicked")->connect (sigc::bind (sigc::ptr_fun (&my_hover_bt), hv));
  bx->packEnd (*bt);
  bt->show ();
  hv->setParent (*win);
  hv->setTarget (*bt);

  bt = Button::factory (*win);
  bt->setText ("Popup");
  hv->setContent ("middle", *bt);
  bt->show ();

  bx = Box::factory (*win);

  Icon *ic = Icon::factory (*win);
  ic->setFile (searchPixmapFile ("elementaryxx/logo_small.png"));
  ic->setNoScale (true);
  bx->packEnd (*ic);
  ic->show ();

  bt = Button::factory (*win);
  bt->setText ("Top 1");
  bx->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Top 2");
  bx->packEnd (*bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Top 3");
  bx->packEnd (*bt);
  bt->show ();

  bx->show ();

  hv->setContent ("top", *bx);

  bt = Button::factory (*win);
  bt->setText ("Bot");
  hv->setContent ("bottom", *bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Left");
  hv->setContent ("left", *bt);
  bt->show ();

  bt = Button::factory (*win);
  bt->setText ("Right");
  hv->setContent ("right", *bt);
  bt->show ();

  bg->setMinHintSize (size160x160);
  bg->setMaxHintSize (size640x640);
  win->resize (size320x320);
  win->show ();
}
开发者ID:Limsik,项目名称:e17,代码行数:82,代码来源:test_hover.cpp


示例11: glViewport

void ClientEngine::onResizeWindow( Window* wnd )
{
	glViewport(0, 0, m_Window.size().x, m_Window.size().y);
	m_Camera.setScreen(m_Window.size());
}
开发者ID:henry4k,项目名称:void,代码行数:5,代码来源:Main.cpp


示例12: main

int main(int argc, char* argv[])
{
	unsigned int width = 0;
	unsigned int height = 0;
	if(argc > 1)
	{
		for(int i = 1; i < argc; i++)
		{
			if(strcmp(argv[i], "-w") == 0)
			{
				width = atoi(argv[i + 1]);
				i++; //skip the argument value
			}else if(strcmp(argv[i], "-h") == 0)
			{
				height = atoi(argv[i + 1]);
				i++; //skip the argument value
			}else if(strcmp(argv[i], "--gamelist-only") == 0)
			{
				PARSEGAMELISTONLY = true;
			}else if(strcmp(argv[i], "--ignore-gamelist") == 0)
			{
				IGNOREGAMELIST = true;
			}else if(strcmp(argv[i], "--draw-framerate") == 0)
			{
				DRAWFRAMERATE = true;
			}else if(strcmp(argv[i], "--no-exit") == 0)
			{
				DONTSHOWEXIT = true;
			}else if(strcmp(argv[i], "--debug") == 0)
			{
				DEBUG = true;
				Log::setReportingLevel(LogDebug);
			}else if(strcmp(argv[i], "--dimtime") == 0)
			{
				DIMTIME = atoi(argv[i + 1]) * 1000;
				i++; //skip the argument value
			}else if(strcmp(argv[i], "--windowed") == 0)
			{
				WINDOWED = true;
			}else if(strcmp(argv[i], "--help") == 0)
			{
				std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";
				std::cout << "Command line arguments:\n";
				std::cout << "-w [width in pixels]		set screen width\n";
				std::cout << "-h [height in pixels]		set screen height\n";
				std::cout << "--gamelist-only			skip automatic game detection, only read from gamelist.xml\n";
				std::cout << "--ignore-gamelist		ignore the gamelist (useful for troubleshooting)\n";
				std::cout << "--draw-framerate		display the framerate\n";
				std::cout << "--no-exit			don't show the exit option in the menu\n";
				std::cout << "--debug				even more logging\n";
				std::cout << "--dimtime [seconds]		time to wait before dimming the screen (default 30, use 0 for never)\n";

				#ifdef _DESKTOP_
					std::cout << "--windowed			not fullscreen\n";
				#endif

				std::cout << "--help				summon a sentient, angry tuba\n\n";
				std::cout << "More information available in README.md.\n";
				return 0;
			}
		}
	}

	#ifdef _RPI_
		bcm_host_init();
	#endif

	bool running = true;

	//make sure the config directory exists
	std::string home = getHomePath();
	std::string configDir = home + "/.emulationstation";
	if(!fs::exists(configDir))
	{
		std::cout << "Creating config directory \"" << configDir << "\"\n";
		fs::create_directory(configDir);
	}

	//start the logger
	Log::open();

	//the renderer also takes care of setting up SDL for input and sound
	bool renderInit = Renderer::init(width, height);
	if(!renderInit)
	{
		std::cerr << "Error initializing renderer!\n";
		Log::close();
		return 1;
	}


	//initialize audio
	AudioManager::init();

	Window window; //don't call Window.init() because we manually pass the resolution to Renderer::init
	window.getInputManager()->init();

	//try loading the system config file
	if(!fs::exists(SystemData::getConfigPath())) //if it doesn't exist, create the example and quit
	{
//.........这里部分代码省略.........
开发者ID:nito76130,项目名称:EmulationStation,代码行数:101,代码来源:main.cpp


示例13: isImageFetchedFromProperty

    void ImageryComponent::render_impl(Window& srcWindow, Rect& destRect, const CEGUI::ColourRect* modColours, const Rect* clipper, bool /*clipToDisplay*/) const
    {
        // get final image to use.
        const Image* img = isImageFetchedFromProperty() ?
            PropertyHelper::stringToImage(srcWindow.getProperty(d_imagePropertyName)) :
            d_image;

        // do not draw anything if image is not set.
        if (!img)
            return;

        HorizontalFormatting horzFormatting = d_horzFormatPropertyName.empty() ? d_horzFormatting :
            FalagardXMLHelper::stringToHorzFormat(srcWindow.getProperty(d_horzFormatPropertyName));

        VerticalFormatting vertFormatting = d_vertFormatPropertyName.empty() ? d_vertFormatting :
            FalagardXMLHelper::stringToVertFormat(srcWindow.getProperty(d_vertFormatPropertyName));

        uint horzTiles, vertTiles;
        float xpos, ypos;

        Size imgSz(img->getSize());

        // calculate final colours to be used
        ColourRect finalColours;
        initColoursRect(srcWindow, modColours, finalColours);

        // calculate initial x co-ordinate and horizontal tile count according to formatting options
        switch (horzFormatting)
        {
            case HF_STRETCHED:
                imgSz.d_width = destRect.getWidth();
                xpos = destRect.d_left;
                horzTiles = 1;
                break;

            case HF_TILED:
                xpos = destRect.d_left;
                horzTiles = (uint)((destRect.getWidth() + (imgSz.d_width - 1)) / imgSz.d_width);
                break;

            case HF_LEFT_ALIGNED:
                xpos = destRect.d_left;
                horzTiles = 1;
                break;

            case HF_CENTRE_ALIGNED:
                xpos = destRect.d_left + PixelAligned((destRect.getWidth() - imgSz.d_width) * 0.5f);
                horzTiles = 1;
                break;

            case HF_RIGHT_ALIGNED:
                xpos = destRect.d_right - imgSz.d_width;
                horzTiles = 1;
                break;

            default:
                throw InvalidRequestException("ImageryComponent::render - An unknown HorizontalFormatting value was specified.");
        }

        // calculate initial y co-ordinate and vertical tile count according to formatting options
        switch (vertFormatting)
        {
            case VF_STRETCHED:
                imgSz.d_height = destRect.getHeight();
                ypos = destRect.d_top;
                vertTiles = 1;
                break;

            case VF_TILED:
                ypos = destRect.d_top;
                vertTiles = (uint)((destRect.getHeight() + (imgSz.d_height - 1)) / imgSz.d_height);
                break;

            case VF_TOP_ALIGNED:
                ypos = destRect.d_top;
                vertTiles = 1;
                break;

            case VF_CENTRE_ALIGNED:
                ypos = destRect.d_top + PixelAligned((destRect.getHeight() - imgSz.d_height) * 0.5f);
                vertTiles = 1;
                break;

            case VF_BOTTOM_ALIGNED:
                ypos = destRect.d_bottom - imgSz.d_height;
                vertTiles = 1;
                break;

            default:
                throw InvalidRequestException("ImageryComponent::render - An unknown VerticalFormatting value was specified.");
        }

        // perform final rendering (actually is now a caching of the images which will be drawn)
        Rect finalRect;
        Rect finalClipper;
        const Rect* clippingRect;
        finalRect.d_top = ypos;
        finalRect.d_bottom = ypos + imgSz.d_height;

        for (uint row = 0; row < vertTiles; ++row)
//.........这里部分代码省略.........
开发者ID:Ocerus,项目名称:Ocerus,代码行数:101,代码来源:CEGUIFalImageryComponent.cpp


示例14: switch

bool
TopWindow::OnEvent(const SDL_Event &event)
{
  switch (event.type) {
    Window *w;

  case SDL_VIDEOEXPOSE:
    Invalidated_lock.Lock();
    Invalidated = false;
    Invalidated_lock.Unlock();

    Expose();
    return true;

  case SDL_KEYDOWN:
    w = GetFocusedWindow();
    if (w == NULL)
      w = this;

    if (!w->IsEnabled())
      return false;

    return w->OnKeyDown(event.key.keysym.sym);

  case SDL_KEYUP:
    w = GetFocusedWindow();
    if (w == NULL)
      w = this;

    if (!w->IsEnabled())
      return false;

    return w->OnKeyUp(event.key.keysym.sym);

  case SDL_MOUSEMOTION:
    // XXX keys
    return OnMouseMove(event.motion.x, event.motion.y, 0);

  case SDL_MOUSEBUTTONDOWN:
    if (event.button.button == SDL_BUTTON_WHEELUP)
      return OnMouseWheel(event.button.x, event.button.y, 1);
    else if (event.button.button == SDL_BUTTON_WHEELDOWN)
      return OnMouseWheel(event.button.x, event.button.y, -1);

    return double_click.Check(RasterPoint{PixelScalar(event.button.x),
                                          PixelScalar(event.button.y)})
      ? OnMouseDouble(event.button.x, event.button.y)
      : OnMouseDown(event.button.x, event.button.y);

  case SDL_MOUSEBUTTONUP:
    if (event.button.button == SDL_BUTTON_WHEELUP ||
        event.button.button == SDL_BUTTON_WHEELDOWN)
      /* the wheel has already been handled in SDL_MOUSEBUTTONDOWN */
      return false;

    double_click.Moved(RasterPoint{PixelScalar(event.button.x),
                                   PixelScalar(event.button.y)});

    return OnMouseUp(event.button.x, event.button.y);

  case SDL_QUIT:
    return OnClose();

  case SDL_VIDEORESIZE:
    Resize(event.resize.w, event.resize.h);
    return true;
  }

  return false;
}
开发者ID:damianob,项目名称:xcsoar_mess,代码行数:70,代码来源:TopWindow.cpp


示例15: getOption

QVariant WindowsManager::getOption(const QString &key) const
{
	Window *window = m_mainWindow->getWorkspace()->getActiveWindow();

	return (window ? window->getOption(key) : QVariant());
}
开发者ID:insionng,项目名称:otter-browser,代码行数:6,代码来源:WindowsManager.cpp


示例16: _initJitter

void Channel::frameDraw( const eq::uint128_t& frameID )
{
    if( stopRendering( ))
        return;

    _initJitter();
    if( _isDone( ))
        return;

    Window* window = static_cast< Window* >( getWindow( ));
    VertexBufferState& state = window->getState();
    const Model* oldModel = _model;
    const Model* model = _getModel();

    if( oldModel != model )
        state.setFrustumCulling( false ); // create all display lists/VBOs

    if( model )
        _updateNearFar( model->getBoundingSphere( ));

    // Setup OpenGL state
    eq::Channel::frameDraw( frameID );

    glLightfv( GL_LIGHT0, GL_POSITION, lightPosition );
    glLightfv( GL_LIGHT0, GL_AMBIENT,  lightAmbient  );
    glLightfv( GL_LIGHT0, GL_DIFFUSE,  lightDiffuse  );
    glLightfv( GL_LIGHT0, GL_SPECULAR, lightSpecular );

    glMaterialfv( GL_FRONT, GL_AMBIENT,   materialAmbient );
    glMaterialfv( GL_FRONT, GL_DIFFUSE,   materialDiffuse );
    glMaterialfv( GL_FRONT, GL_SPECULAR,  materialSpecular );
    glMateriali(  GL_FRONT, GL_SHININESS, materialShininess );

    const FrameData& frameData = _getFrameData();
    glPolygonMode( GL_FRONT_AND_BACK, 
                   frameData.useWireframe() ? GL_LINE : GL_FILL );

    const eq::Vector3f& position = frameData.getCameraPosition();

    glMultMatrixf( frameData.getCameraRotation().array );
    glTranslatef( position.x(), position.y(), position.z() );
    glMultMatrixf( frameData.getModelRotation().array );

    if( frameData.getColorMode() == COLOR_DEMO )
    {
        const eq::Vector3ub color = getUniqueColor();
        glColor3ub( color.r(), color.g(), color.b() );
    }
    else
        glColor3f( .75f, .75f, .75f );

    if( model )
        _drawModel( model );
    else
    {
        glNormal3f( 0.f, -1.f, 0.f );
        glBegin( GL_TRIANGLE_STRIP );
            glVertex3f(  .25f, 0.f,  .25f );
            glVertex3f( -.25f, 0.f,  .25f );
            glVertex3f(  .25f, 0.f, -.25f );
            glVertex3f( -.25f, 0.f, -.25f );
        glEnd();
    }

    state.setFrustumCulling( true );
    Accum& accum = _accum[ lunchbox::getIndexOfLastBit( getEye()) ];
    accum.stepsDone = LB_MAX( accum.stepsDone, 
                              getSubPixel().size * getPeriod( ));
    accum.transfer = true;
}
开发者ID:aoighost,项目名称:Equalizer,代码行数:70,代码来源:channel.cpp


示例17: getTitle

QString WindowsManager::getTitle() const
{
	Window *window = m_mainWindow->getWorkspace()->getActiveWindow();

	return (window ? window->getTitle() : tr("Empty"));
}
开发者ID:insionng,项目名称:otter-browser,代码行数:6,代码来源:WindowsManager.cpp


示例18: getWindow

void Channel::_drawModel( const Model* scene )
{
    Window* window = static_cast< Window* >( getWindow( ));
    VertexBufferState& state = window->getState();
    const FrameData& frameData = _getFrameData();

    if( frameData.getColorMode() == COLOR_MODEL && scene->hasColors( ))
        state.setColors( true );
    else
        state.setColors( false );
    state.setChannel( this );

    // Compute cull matrix
    const eq::Matrix4f& rotation = frameData.getCameraRotation();
    const eq::Matrix4f& modelRotation = frameData.getModelRotation();
    eq::Matrix4f position = eq::Matrix4f::IDENTITY;
    position.set_translation( frameData.getCameraPosition());

    const eq::Frustumf& frustum = getFrustum();
    const eq::Matrix4f projection = useOrtho() ? frustum.compute_ortho_matrix():
                                                 frustum.compute_matrix();
    const eq::Matrix4f& view = getHeadTransform();
    const eq::Matrix4f model = rotation * position * modelRotation;

    state.setProjectionModelViewMatrix( projection * view * model );
    state.setRange( &getRange().start);

    const eq::Pipe* pipe = getPipe();
    const GLuint program = state.getProgram( pipe );
    if( program != VertexBufferState::INVALID )
        glUseProgram( program );
    
    scene->cullDraw( state );

    state.setChannel( 0 );
    if( program != VertexBufferState::INVALID )
        glUseProgram( 0 );

    const InitData& initData =
        static_cast<Config*>( getConfig( ))->getInitData();
    if( !initData.useROI( ))
    {
        declareRegion( getPixelViewport( ));
        return;
    }

#ifndef NDEBUG // region border
    const eq::PixelViewport& pvp = getPixelViewport();
    const eq::PixelViewport& region = getRegion();

    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    glOrtho( 0.f, pvp.w, 0.f, pvp.h, -1.f, 1.f );
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

    const eq::View* currentView = getView();
    if( currentView && frameData.getCurrentViewID() == currentView->getID( ))
        glColor3f( 0.f, 0.f, 0.f );
    else
        glColor3f( 1.f, 1.f, 1.f );
    glNormal3f( 0.f, 0.f, 1.f );

    const eq::Vector4f rect( float( region.x ) + .5f, float( region.y ) + .5f,
                             float( region.getXEnd( )) - .5f,
                             float( region.getYEnd( )) - .5f );
    glBegin( GL_LINE_LOOP ); {
        glVertex3f( rect[0], rect[1], -.99f );
        glVertex3f( rect[2], rect[1], -.99f );
        glVertex3f( rect[2], rect[3], -.99f );
        glVertex3f( rect[0], rect[3], -.99f );
    } glEnd();
#endif
}
开发者ID:aoighost,项目名称:Equalizer,代码行数:74,代码来源:channel.cpp


示例19: WindowProcedure

//  This function is called by the Windows function DispatchMessage()
LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT mMsg, WPARAM wParam, LPARAM lParam)
{
    switch (mMsg)
    {
        case WM_CREATE:
            break;

        case WM_SIZE:
            break;

        case WM_COMMAND:
            //If handle is the window, handle the menu
            if (hWnd == cWindow.GetHandle())
                HandleMenu(hWnd, LOWORD(wParam));

            if (LOWORD(wParam) == IDR_START_BUTTON) {
                //Check if we have a connection to the scale
                if (scale != NULL && scale->IsConnected()) {
                    //Check if we just finished a meal as well, if we didn't, start one
                    if (!bMealActive) { //If the meal is not active, start it or reset it
                        if (vMealItems.size() == 0) {
                            _beginthread(Meal, 0, (void*)hWnd);
                        } else {
                            vMealItems.clear();
                            HandleMenu(hWnd, ID_FILE_NEW);
                        }
                    } else { //Otherwise, stop it
                        if (strlen(cSaveName)<=1) GetSaveFile(hWnd);
                        bMealActive = 0;
                    }
                }
            }
            break;

        case WM_CLOSE:
            if (strlen(cSaveName) > 1 && !SaveMeal()) {
                if (CheckAndSave() == -1) break;
            } else if (!bSaved && vMealItems.size() > 0) {
                switch(MessageBox(hWnd, "You haven't saved the current meal, would you like to?","Hold Up!", MB_YESNOCANCEL | MB_ICONINFORMATION)) {
                    case IDYES:
                        if (CheckAndSave() == -1) break;
                    case IDNO:
                        if (scale) delete scale;
                        DestroyWindow(hWnd);
                        hWnd = NULL;
                    break;

                    case IDCANCEL:
                    break;

                    default:
                    break;
                }
            } else {
                if (hWnd != NULL) {
                    if (scale) delete scale;
                    DestroyWindow(hWnd);
                }
            }
            break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;

        case WM_UPDATE_READING:
            //Destroy any spare messages if scale is null
            if (scale == NULL) break;

            //Retreive the information and print it on the button
            char tBuf[32];
            sprintf(tBuf, "Connected on %s - %.2f %s %s", scale->GetName(), scale->GetWeight(), scale->GetUnit(), (scale->IsStable()?"":"(unstable)"));
            cEditBox.SetText(tBuf);

            hScaleThread = (HANDLE)_beginthread(GetScaleReading, 0, (void*) hWnd);
            break;

        case WM_SCALE_CONNECTED:
            ToggleScaleMenu(1);
            break;

        case WM_SCALE_DISCONNECTED:
            ToggleScaleMenu(0);
            cEditBox.SetText("Disconnected");
            break;

        default:
            return DefWindowProc (hWnd, mMsg, wParam, lParam);
    }

    return 0;
}
开发者ID:kirkbackus,项目名称:meal-track,代码行数:93,代码来源:main.cpp


示例20: getZoom

int WindowsManager::getZoom() const
{
	Window *window = m_mainWindow->getWorkspace()->getActiveWindow();

	return (window ? window->getContentsWidget()->getZoom() : 100);
}
开发者ID:insionng,项目名称:otter-browser,代码行数:6,代码来源:WindowsManager.cpp



注:本文中的Window类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WindowApplication类代码示例发布时间:2022-05-31
下一篇:
C++ WillBeHeapVector类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap