예제 #1
0
	void GingaNclGfx::showText(IWindow* window, string text) {
		ISurface* s;
		IColor* fontColor;
		IColor* bgColor;
		string fontUri;
		int fontSize;

		fontUri = "/usr/local/lib/ginga/files/font/decker.ttf";
		fontSize = 12;

		if (!fileExists(fontUri)) {
			cout << "GingaNclGfx::show Warning! File not found: '";
			cout << fontUri.c_str() << "'" << endl;
			return;
		}

		IComponentManager* cm = IComponentManager::getCMInstance();
		IFontProvider* font = NULL;

		window->clearContent();
		window->show();
		if (cm != NULL) {
			font = ((FontProviderCreator*)(cm->getObject("FontProvider")))(
					fontUri.c_str(), fontSize);

			s = ((SurfaceCreator*)(cm->getObject("Surface")))(NULL, 0, 0);
			s->setParent(window);
		}

		bgColor = new Color("black");
		fontColor = new Color("white");

		if (font != NULL) {
			s->setFont(font);
			s->setColor(fontColor);

			font->playOver(
					(void*)s,
					text.c_str(), 0, 0, (0x00000004 | 0x00000000));

			delete font;
			font = NULL;

			delete bgColor;
			bgColor = NULL;

			delete s;
			s = NULL;
		}

		delete fontColor;
		fontColor = NULL;

		window->validate();
		window->raiseToTop();
	}
예제 #2
0
	void ShowButton::render(string mrl) {
		ISurface* surface;
		surface = ImagePlayer::renderImage(mrl);
		if (win == NULL) {
			initializeWindow();
		}

		if (surface->setParent((void*)win)) {
			win->renderFrom(surface);
		}
		win->show();
		win->raiseToTop();
		delete surface;
		surface = NULL;
	}
예제 #3
0
파일: GingaNclGfx.cpp 프로젝트: Gingar/port
	void GingaNclGfx::showText(IWindow* window, string text) {
		ISurface* s;
		IColor* fontColor;
		IColor* bgColor;
		string fontUri;
		int fontSize;

		fontUri = DATA_PREFIX_PATH "/share/ginga/font/decker.ttf";
		fontSize = 12;

		if (!fileExists(fontUri)) {
			cout << "GingaNclGfx::show Warning! File not found: '";
			cout << fontUri.c_str() << "'" << endl;
			return;
		}

		IFontProvider* font = NULL;

		window->clearContent();
		window->show();

#if HAVE_COMPSUPPORT
		font = ((FontProviderCreator*)(cm->getObject("FontProvider")))(
				fontUri.c_str(), fontSize);

		s = ((SurfaceCreator*)(cm->getObject("Surface")))(NULL, 0, 0);
#else
		font = new DFBFontProvider(fontUri.c_str(), fontSize);
		s = new DFBSurface();
#endif

		s->setParent(window);

		bgColor = new Color("black");
		fontColor = new Color("white");

		s->setFont(font);
		s->setColor(fontColor);

		font->playOver(
				(void*)s,
				text.c_str(), 0, 0, (0x00000004 | 0x00000000));

		delete font;
		font = NULL;

#if HAVE_COMPSUPPORT
		cm->releaseComponentFromObject("FontProvider");
#endif

		delete bgColor;
		bgColor = NULL;

		delete s;
		s = NULL;


		delete fontColor;
		fontColor = NULL;

		window->validate();
		window->raiseToTop();
	}