void display (void) { // this code executes whenever the window is redrawn (when opened, // moved, resized, etc. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // set the viewing transform setUpView(); // set up light source setUpLight(); // start drawing objects drawt1Text(); drawTank1(); drawTank2(); //drawCone(); drawGround(); drawSheet1(); if (bulletflag1 == 1) { drawBullet1(); } if (bulletflag2 == 1) { drawBullet2(); } glutSwapBuffers(); }
void gameLoop(XStuff* xs, GameState* gs, InputState* is) { checkResize(xs,gs); preFrame(gs); handleInput(gs, is); setUpView(gs); // update world state // depth and picking pre-pass glDepthFunc(GL_LESS); glBindFramebuffer(GL_FRAMEBUFFER, gs->framebuffer); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); depthPrepass(xs, gs, is); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, gs->framebuffer); checkCursor(gs, is); glBindFramebuffer(GL_FRAMEBUFFER, gs->framebuffer); // clear color buffer for actual rendering //glClear(GL_COLOR_BUFFER_BIT); glerr("pre shader create 1d"); glDepthFunc(GL_LEQUAL); glerr("pre shader create e"); renderFrame(xs, gs, is); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, gs->framebuffer); // draw to the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); shadingPass(gs); renderUI(xs, gs); gs->screen.resized = 0; glXSwapBuffers(xs->display, xs->clientWin); }
bool TimeLayer::init() { if(!CCLayer::init()) { return false; } setUpView(); //schedule this->schedule(schedule_selector(TimeLayer::timeCounting),1.0); return true; }
bool OptionLayer::init(){ bool sRect = false; do { CC_BREAK_IF( !BaseLayer::init() ); CC_BREAK_IF( !setUpView() ); sRect = true; } while (0); return sRect; }
GameObjectClass::GameObjectClass(){ for(int i=0; i<3; ++i){ size[i] = 1; rand_size.min[i] = 1; rand_size.max[i] = 1; } rand_size.proportional = 0; group = "no_group"; rand_rotate = 1; mvLock = 0; buildTime = 0; speed = 0; cost.gold = 0; cost.lim = 0; setUpView(view); setUpView(view1); isInvulnerable = 1; atack.isAgressor = 1; atack.isUpgrade = 0; atack.land_land.atackRange = 0; atack.land_land.damage = 0; atack.land_land.time = 0; atack.land_land.bullet = "worker"; maxHp = 100; view.surface_scerting = 0; selectable = 1; }
TableWidget_View::TableWidget_View(QWidget *parent) : QWidget(parent), ui(new Ui::TableWidget_View) { ui->setupUi(this); setWindowTitle("Table Widget / Table View"); setUpWidget(); setUpView(); // this was done in the UI form // ui->splitter->setHandleWidth(10); // adjust size of the widget based QSize size = this->size(); setMinimumWidth( size.width() ); setMinimumHeight( size.height() ); }
void display (void) { // this code executes whenever the window is redrawn (when opened, // moved, resized, etc. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // set the viewing transform setUpView(); setUpLight(); // start drawing objects glEnable(GL_DEPTH_TEST); drawFish(); glDisable(GL_DEPTH_TEST); drawBubbles(); glutSwapBuffers(); }
void display (void) { // this code executes whenever the window is redrawn (when opened, // moved, resized, etc. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // set the viewing transform setUpView(); // set up light source setUpLight(); // start drawing objects setUpModelTransform(); drawMounts(); glutSwapBuffers(); }
void display (void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); setUpView(); setUpLight(); setUpModelTransform(); if (trackballMove) { glPushMatrix(); glLoadIdentity(); glRotatef(angle, axis[0], axis[1], axis[2]); glMultMatrixf((GLfloat *) trackballXform); glGetFloatv(GL_MODELVIEW_MATRIX, trackballXform); glPopMatrix(); } glPushMatrix(); glMultMatrixf((GLfloat *) objectXform); drawObjs(); glPopMatrix(); glutSwapBuffers(); }
void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); setUpView(); }
void initgl (void) { glClearColor (0., 0., 0., 0.); glShadeModel (GL_FLAT); setUpView(); }
bool OptionLayer::setUpView(){ bool sRect = false; do { //1.set background setBackgroundImage( UserDefault::getInstance() -> getStringForKey( __BACKGROUND_IMAGE_NAME__,__BACK_GROUND_IMAGE_1__ ).c_str() ); //2.add a title auto pOptionTitle = MenuItemFont::create( "Option" ); pOptionTitle -> setPosition( Point( winSize.width / 2, winSize.height - 40 )); this -> addChild( pOptionTitle ); //3.add menu //a.sound switch MenuItemFont::setFontName(__ARIRL_14_FNT__); MenuItemFont::setFontSize(24); auto titleSound = MenuItemFont::create("Sound"); titleSound -> setEnabled(false); MenuItemFont::setFontName( __ARIRL_14_FNT__ ); MenuItemFont::setFontSize(34); auto pTrigger = MenuItemToggle::createWithCallback( CC_CALLBACK_1( OptionLayer::music_trigger_callback,this ), MenuItemFont::create( "Music: Off" ), MenuItemFont::create( "Music: On"), NULL ); /**********setFont based on background music stats*******************************/ if( !UserDefault::getInstance() -> getBoolForKey( __MUSIC_NOT_PLAYING__ )) { pTrigger -> setSelectedIndex(0); }else { pTrigger -> setSelectedIndex(1); } /******************************************************************************/ pTrigger -> setPosition( Point( winSize.width / 2,winSize.height / 2 + 50)); //b.exchange background pic //title MenuItemFont::setFontName( __ARIRL_14_FNT__ ); MenuItemFont::setFontSize( 24 ); auto titleSettingBackground = MenuItemFont::create( "Setting Background"); titleSettingBackground -> setEnabled(false); //create 3 item auto pBg1Item = MenuItemImage::create( __BACK_GROUND_IMAGE_1_NORMAL__,__BACK_GROUND_IMAGE_1_SELECTED__, [&](Ref *pSender){ SettingManagement::changeBackgroundImage( BACK_GROUND_IMAGE_1 ); setUpView(); }); auto pBg2Item = MenuItemImage::create( __BACK_GROUND_IMAGE_2_NORMAL__,__BACK_GROUND_IMAGE_2_SELECTED__, [&](Ref *pSender){ SettingManagement::changeBackgroundImage( BACK_GROUND_IMAGE_2 ); setUpView(); }); auto pBg3Item = MenuItemImage::create( __BACK_GROUND_IMAGE_3_NORMAL__,__BACK_GROUND_IMAGE_3_SELECTED__, [&](Ref *pSender){ SettingManagement::changeBackgroundImage( BACK_GROUND_IMAGE_3 ); setUpView(); }); //set button size pBg1Item -> setScaleX( 0.2f ); pBg2Item -> setScaleX( 0.2f ); pBg3Item -> setScaleX( 0.2f ); pBg1Item -> setScaleY( 0.1f ); pBg2Item -> setScaleY( 0.1f ); pBg3Item -> setScaleY( 0.1f ); //setPosition //c.GoBack MenuItemFont::setFontName( __ARIRL_14_FNT__ ); MenuItemFont::setFontSize( 34 ); auto pGoBack = MenuItemFont::create("Go Back",CC_CALLBACK_1(OptionLayer::menuReturnCallback ,this)); pGoBack -> setPosition( Point(winSize.width / 2, origin.y + 40 )); //add above into menu auto MainMenu = Menu::create(titleSound, pTrigger ,pGoBack, nullptr ); auto ViceMenu = Menu::create(pBg1Item, pBg2Item, pBg3Item, nullptr); ViceMenu -> alignItemsHorizontallyWithPadding( 10.0f ); //set anchor point ViceMenu -> setAnchorPoint( Point( 0 , 0.5 ) ); //set position MainMenu -> setPosition( Point::ZERO ); ViceMenu -> setPosition( Point(winSize.width / 2, origin.y + 150 )); //add child addChild( MainMenu ); addChild( ViceMenu ); sRect = true; } while (0); return sRect; }