void GLabel::setLabel(const std::string& str) { this->str = str; stanfordcpplib::getPlatform()->glabel_setLabel(this, str); GDimension size = stanfordcpplib::getPlatform()->glabel_getSize(this); width = size.getWidth(); height = size.getHeight(); }
/* * Main program. */ int main() { if (RANDOM_USE_SEED) { setRandomSeed(106); } setConsoleLocation(WINDOW_WIDTH + 6 * kMargin, 30); // temporary setConsoleSize(450, 400); setConsoleEventOnClose(true); initializeGUI(); Point guiLoc = gWindow->getLocation(); GDimension guiSize = gWindow->getSize(); setConsoleLocation( guiLoc.getX() + guiSize.getWidth() + kMargin, guiLoc.getY()); // Main event loop to process events as they happen. while (true) { GEvent e = waitForEvent(ACTION_EVENT | MOUSE_EVENT | WINDOW_EVENT); if (e.getEventType() == MOUSE_CLICKED || e.getEventType() == MOUSE_MOVED) { processMouseEvent(GMouseEvent(e)); } else if (e.getEventClass() == ACTION_EVENT) { processActionEvent(GActionEvent(e)); } else if (e.getEventClass() == WINDOW_EVENT) { processWindowEvent(GWindowEvent(e)); } } return 0; }
void GLabel::setLabel(string str) { this->str = str; pp->setLabel(this, str); GDimension size = pp->getGLabelSize(this); width = size.getWidth(); height = size.getHeight(); }
void GLabel::setFont(const std::string& font) { this->font = font; stanfordcpplib::getPlatform()->glabel_setFont(this, font); GDimension size = stanfordcpplib::getPlatform()->glabel_getSize(this); width = size.getWidth(); height = size.getHeight(); ascent = stanfordcpplib::getPlatform()->glabel_getFontAscent(this); descent = stanfordcpplib::getPlatform()->glabel_getFontDescent(this); }
void GLabel::setFont(string font) { this->font = font; pp->setFont(this, font); GDimension size = pp->getGLabelSize(this); width = size.getWidth(); height = size.getHeight(); ascent = pp->getFontAscent(this); descent = pp->getFontDescent(this); }
void GLabel::createGLabel(const std::string& str) { this->str = str; stanfordcpplib::getPlatform()->glabel_constructor(this, str); setFont(DEFAULT_GLABEL_FONT); GDimension size = stanfordcpplib::getPlatform()->glabel_getSize(this); width = size.getWidth(); height = size.getHeight(); ascent = stanfordcpplib::getPlatform()->glabel_getFontAscent(this); descent = stanfordcpplib::getPlatform()->glabel_getFontDescent(this); }
void GLabel::create(const string & str) { this->str = str; pp->createGLabel(this, str); setFont(DEFAULT_GLABEL_FONT); GDimension size = pp->getGLabelSize(this); width = size.getWidth(); height = size.getHeight(); ascent = pp->getFontAscent(this); descent = pp->getFontDescent(this); }
void GImage::createGImage(const std::string& filename) { this->filename = filename; GDimension size = stanfordcpplib::getPlatform()->gimage_constructor(this, filename); width = size.getWidth(); height = size.getHeight(); }
void GOval::setSize(const GDimension& size) { setSize(size.getWidth(), size.getHeight()); }
void GImage::create(string filename) { this->filename = filename; GDimension size = pp->createGImage(this, filename); width = size.getWidth(); height = size.getHeight(); }
GRectangle GInteractor::getBounds() const { GDimension size = getPlatform()->ginteractor_getSize((GObject *) this); return GRectangle(x, y, size.getWidth(), size.getHeight()); }
void GInteractor::setSize(const GDimension& size) { setSize(size.getWidth(), size.getHeight()); }