Example #1
0
void Dispatcher::updateDisplay()
{
    QString artist;
    QString album;
    QString title;
    QTime length;
    QTime currentTime;
    if (m_currentHandler != NULL) {
        artist = m_currentHandler->artist();
        album = m_currentHandler->album();
        title = m_currentHandler->title();
        length = m_currentHandler->length();
        currentTime = m_currentHandler->currentTime();
    }
    QListIterator<Display*> it = m_loader->displaysIterator();
    while (it.hasNext()) {
        Display* display = it.next();
        display->setMediaInfo(artist, album, title, length);
        display->setCurrentTime(currentTime);
    }
}
Example #2
0
Window::Window (Display& display, int width, int height, ::Visual* visual)
	: m_display		(display)
	, m_colormap	(None)
	, m_window		(None)
	, m_visible		(false)
{
	XSetWindowAttributes	swa;
	::Display* const		dpy					= m_display.getXDisplay();
	::Window				root				= DefaultRootWindow(dpy);
	unsigned long			mask				= CWBorderPixel | CWEventMask;

	// If redirect is enabled, window size can't be guaranteed and it is up to
	// the window manager to decide whether to honor sizing requests. However,
	// overriding that causes window to appear as an overlay, which causes
	// other issues, so this is disabled by default.
	const bool				overrideRedirect	= false;

	if (overrideRedirect)
	{
		mask |= CWOverrideRedirect;
		swa.override_redirect = true;
	}

	if (visual == DE_NULL)
		visual = CopyFromParent;
	else
	{
		XVisualInfo	info	= XVisualInfo();
		bool		succ	= display.getVisualInfo(XVisualIDFromVisual(visual), info);

		TCU_CHECK_INTERNAL(succ);

		root				= RootWindow(dpy, info.screen);
		m_colormap			= XCreateColormap(dpy, root, visual, AllocNone);
		swa.colormap		= m_colormap;
		mask |= CWColormap;
	}

	swa.border_pixel	= 0;
	swa.event_mask		= ExposureMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask;

	if (width == glu::RenderConfig::DONT_CARE)
		width = DEFAULT_WINDOW_WIDTH;
	if (height == glu::RenderConfig::DONT_CARE)
		height = DEFAULT_WINDOW_HEIGHT;

	m_window = XCreateWindow(dpy, root, 0, 0, width, height, 0,
							 CopyFromParent, InputOutput, visual, mask, &swa);
	TCU_CHECK(m_window);

	Atom deleteAtom = m_display.getDeleteAtom();
	XSetWMProtocols(dpy, m_window, &deleteAtom, 1);
}
Example #3
0
void resetGame(){
     
     //==========================START MSG Prints Highscore
     while(!keyboard.s){
        display.Clear();
        drawMap();
        drawBorders();
        sprintf(TEXT,"Press 's' to start");
        display.DrawString(TEXT,  0, (HEIGHT/2)*BLOCKPIXSIZE,0,0x00FF00);
        display.Render();
        keyboard.Poll(); 
        SDL_Delay(50);
         }
     for(int i=0;i < WIDTH;i++){
         for(int ii=0;ii < HEIGHT;ii++){
                 map[i][ii] = 0;
         }
     }
    score = 0;
    newBlock();
}
Example #4
0
	Colormap(const Display& display, const VisualInfo& vi)
	 : DisplayObject< ::Colormap>(
		display,
		::XCreateColormap(
			display,
			RootWindow(display.Get(), vi->screen),
			vi->visual,
			AllocNone
		),
		::XFreeColormap,
		"Error creating X Colormap"
	){ }
Example #5
0
bool checkKeys(KeyPress key, Display display, Notification notification, vector<int> keyCodeArray, bool isMenu) {
	display.updateDisplay(key);
	system("CLS");
	cout << display.toString();

	while (true) {
		for (int i = 0; i < keyCodeArray.size(); i++) {
			if (key.isPressed(keyCodeArray.at(i))) {
				display.updateDisplay(key);
				system("CLS");
				cout << display.toString();
			};
		}

		//extra logic for if the display is not a menu:
		if (!isMenu) {
			if (key.timedUpdate(1)) {
				display.updateDisplay(key);
				system("CLS");
				cout << display.toString();
			}

			key.isHeld(VK_SPACE);
			notification.lockedScreen(stoi(key.getLockedScreenPercent()), key.getSecondsLocked());
			key.incrementLoopCount();
		}

		//reset counter and key presses
		if (key.checkIfRequiresReset()) break;
		Sleep(10);
	}
	return 0;
}
Example #6
0
File: game.cpp Project: spekode/2d3
int main(int argc, char **argv) { 
    al_init();
    al_init_image_addon();
    
    Display d (500, 500);
    Engine g (&d);
    ALLEGRO_BITMAP *bmp = al_load_bitmap("m.png");
    if (!bmp) {
        printf("Could not load bmp!\n");
        return -1;
    }
    BaseSprite s (bmp);

    g.display->addRenderable(&s);
    g.setState(ERUNNING);

    while (1) {
        while (g.getState() == ERUNNING) {
            g.engineTick();
            g.engineRender();
            g.engineSleep();
        }

        printf("BREAK\n");
        if (g.getState() == EPAUSED) {
            while (g.getState() == EPAUSED) {
                g.engineTick();
                g.engineSleep(1);
            }
        }

        if (g.getState() == EQUIT) {
            g.engineQuit();
            break;
        }
    }

    d.del();
    return 0;
}
Example #7
0
void Engine::render() {
	SDL_FillRect(screen, NULL, 0x000000);
	display->render(screen);
	player->render(WIDTH/2, HEIGHT/2, screen);
	player->renderAttrib(screen, display);
	int xR = (WIDTH/2) + (rando->getX() - player->getX());
	int yR = (HEIGHT/2) + (rando->getY() - player->getY());
	rando->render(xR, yR, screen);
	//textWriter->write(display->getCurrentTile(), 50, 50, screen);
	//textWriter->write(display->getOffsets(), 50, 50, screen);
	//display->getOffsets();
	SDL_Flip(screen);
}
Example #8
0
int main(int argc, const char * argv[])
{
    //create buffer and display
    BufferManager *buffer = new BufferManager();
    Display *display = new Display(buffer);

    //setup curses
    initscr();
    noecho();
    keypad(stdscr, true);
    cbreak();

    //display initial status
    display->redisplay(buffer);

    //run
    run(buffer, display);

    //finish
    endwin();
    return 0;
}
void DisplayGroup::removeAllDisplays()
{
    int num_non_display_children = Display::numChildren();

    if( model_ )
    {
        model_->beginRemove( this, num_non_display_children, displays_.size() );
    }
    for( int i = displays_.size() - 1; i >= 0; i-- )
    {
//    printf("  displaygroup2 displays_.takeAt( %d )\n", i );
        Display* child = displays_.takeAt( i );
        Q_EMIT displayRemoved( child );
        child->setParent( NULL ); // prevent child destructor from calling getParent()->takeChild().
        delete child;
    }
    if( model_ )
    {
        model_->endRemove();
    }
    Q_EMIT childListChanged( this );
}
Example #10
0
int main() {
	int fil[6][8];
	int i,j;
	//inisialisasi
	for (i = 0;i <= 5;i++) {
		for (j = 0;j <= 7;j++) {
			fil[i][j] = 1;
		}
	}
	Display LCD;
	LCD.SetJudul(3, 5, 4, 10, 2, 2, 4, "PANAS", "TERANG");
	LCD.SetWarna(1,15);
	
	//UBAH NAMA
	LCD.SetStrPanel(1,0,"FIDEL CASTRO");
	
	//UBAH STATUS
	LCD.SetStrPanel(1,1,"NORMAL");
	
	//UBAH UANG
	LCD.SetStrPanel(1,2,"65.000 BUCK");
	
	//UBAH NAMA TANAMAN
	LCD.SetStrPanel(2,0,"CANABIS");
	
	LCD.ClearScr();
	//string jud;
	/*jud = "TT/BB            HH:MM          RUMAH< , >           MUSIM           CUACA";
	a[1]= "COBAA"				;	b[1]= "ABISA";
	a[2]= "AJAA"					;	b[2]= "INIA";
	a[3]= "NIHA"					;	b[3]= "COBAA";
	a[4]= "TESTINGA"				;	b[4]= "TRUAS";
	a[5]= "YUHUA"				;	b[5]= "MAMPUAS";*/
	LCD << fil;
	LCD.PrintJudul();
	LCD.PrintUtama();
	return 0;
}
void main(int argc, char* argv[])
{
	std::cout << "\n  Test Display.\n "
		<< std::string(30, '=') << std::endl;

	try
	{
		for (auto file : files){
			Parser* pParser = configure.Build(file);
			std::cout << "\n --- " << file << " --- \n" << std::endl;
			if (pParser){
				if (!configure.Attach(file)){
					std::cout << "\n  could not open file " << file << std::endl;
					continue;
				}
			}
			else{
				std::cout << "\n\n  Parser not built\n\n";
				return;
			}
			while (pParser->next())
				pParser->parse();

			Display dp;
			Repository* p_Repos = configure.ReturnRepos();
			if (cp.GetHideDetail())
				dp.DisplayBrief(p_Repos);
			else
				dp.DisplayDetail(p_Repos);
			dp.WalkTree(p_Repos->p_Node, false);
			std::cout << "\n\n";
		}
	}
	catch (std::exception& ex)
	{
		std::cout << "\n\n  " << ex.what() << "\n\n";
	}
}
void CommandContributionItem::UpdateCommandProperties(const SmartPointer<
    const CommandEvent> commandEvent)
{
  if (commandEvent->IsHandledChanged())
  {
    dropDownMenuOverride = "";
  }
  if (!action)
  {
    return;
  }
  Display* display = Display::GetDefault();
  typedef AsyncRunnable<SmartPointer<const CommandEvent>, CommandContributionItem > UpdateRunnable;
  Poco::Runnable* update = new UpdateRunnable(this, &CommandContributionItem::UpdateCommandPropertiesInUI, commandEvent);
  if (display->InDisplayThread())
  {
    update->run();
  }
  else
  {
    display->AsyncExec(update);
  }
}
Example #13
0
void ImageLoader::internalCreate(std::string key, std::string fileName, int x1, int y1, int x2, int y2)
{
	Display* display = Display::Acquire();

	if (x1 < 0)
	{
		x1 = 0;
	}
	if (x2 < 0)
	{
		x2 = display->GetWidth(fileName);
	}	
	if (y1 < 0)
	{
		y1 = 0;
	}	
	if (y2 < 0)
	{
		y2 = display->GetHeight(fileName);
	}

	display->LoadImageFromFile(fileName, key, x1, y1, x2, y2);
}
Example #14
0
Seat::Seat(const Display& display)
	: display_(display)
	, wl_seat_(display.bind<wl_seat>("wl_seat", &wl_seat_interface, 1))
	, capabilities_(0)
{
	ASSERT(wl_seat_ != NULL);

	wl_seat_set_user_data(*this, this);

	static const wl_seat_listener listener = {capabilities};
	wl_seat_add_listener(*this, &listener, this);

	display.roundtrip();
}
Example #15
0
    void DaemonApp::removeDisplay() {
        Display *display = qobject_cast<Display *>(sender());

        // log message
        qDebug() << " DAEMON: Removing display" << display->name() << "...";

        // remove display from list
        m_displays.removeAll(display);

        // delete display
        display->deleteLater();

#if TEST
        // quit if no display remained
        if (m_displays.isEmpty()) {
            // log message
            qDebug() << " DAEMON: Stopping...";

            // quit application
            qApp->quit();
        }
#endif
    }
Example #16
0
bt::Color bt::Color::namedColor(const Display &display, unsigned int screen,
                                const std::string &colorname) {
  if (colorname.empty()) {
    fprintf(stderr, "bt::Color::namedColor: empty colorname\n");
    return Color();
  }

  // get rgb values from colorname
  XColor xcol;
  xcol.red   = 0;
  xcol.green = 0;
  xcol.blue  = 0;
  xcol.pixel = 0;

  Colormap colormap = display.screenInfo(screen).colormap();
  if (!XParseColor(display.XDisplay(), colormap, colorname.c_str(), &xcol)) {
    fprintf(stderr, "bt::Color::namedColor: invalid color '%s'\n",
            colorname.c_str());
    return Color();
  }

  return Color(xcol.red >> 8, xcol.green >> 8, xcol.blue >> 8);
}
MasterRenderer::MasterRenderer(
    Project&                project,
    const ParamArray&       params,
    const SearchPaths&      resource_search_paths,
    IRendererController*    renderer_controller,
    ITileCallbackFactory*   tile_callback_factory)
  : impl(new Impl(project, params, resource_search_paths))
{
    impl->m_renderer_controller = renderer_controller;
    impl->m_tile_callback_factory = tile_callback_factory;

    if (impl->m_tile_callback_factory == nullptr)
    {
        // Try to use the display if there is one in the project
        // and no tile callback factory was specified.
        Display* display = impl->m_project.get_display();
        if (display != nullptr && display->open(impl->m_project))
        {
            impl->m_tile_callback_factory = display->get_tile_callback_factory();
            impl->m_display = display;
        }
    }
}
Example #18
0
Display *Display::GetDisplayFromAttribs(void *native_display, const AttributeMap &attribMap)
{
    // Initialize the global platform if not already
    InitDefaultPlatformImpl();

    Display *display = nullptr;

    EGLNativeDisplayType displayId = reinterpret_cast<EGLNativeDisplayType>(native_display);

    ANGLEPlatformDisplayMap *displays            = GetANGLEPlatformDisplayMap();
    ANGLEPlatformDisplayMap::const_iterator iter = displays->find(displayId);
    if (iter != displays->end())
    {
        display = iter->second;
    }

    if (display == nullptr)
    {
        // Validate the native display
        if (!Display::isValidNativeDisplay(displayId))
        {
            return NULL;
        }

        display = new Display(EGL_PLATFORM_ANGLE_ANGLE, displayId, nullptr);
        displays->insert(std::make_pair(displayId, display));
    }

    // Apply new attributes if the display is not initialized yet.
    if (!display->isInitialized())
    {
        rx::DisplayImpl *impl = CreateDisplayFromAttribs(attribMap);
        display->setAttributes(impl, attribMap);
    }

    return display;
}
Example #19
0
void Reporting::reportCode(Priority p, VisualStateMethod method, uint32_t code) {
    if (method == LIGHTS) {
        if (p == PRIORITY_DEBUG) {
          #ifdef DEBUG
            srwp.stepLights = code;
            srwp.functionLights = 0xFFFF;
            ShiftRegisters::Instance().open(NULL);
            ShiftRegisters::Instance().write(&srwp);
            ShiftRegisters::Instance().close();
          #endif
        }
    }
    else {
        if (p == PRIORITY_DEBUG)  {
            #ifdef DEBUG
                Display disp = Display();
                char hexString[10];
                sprintf(hexString, "0x%X", (unsigned int)code);
                disp.drawText(0, 0, SMALL_FONT, hexString);
                disp.paint();
            #endif
        }
    }
}
Example #20
0
/*	This renders children and itself to the canvas, if visible.
 *	It will render itself on canvasLayer on the canvas, while rendering
 *	its children on canvasLayer + 1. It renders its children relative to its
 *  own position
 *		Written: Sebastian Zander: 13-02-04 13:09
 */
void GUIBox::render(Display& display, sf::Vector2f relativeTo)
{
	if (mVisible)
	{
		for (auto iter = mChildren.begin(); iter != mChildren.end(); ++iter)
		{
			(*iter)->render(display, sf::Vector2f(Rect().left + relativeTo.x, Rect().top + relativeTo.y));
		}

		mSprite.setPosition(relativeTo.x + Rect().left, relativeTo.y + Rect().top);

		display.render(mSprite);
	}

}
Property* DisplayGroup::takeChildAt( int index )
{
    if( index < Display::numChildren() )
    {
        return Display::takeChildAt( index );
    }
    int disp_index = index - Display::numChildren();
    if( model_ )
    {
        model_->beginRemove( this, index, 1 );
    }
//  printf("  displaygroup5 displays_.takeAt( %d ) ( index = %d )\n", disp_index, index );
    Display* child = displays_.takeAt( disp_index );
    Q_EMIT displayRemoved( child );
    child->setModel( NULL );
    child->setParent( NULL );
    child_indexes_valid_ = false;
    if( model_ )
    {
        model_->endRemove();
    }
    Q_EMIT childListChanged( this );
    return child;
}
EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);

    Display *display = static_cast<Display*>(dpy);
    Surface *eglSurface = (Surface*)surface;

    Error error = ValidateSurface(display, eglSurface);
    if (error.isError())
    {
        SetGlobalError(error);
        return EGL_FALSE;
    }

    if (display->isDeviceLost())
    {
        SetGlobalError(Error(EGL_CONTEXT_LOST));
        return EGL_FALSE;
    }

    if (surface == EGL_NO_SURFACE)
    {
        SetGlobalError(Error(EGL_BAD_SURFACE));
        return EGL_FALSE;
    }

    error = eglSurface->swap();
    if (error.isError())
    {
        SetGlobalError(error);
        return EGL_FALSE;
    }

    SetGlobalError(Error(EGL_SUCCESS));
    return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy)
{
    EVENT("(EGLDisplay dpy = 0x%0.8p)", dpy);

    Display *display = static_cast<Display *>(dpy);
    if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
    {
        SetGlobalError(Error(EGL_BAD_DISPLAY));
        return EGL_FALSE;
    }

    gl::Context *context = GetGlobalContext();

    if (display->isValidContext(context))
    {
        SetGlobalContext(NULL);
        SetGlobalDisplay(NULL);
    }

    display->terminate();

    SetGlobalError(Error(EGL_SUCCESS));
    return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
          dpy, config, attribute, value);

    Display *display = static_cast<Display*>(dpy);
    Config *configuration = static_cast<Config*>(config);

    Error error = ValidateConfig(display, configuration);
    if (error.isError())
    {
        SetGlobalError(error);
        return EGL_FALSE;
    }

    if (!display->getConfigAttrib(configuration, attribute, value))
    {
        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
        return EGL_FALSE;
    }

    SetGlobalError(Error(EGL_SUCCESS));
    return EGL_TRUE;
}
Example #25
0
int CommandLineReader::ReadLineHook(void) {
    Display *display = Display::GetDisplay();
    if (!display)
        return 0;

    // readline is annoying: the documentation says the event
    // hook is called no more than 10 times per second, but
    // tests show it _can_ be much more often than this. But
    // we don't want to refresh the display or check events
    // too often (it's expensive...) So we keep track of time
    // here as well, and force 10ths of seconds ourselves.

    static long last_check = 0;

    struct timeval tv;
    gettimeofday(&tv, 0);
    long current = tv.tv_sec * 10 + tv.tv_usec / 100000;
    if (current - last_check)
    {
        display->CheckEvents();
        last_check = current;
    }
    return 0;
}
EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx)
{
    EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)", dpy, ctx);
    Thread *thread = GetCurrentThread();

    Display *display     = static_cast<Display *>(dpy);
    gl::Context *context = static_cast<gl::Context *>(ctx);

    Error error = ValidateContext(display, context);
    if (error.isError())
    {
        thread->setError(error);
        return EGL_FALSE;
    }

    if (ctx == EGL_NO_CONTEXT)
    {
        thread->setError(EglBadContext());
        return EGL_FALSE;
    }

    if (context == thread->getContext())
    {
        thread->setCurrent(nullptr);
    }

    error = display->destroyContext(context);
    if (error.isError())
    {
        thread->setError(error);
        return EGL_FALSE;
    }

    thread->setError(NoError());
    return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY WaitClient(void)
{
    EVENT("()");
    Thread *thread = GetCurrentThread();

    Display *display = thread->getCurrentDisplay();

    Error error = ValidateDisplay(display);
    if (error.isError())
    {
        thread->setError(error);
        return EGL_FALSE;
    }

    error = display->waitClient(thread->getContext());
    if (error.isError())
    {
        thread->setError(error);
        return EGL_FALSE;
    }

    thread->setError(NoError());
    return EGL_TRUE;
}
Example #28
0
void Executive::demonstrateShowAttribute(Display dp, XmlProcessing::XmlDocument &doc,const std::string tag)
{
	//demonstrates requirment and then send the output to display class
	std::cout << "\n""\n""\n" << std::string(150, '=');
	std::cout << "\n" << "Demonstrating Requirement 8 provide a facility to return a std::vector containing all the name-value attribute pairs attached to that element";
	std::cout << "\n" << std::string(150, '=');
	std::cout << "\n" << "Input is Pointer to Element: " << tag << "\n";
	std::vector<std::shared_ptr<AbstractXmlElement>> vectorSharedPtr;
	vectorSharedPtr = doc.findById(tag).select();
	if (vectorSharedPtr.size() > 0)
		dp.displayToConsole(doc.getAttributePairVector(vectorSharedPtr[0]), tag);
	else
	  std::cout <<"\n"<< "Tag: "<<tag<<" is not found in XML";

}
Example #29
0
void drawNextBlock(){
     int nt = 0;
     
     if(randBlocksi >= BLOCKNUM*PRERAND){nt = postceedingBlock;}
     else{nt = randBlocks[randBlocksi];}
     
     
     for(int ox=0;ox<BLOCKSIZE;ox++){
         for(int oy=0;oy<BLOCKSIZE;oy++){
              if(blocks[nt][rotationBlock][oy][ox]){
                  display.DrawRectangle(((WIDTH)+ox)*BLOCKPIXSIZE,((HEIGHT/2-BLOCKSIZE*2)+oy)*BLOCKPIXSIZE,BLOCKPIXSIZE-2,BLOCKPIXSIZE-2,colormap[nt]);
              }

         }
     }
}
Example #30
0
int main(int argc, char** argv)
{
    Display d;
	
    d.Initialize(800, 600, 24, "Tutorial 4");
	
    if( d.Show() == false )
    {
        std::cout << "Failed to open window, exiting." << std::endl;
        return 1;
    }
	
    d.ClearColor( Color::Blue() );
	
	auto m = std::make_shared<Model>("data/cube.obj");
	
	uint time = Timer::GetCurrentGameTime();
	
	auto modelTransformations = Matrix4::Translate(0.0f, 0.0f, -10.0f);
	
	float angle;
	
    while(d.Listener()->Update())
    {
		//rotate model
		angle = 90.0f * (((float)(Timer::GetCurrentGameTime() - time)) / 1000.0f);
		
		(*modelTransformations) *= (*Matrix4::RotateX(angle));
		(*modelTransformations) *= (*Matrix4::RotateY(angle));
		(*modelTransformations) *= (*Matrix4::RotateZ(angle));
		
		time = Timer::GetCurrentGameTime();


        d.ClearScreen();
        d.SetupPerspective(45.0f, 0.1f, 100.0f);
		
		m->Render(modelTransformations);
		
        d.SwapBuffers();
    }
	
    return 0;
}