Content::Content() { loadTextures(); loadSounds(); loadMusic(); loadFonts(); }
Gui::Gui(const std::string& fontFile, const sf::Vector2i& res, void* object, void (*exitFunc) (void* object)) : delMain(false), delOpt(false), delSec(false), delDia(false), showPause(false), showFps(true), showDia(false), score(0), fpsCount(0) { loadFonts(fontFile); fps = new sf::String("0", fonts["consolas"], 20); fps->SetPosition(10, 10); fps->SetColor(sf::Color::White); fps2 = new sf::String("0", fonts["consolas"], 20); fps2->SetPosition(12, 12); fps2->SetColor(sf::Color(0, 0, 0, 150)); pauseStr = new sf::String("Paused", fonts["consolas"], 30); pauseStr->SetCenter(pauseStr->GetRect().GetWidth() / 2, pauseStr->GetRect().GetHeight() / 2); pauseStr->SetPosition(res.x / 2, (res.y - 50) / 2); pauseStr->SetColor(sf::Color::White); pauseStrShadow = new sf::String("Paused", fonts["consolas"], 30); pauseStrShadow->SetCenter(pauseStrShadow->GetRect().GetWidth() / 2, pauseStrShadow->GetRect().GetHeight() / 2); pauseStrShadow->SetPosition((res.x / 2) + 2, ((res.y - 50) / 2) + 2); pauseStrShadow->SetColor(sf::Color(0, 0, 0, 150)); scoreShow = new sf::String("Score: 0", fonts["consolas"], 26); scoreShow->SetPosition(10, res.y - 40); scoreShow->SetColor(sf::Color::White); mainMenu = NULL; optionsMenu = NULL; selectMenu = NULL; diagPanel = NULL; console = new Console(res, fonts["consolas"]); console->addCommand("exit", "Exit the game.", object, exitFunc); console->addCommand("showfps", "Display the frames per second counter.", this, frames); console->addCommand("showdia", "Display the dialog panel.", this, dialog); }
int parseOpts(int argc, wchar_t *argv[], Options *opts) { int index, next, j; for (index = 1, next = 1; index < argc; next = index) { if (*argv[index] == L'-') { for (j = 1; argv[index][j]; j++) { switch (argv[index][j]) { case 'b': opts->bold = !opts->bold; break; case 'i': opts->italic = !opts->italic; break; case 'r': opts->isRange = !opts->isRange; break; case 'f': if (next + 1 >= argc) return index; opts->font_name = argv[++next]; break; case 'l': if (next + 1 >= argc) return index; printf("%d fonts loaded.\n", loadFonts(argv[++next])); break; default: return index; } } //End switch iteration } else { //No option; must be input file. opts->text_file = argv[index]; } index = ++next; } //End argument iteration return -1; }
MacFontManager::MacFontManager() { for (uint i = 0; i < ARRAYSIZE(fontNames); i++) if (fontNames[i]) _fontNames.setVal(fontNames[i], i); loadFonts(); }
Result FontManager::load(void) { Result ret = (loadFonts() ? 0 : -5); if (R_FAILED(ret)) return ret; return ret; }
void Globals::init () { try { YAML::Node config(YAML::LoadFile("assets/config.yml")); config = config["game"]; sf::Vector2u window_size(config["graphic"]["window"]["size"][0].as<unsigned>(), config["graphic"]["window"]["size"][1].as<unsigned>()); window.reset(new sf::RenderWindow(sf::VideoMode(window_size.x, window_size.y), "Vegetable Crush Saga", sf::Style::Default & ~sf::Style::Resize)); window->setFramerateLimit(60); YAML::Node paths(config["system"]["paths"]); loadTextures(config["graphic"]["textures"], paths["texture_pack"].as<std::string>()); loadFonts(config["graphic"]["fonts"], paths["font_pack"].as<std::string>()); YAML::Node items(config["gameplay"]["items"]); loadItems(items); } catch (YAML::ParserException e) { std::cerr << "Le fichier de config n'est pas aux normes !" << std::endl; std::cerr << e.what() << std::endl; exit(EXIT_FAILURE); } }
Font* getDefaultFont(FontSize size) { if(!loadedFonts) loadFonts(); return fonts[size]; }
void Resources::loadResources() { loadTextures(); loadSounds(); loadMusic(); loadFonts(); loadLevelInfo(); }
void SkinnedSettings::on_resetFontsButton_clicked() { QSettings settings (Qmmp::configFile(), QSettings::IniFormat); settings.remove("Skinned/pl_font"); settings.remove("Skinned/pl_header_font"); settings.remove("Skinned/mw_font"); loadFonts(); }
void FastQSPWindow::openFile(const QString &filename) { qspFilePath = filename; builder.clear(); if (gameIsOpen) autosave(); gameDirectory = QFileInfo(filename).absolutePath() + "/"; if (!QSPLoadGameWorld(filename.toStdWString().c_str(), &gameDirectory)) qCritical() << QString("Could not open file: ") << filename; if (QSPRestartGame(QSP_TRUE)) { gameMenu->setEnabled(true); builder.setGameDir(gameDirectory); netManager.setGameDirectory(gameDirectory); loadFonts(); QFile configFile(gameDirectory + QLatin1String("config.xml")); if (configFile.open(QFile::ReadOnly)) { QTextStream stream(&configFile); QString config = stream.readLine(); configFile.close(); QRegExp re; re.setMinimal(true); re.setPattern("width=\"(\\d+)\""); if (re.indexIn(config)) gameWidth = re.cap(1).toInt(); else gameWidth = 800; re.setPattern("height=\"(\\d+)\""); if (re.indexIn(config) > 0) gameHeight = re.cap(1).toInt(); else gameHeight = 600; aspectRatio = qreal(gameWidth) / qreal(gameHeight); re.setPattern("title=\"(.+)\""); if (re.indexIn(config) >= 0) setWindowTitle(re.cap(1)); else setWindowTitle("FastQSP"); re.setPattern("icon=\"(.+)\""); if (re.indexIn(config) >= 0) QApplication::setWindowIcon(QIcon(gameDirectory + re.cap(1))); } aspectRatio = qreal(gameWidth) / qreal(gameHeight); loadPage(); webView->resize(gameWidth, gameHeight); resize(gameWidth, gameHeight); gameIsOpen = true; saveDir = gameDirectory + "save/"; if (!saveDir.exists()) { saveDir.mkpath("."); } timer.restart(); } }
void Resource::load() { atexit( clearResource ); loadImages(); loadFonts(); // wczytanie map MapManager::load(); }
void loadAssets() { log("loading fonts"); loadFonts(); log("loading sounds"); loadSounds(); log("loading music"); loadMusic(); log("loading music data"); loadMusicData(); log("loading style data"); loadStyleData(); log("loading level data"); loadLevelData(); log("loading scores"); loadScores(); }
void XmlPdf::loadTemplate(QString file) { QFile tpl(file); if (!tpl.open(QIODevice::ReadOnly)) { qDebug() << "Unable to load the File: " + file; return; } if (!doc.setContent(&tpl)) { tpl.close(); qDebug() << "Failed to load the File as XML..."; return; } tpl.close(); QFileInfo info(file); templatePath = info.canonicalPath(); loadFonts(); elements.clear(); QDomNodeList tl = doc.elementsByTagName("template"); if (tl.size() > 0 && tl.at(0).isElement()) { QDomElement t = tl.at(0).toElement(); paperSize = QPrinter::A4; if (t.hasAttribute("size")) { QString size = t.attribute("size").toUpper(); if (size == "A4") { paperSize = QPrinter::A4; } else if (size == "A5") { paperSize = QPrinter::A5; } else if (size == "A6") { paperSize = QPrinter::A6; } else if (size == "LETTER") { paperSize = QPrinter::Letter; } } paperOrientation = QPrinter::Portrait; if (t.hasAttribute("orientation")) { QString orient = t.attribute("orientation").toLower(); if (orient == "landscape") { paperOrientation = QPrinter::Landscape; } } QDomNodeList nl = t.childNodes(); for (int i = 0; i < nl.size(); i++) { QDomNode n = nl.item(i); if (n.isElement() && n.nodeName().toLower() == "g") { QDomElement elem = n.toElement(); if (elem.hasAttribute("part") && !elem.attribute("part").isEmpty()) { elements.insert(elem.attribute("part").toLower(), PdfElement::fromElement(elem, templatePath)); } } } } }
OpenGLCanvas::OpenGLCanvas() : //OpenGLComponent(OpenGLComponent::OpenGLType::openGLDefault, true), scrollPix(0), scrollTime(0), scrollDiff(0), originalScrollPix(0), scrollBarWidth(15), PI(3.1415926), showScrollTrack(true), animationIsActive(false), refreshMs(100) { loadFonts(); timer = new Time(); }
int gfxSetResolution() { SDL_VideoInfo* videoInfo; video.screenW = video.screenWtoApply; video.screenH = video.screenHtoApply; if (video.screenAA) { SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4); } video.flags = SDL_OPENGL; if (video.screenFS) video.flags |= SDL_FULLSCREEN; else video.flags |= SDL_RESIZABLE; videoInfo = (SDL_VideoInfo*) SDL_GetVideoInfo(); if (!video.screenW || !video.screenH || video.screenFS) { video.screenW = videoInfo->current_w; video.screenH = videoInfo->current_h; } video.sdlScreen = SDL_SetVideoMode(video.screenW, video.screenH, video.screenBPP, video.flags ); if (!video.sdlScreen) { conAdd(LERR, "SDL_SetVideoMode failed: %s", SDL_GetError()); return 1; } glEnable(GL_TEXTURE_2D); // need to (re)load textures if (!loadFonts()) return 2; if (!loadParticleTexture()) return 3; loadSkyBox(); // not sure if we need to re-attach to new surface //if (video.agarStarted == 1) { // if (AG_SetVideoSurfaceSDL(video.sdlScreen) == -1) { // ( conAdd(LERR, "agar error while attaching to resized window: %s", AG_GetError() ); // } //} return 0; }
BtFontChooserWidget::BtFontChooserWidget(QWidget* parent) : QFrame(parent) , m_htmlText(DEFAULT_FONT_PREVIEW_TEXT) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); createLayout(); connectListWidgets(); loadFonts(); setFrameStyle(QFrame::Box); setFrameShadow(QFrame::Raised); retranslateUi(); }
void Resource::load() { atexit( clearResource ); loadImage( "atlas.png", "ATLAS" ); loadImage( "background.jpg", "BACKGROUND" ); loadImage( "menu_background.jpg", "MENU_BACKGROUND" ); loadImage( "level_background.png", "LEVEL_BACKGROUND" ); loadFonts(); // wczytanie map MapManager::load(); }
void GameApp::loadData() { // Load textures. textures.resize(iNumOfTextures); textures[0] = loadTexture("../data/textures/button.png"); textures[START_SCREEN] = loadTexture("../data/textures/start.png"); textures[OPTIONS_SCREEN] = loadTexture("../data/textures/options.png"); textures[HOWTO_SCREEN] = loadTexture("../data/textures/howto.png"); textures[PLAY_SCREEN] = loadTexture("../data/textures/round1.png"); textures[PLAY_SCREEN+1] = loadTexture("../data/textures/round2.png"); textures[PLAY_SCREEN+2] = loadTexture("../data/textures/round3.png"); // Load sounds and fonts. loadSounds(); loadFonts(); }
void MainWindowImpl::loadOptions() { /* Load figlet path*/ figletPath = opt->figletPath(); /* Load last used font */ fontsPath = opt->fontsPath(); loadFonts(); // Search fonts QString lastFont = opt->lastFont(); int idx = 0; if (lastFont != "") idx = comboFonts->findText(lastFont, Qt::MatchExactly); comboFonts->setCurrentIndex(idx); }
/************************************************************************* Load all resources for this scheme *************************************************************************/ void Scheme::loadResources(void) { Logger::getSingleton().logEvent("---- Begining resource loading for GUI scheme '" + d_name + "' ----", Informative); // load all resources specified for this scheme. loadXMLImagesets(); loadImageFileImagesets(); loadFonts(); loadLookNFeels(); loadWindowRendererFactories(); loadWindowFactories(); loadFactoryAliases(); loadFalagardMappings(); Logger::getSingleton().logEvent("---- Resource loading for GUI scheme '" + d_name + "' completed ----", Informative); }
bool Graphics::construct(const char *font, const char *boldFont) { logEntered(); _surface = SDL_GetWindowSurface(_window); SDL_GetWindowSize(_window, &_w, &_h); bool result = false; if (loadFonts(font, boldFont)) { _screen = new Canvas(); if (_screen && _screen->create(getWidth(), getHeight())) { _drawTarget = _screen; maSetColor(DEFAULT_BACKGROUND); result = true; } } return result; }
SkinnedSettings::SkinnedSettings(QWidget *parent) : QWidget(parent) { m_ui.setupUi(this); m_ui.listWidget->setIconSize (QSize (105,34)); m_skin = Skin::instance(); m_reader = new SkinReader(this); connect(m_ui.skinReloadButton, SIGNAL (clicked()), SLOT(loadSkins())); readSettings(); loadSkins(); loadFonts(); createActions(); //setup icons m_ui.skinInstallButton->setIcon(QIcon::fromTheme("list-add")); m_ui.skinReloadButton->setIcon(QIcon::fromTheme("view-refresh")); m_ui.popupTemplateButton->setIcon(QIcon::fromTheme("configure")); }
void ofxGuiGlobals::buildFromXml() { int numberOfTags = mXml.getNumTags("STYLE"); if(numberOfTags != 1) return; mXml.pushTag("STYLE", 0); mHeadFontName = mXml.getValue("HEADFONT", "Questrial-Regular.ttf"); mHeadFontSize = mXml.getValue("HEADSIZE", 14); mHeadFontXOffset = mXml.getValue("HEADXOFF", -2); mHeadFontYOffset = mXml.getValue("HEADYOFF", 10); mHeadFontHeight = mXml.getValue("HEADHEIGHT", 12); mParamFontName = mXml.getValue("PARAMFONT", "Questrial-Regular.ttf"); mParamFontSize = mXml.getValue("PARAMSIZE", 10); mParamFontXOffset = mXml.getValue("PARAMXOFF", -2); mParamFontYOffset = mXml.getValue("PARAMYOFF", 10); mParamFontHeight = mXml.getValue("PARAMHEIGHT", 12); mButtonXText = mXml.getValue("BUTTONXTEXT", 4); mButtonYText = mXml.getValue("BUTTONYTEXT", 0); mFilesXText = mXml.getValue("FILESXTEXT", 3); mFilesYText = mXml.getValue("FILESYTEXT", 3); mPointSize = mXml.getValue("POINTSIZE", 6); mKnobSize = mXml.getValue("KNOBSIZE", 10); mCoverColor = ofRGBA(mXml.getValue("COVERCOLOR", "00000088")); mTextColor = ofRGBA(mXml.getValue("TEXTCOLOR", "FFFFFFFF")); mBorderColor = ofRGBA(mXml.getValue("BORDERCOLOR", "FFFFFFFF")); mFrameColor = ofRGBA(mXml.getValue("FRAMECOLOR", "FFFFFFFF")); mSliderColor = ofRGBA(mXml.getValue("SLIDERCOLOR", "0099FFFF")); mAxisColor = ofRGBA(mXml.getValue("AXISCOLOR", "00FF00FF")); mHandleColor = ofRGBA(mXml.getValue("HANDLECOLOR", "FFFFFFFF")); mButtonColor = ofRGBA(mXml.getValue("BUTTONCOLOR", "FFDD00FF")); mCurveColor = ofRGBA(mXml.getValue("CURVECOLOR", "FF9900FF")); mScopeColor = ofRGBA(mXml.getValue("SCOPECOLOR", "FF9900FF")); mMatrixColor = ofRGBA(mXml.getValue("ACTIVECOLOR", "FF0000FF")); mXml.popTag(); loadFonts(); }
int main(int argc, char* argv[]) { #if defined(Q_OS_MAC) if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); // FIX: Mac OSX 10.9 (Mavericks) font issue: https://bugreports.qt-project.org/browse/QTBUG-32789 #endif //Application::setOrganizationName("CasparCG"); //Application::setApplicationName("CasparCG Client"); Application::setGraphicsSystem("raster"); Application application(argc, argv); application.setStyle("plastique"); loadDatabase(application); DatabaseManager::getInstance().initialize(); loadStyleSheets(application); loadFonts(application); EventManager::getInstance().initialize(); GpiManager::getInstance().initialize(); MainWindow window; loadConfiguration(application, window); window.show(); LibraryManager::getInstance().initialize(); DeviceManager::getInstance().initialize(); AtemDeviceManager::getInstance().initialize(); TriCasterDeviceManager::getInstance().initialize(); OscDeviceManager::getInstance().initialize(); int returnValue = application.exec(); EventManager::getInstance().uninitialize(); DatabaseManager::getInstance().uninitialize(); GpiManager::getInstance().uninitialize(); OscDeviceManager::getInstance().uninitialize(); TriCasterDeviceManager::getInstance().uninitialize(); AtemDeviceManager::getInstance().uninitialize(); DeviceManager::getInstance().uninitialize(); LibraryManager::getInstance().uninitialize(); return returnValue; }
Font initFont() { Font font; int i; for (i = 0; i < MAX_FONT ; i++) font.font[i] = NULL; if(!TTF_WasInit() && TTF_Init() == -1) { fprintf(stderr, "Erreur d'initialisation de TTF_Init : %s\n", TTF_GetError()); exit(EXIT_FAILURE); } loadFonts(&font); return font; }
FontService::FontService() { // Create a default // XXX Should verify the font actually exists // Hmm... I think create no fonts by default, for clients that don't want them // ci::Font font("Times New Roman", 24); // mFonts[DEFAULT_FN] = ci::gl::TextureFont::create(font); loadFonts(); // Handy little font printer #if 0 const std::vector<std::string>& list(ci::Font::getNames()); for (const auto& it : list) { std::cout << "Font=" << it << std::endl; } #endif }
int doInit(Uint32 vidFlags, int doWipe) { int i; BrInitError error; if(br_init(&error, "kuri2d") == 0 && error != BR_INIT_ERROR_DISABLED) { printf("Warning: BinReloc failed to initialize (error code %d)\n", error); printf("Will fallback to hardcoded default path.\n"); } if(SDL_Init((Uint32)(SDL_INIT_VIDEO | SDL_INIT_AUDIO))) { printf("Unable to init SDL: %s\n", SDL_GetError()); return 0; } (void)atexit(SDL_Quit); (void)atexit(TTF_Quit); /* malloc some defaults - they *should* be reloaded later */ level = (KuriLevel *)malloc(sizeof(KuriLevel)); startState = malloc(sizeof(State)); state = malloc(sizeof(State)); strcpy(state->name, "Player"); state->level = (Uint8)0; state->score = (Uint8)0; state->lives = (Uint8)3; for(i=0; i<MAX_HISCORES; i++) { strcpy(hiscores[i].name, "nobody"); hiscores[i].score = 0; hiscores[i].level = 0; } if(level && startState && state && (doWipe ? 1 : loadHiScores()) && loadBackgrounds() && loadBlocks() && loadLevels() && loadSounds() && loadFonts() && loadTexts() && openFrame(vidFlags)) { return 1; } return 0; }
void assetHandle::init(dbHandle& db_obj, std::string skin_id) { //std::vector<dbHandle::assetItem> items = db_obj.getIconPaths(); //for (int i = 0; i < items.size(); i++) //{ // sf::Texture texture; // texture.setSmooth(true); // texture.loadFromFile(items.at(i).path); // std::pair<std::string,sf::Texture> pair (items.at(i).id,texture); // textureMap.insert(pair); //} loadFonts(db_obj.exe_path + "\\skins\\" + skin_id + "\\fonts"); iconMap = loadImages(db_obj.exe_path + "\\icons"); textureMap = loadImages(db_obj.exe_path + "\\skins\\" + skin_id + "\\system"); staticImagesMap = loadImages(db_obj.exe_path + "\\skins\\" + skin_id + "\\pngs"); companiesMap = loadImages(db_obj.exe_path + "\\companies"); }
/** * Constructs the Selector object * @param withpreview If a font preview should be given * @param parent The parent of the Font Selector * @param name The name of the object * @param fl WidgetFlags */ OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) { d = new OFontSelectorPrivate ( ); QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); gridLayout->setRowStretch ( 4, 10 ); d-> m_font_family_list = new QListBox( this, "FontListBox" ); gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); connect( d-> m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); QLabel *label = new QLabel( tr( "Style" ), this ); gridLayout->addWidget( label, 0, 1 ); d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); connect( d-> m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); label = new QLabel( tr( "Size" ), this ); gridLayout->addWidget( label, 2, 1 ); d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); connect( d-> m_font_size_list, SIGNAL( activated(int) ), this, SLOT( fontSizeClicked(int) ) ); gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); d-> m_pointbug = ( qt_version ( ) <= 233 ); if ( withpreview ) { d-> m_preview = new QMultiLineEdit ( this, "Preview" ); d-> m_preview-> setAlignment ( AlignCenter ); d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); d-> m_preview-> setMargin ( 3 ); d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); gridLayout-> addRowSpacing ( 5, 4 ); gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); gridLayout-> setRowStretch ( 6, 5 ); } else d-> m_preview = 0; loadFonts ( d-> m_font_family_list ); }
/// --- FUNCTIONS --- int init_Engine(){ int flags; //Init SDL if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) return 1; //Init TTF if( TTF_Init() == -1 ) return 2; flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; if( SETTINGS.getFullScreen() ) flags |= SDL_WINDOW_FULLSCREEN; //Create Windows WINDOW_MAIN = SDL_CreateWindow( "GAME PROJECT", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SETTINGS.getScreenWidth(), SETTINGS.getScreenHeight(), flags );//| SDL_WINDOW_FULLSCREEN if( WINDOW_MAIN == NULL ) return 3; //Create Renderer RENDERER_MAIN = SDL_CreateRenderer( WINDOW_MAIN, 0, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC ); if( RENDERER_MAIN == NULL ) return 4; //Set Hints SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" + SETTINGS.getRenderScaleQuality() );//"1" //Init Fonts loadFonts(); // -- INIT CLASSES -- CONS .init(); ASSETS .init(); MAP .init(); EDIT_MODE .init(); return 0; }