function sceneManager() { createLetters() ; while(1) // While game is running,... { // ..keep checking for keyboard input LetterPressedAscii = inchar( KeyboardInput ) ; // Convert input into ASCII and store in myVariable wait(1); } }
BuildFontDialog::BuildFontDialog(Poppler::Document *pdf) { doc = pdf; currentPage = 0; QPushButton *saveToFileButton = new QPushButton(tr("Save")); QPushButton *confirmButton = new QPushButton(tr("OK")); QPushButton *closeButton = new QPushButton(tr("Cancel")); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(confirmButton, SIGNAL(clicked()), this, SLOT(testFun())); connect(saveToFileButton, SIGNAL(clicked()), this, SLOT(saveToFile())); imageLabel = new ImageLabel; imageLabel->setBackgroundRole(QPalette::Base); imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); imageLabel->setScaledContents(true); scrollArea = new QScrollArea; scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(imageLabel); connect(imageLabel, SIGNAL(clicked(const QPoint & )), this, SLOT(pickLetter(const QPoint & ))); QPushButton *previousButton = new QPushButton(tr("Previous")); QPushButton *nextButton = new QPushButton(tr("Next")); connect(previousButton, SIGNAL(clicked()), this, SLOT(goPrevious())); connect(nextButton, SIGNAL(clicked()), this, SLOT(goNext())); pageIndicator = new QLabel; QRadioButton *displayOriginal = new QRadioButton(tr("Original")); QRadioButton *displayBoxed = new QRadioButton(tr("Boxed")); isBoxedDisplay.addButton(displayOriginal); isBoxedDisplay.addButton(displayBoxed); displayOriginal->setChecked(true); selectionArbitrary = new QCheckBox(); selectionArbitrary->setChecked(false); selectionArbitrary->setText("Arbitrary Rectangle"); arbitraryLastPoint.setX(-1); connect(displayOriginal, SIGNAL(clicked()), this, SLOT(displayOriginalPage())); connect(displayBoxed, SIGNAL(clicked()), this, SLOT(displayBoxedPage())); QHBoxLayout *pageNavigationLayout = new QHBoxLayout; pageNavigationLayout->addStretch(); pageNavigationLayout->addWidget(previousButton); pageNavigationLayout->addWidget(pageIndicator); pageNavigationLayout->addWidget(nextButton); pageNavigationLayout->addStretch(); pageNavigationLayout->addWidget(selectionArbitrary); pageNavigationLayout->addStretch(); pageNavigationLayout->addWidget(displayOriginal); pageNavigationLayout->addWidget(displayBoxed); pageNavigationLayout->addStretch(); QHBoxLayout *lowerCases = new QHBoxLayout; QHBoxLayout *upperCases = new QHBoxLayout; buttonGroup= new QButtonGroup; createLetters(lowerCases, upperCases); connect(buttonGroup,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(displayFontEditorFor(QAbstractButton*))); QVBoxLayout *lettersLayout = new QVBoxLayout; lettersLayout->addLayout(lowerCases); lettersLayout->addLayout(upperCases); QHBoxLayout *letterAdjustAndLetters = new QHBoxLayout; fontEditor = new NCSAFontEditor(&builtFont); letterAdjustAndLetters->addLayout(fontEditor); letterAdjustAndLetters->addLayout(lettersLayout); QHBoxLayout *testLayout = new QHBoxLayout; testInput = new QLineEdit; testDisplay = new QLabel; testLayout->addWidget(testInput); testLayout->addStretch(); testLayout->addWidget(testDisplay); connect(testInput,SIGNAL(textChanged(QString)),this,SLOT(testInputChanged(QString))); QVBoxLayout *verticalLayout = new QVBoxLayout; verticalLayout->addWidget(scrollArea); verticalLayout->addLayout(pageNavigationLayout); verticalLayout->addLayout(letterAdjustAndLetters); verticalLayout->addLayout(testLayout); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(1); buttonsLayout->addWidget(saveToFileButton); buttonsLayout->addWidget(confirmButton); buttonsLayout->addWidget(closeButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(verticalLayout); //mainLayout->addStretch(1); //mainLayout->addSpacing(12); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); resize(1000, 600); setWindowTitle(tr("Font Creater")); displayPage(); }