void Sphere::initValues(){ _posX = 0.0, _posZ = 0.0, _deltaPosX = 0.5, _deltaPosY = 0.5, _deltaPosZ = 0.5; _rotX = 0.0, _rotY = 0.0, _rotZ = 0.0, _deltaRotX = 5.0, _deltaRotY = 5.0, _deltaRotZ = 5.0; _scaleX = 1.0; _scaleY = 1.0; _scaleZ = 1.0; setPosY(0.0); _radius = 10.0; _arrayColor[0] = 0.0, _arrayColor[1] = 0.5, _arrayColor[2] = 0.8, _arrayColor[3] = 1.0; //_sourceFactor = GL_SRC_ALPHA, _destFactor = GL_ONE_MINUS_SRC_ALPHA; _sourceFactor = GL_SRC_ALPHA, _destFactor = GL_ONE_MINUS_SRC_ALPHA; _slices = 20, _stacks = 20; _matAmbient[0] = 1.0 ,_matAmbient[1] = 1.0,_matAmbient[2] = 1.0, _matAmbient[3] = 1.0; _matDiffuse[0] = 1.0 ,_matDiffuse[1] = 1.0,_matDiffuse[2] = 1.0, _matDiffuse[3] = 1.0; _matSpecular[0] = 1.0 ,_matSpecular[1] = 1.0,_matSpecular[2] = 1.0, _matSpecular[3] = 1.0; _velocity = -2.0; _timeJump = 0.0; _angleParabolicMove = 30.0; _state = ' '; _direction = "r"; initQuad(0); //glutTimerFunc(DELTA_FALL_TIME, checkState, 1); }
Sphere::Sphere(GLdouble x, GLdouble y, GLdouble z, GLfloat rad, GLfloat r, GLfloat g, GLfloat b, GLfloat alpha){ initValues();//Init predef values //We Give the new values _posX = x, _posZ = z; setPosY(y); _radius = rad; _arrayColor[0] = r, _arrayColor[1] = g, _arrayColor[2] = b,_arrayColor[3] = alpha; }
Sphere::Sphere(GLdouble x, GLdouble y, GLdouble z, GLfloat rad){ initValues();//Init predef values //We Give the new values _posX = x, _posZ = z; setPosY(y); _initPosY = _posY; _radius = rad; }
void Element::adjustPosition(Manifold* collidingObjectManifold) { const qreal percent = .5; const qreal slop = .05; qreal correction_x = std::max<qreal>(collidingObjectManifold->penetration, slop) / (this->getInvWeight() + collidingObjectManifold->second_object->getInvWeight()) * percent * collidingObjectManifold->normal_x; qreal correction_y = std::max<qreal>(collidingObjectManifold->penetration, slop) / (this->getInvWeight() + collidingObjectManifold->second_object->getInvWeight()) * percent * collidingObjectManifold->normal_y; setPosX(x() - this->getInvWeight() * correction_x); setPosY(y() - this->getInvWeight() * correction_y); }
Unit::Unit(float pos_x, float pos_y, std::string name) : EntityAction(pos_x, pos_y, UNIT_INV_CAP) { setSprite( new Sprite(pos_x, pos_y, UNIT_CLICK_WIDTH, UNIT_CLICK_HEIGHT, UNIT_CLICK_OFFSET_X, UNIT_CLICK_OFFSET_Y) ); setPosX(pos_x); setPosY(pos_y); setName(name); setDead(false); }
IElement::IElement(unsigned int hp, unsigned int posX ,unsigned int posY, unsigned int sizeX, unsigned int sizeY, int speed, std::string* skin){ setHp(hp); setPosX(posX); setPosY(posY); setSizeX(sizeX); setSizeY(sizeY); setSpeed(speed); setSkin(skin); return ; }
void Settings::readSettings() { setLanguage(value(KEY_LANGUAGE, defaultValue(KEY_LANGUAGE)).toString()); setPlaylist(value(KEY_PLAYLIST, defaultValue(KEY_PLAYLIST)).toString()); setPlaylistUpdate(value(KEY_PLAYLIST_UPDATE, defaultValue(KEY_PLAYLIST_UPDATE)).toBool()); setPlaylistUpdateUrl(value(KEY_PLAYLIST_UPDATE_URL, defaultValue(KEY_PLAYLIST_UPDATE_URL)).toString()); setRadioCategory(value(KEY_RADIO_CATEGORY, defaultValue(KEY_RADIO_CATEGORY)).toString()); setHdCategory(value(KEY_HD_CATEGORY, defaultValue(KEY_HD_CATEGORY)).toString()); setUdpxy(value(KEY_UDPXY, defaultValue(KEY_UDPXY)).toBool()); setUdpxyUrl(value(KEY_UDPXY_URL, defaultValue(KEY_UDPXY_URL)).toString()); setUdpxyPort(value(KEY_UDPXY_PORT, defaultValue(KEY_UDPXY_PORT)).toInt()); setWidth(value(KEY_WIDTH, defaultValue(KEY_WIDTH)).toInt()); setHeight(value(KEY_HEIGHT, defaultValue(KEY_HEIGHT)).toInt()); setPosX(value(KEY_POS_X, defaultValue(KEY_POS_X)).toInt()); setPosY(value(KEY_POS_Y, defaultValue(KEY_POS_Y)).toInt()); setOsd(value(KEY_OSD, defaultValue(KEY_OSD)).toBool()); setTrayEnabled(value(KEY_TRAY_ENABLED, defaultValue(KEY_TRAY_ENABLED)).toBool()); setHideToTray(value(KEY_HIDE_TO_TRAY, defaultValue(KEY_HIDE_TO_TRAY)).toBool()); setMouseWheel(value(KEY_MOUSE_WHEEL, defaultValue(KEY_MOUSE_WHEEL)).toString()); setRememberGuiSession(value(KEY_REMEMBER_GUI_SESSION, defaultValue(KEY_REMEMBER_GUI_SESSION)).toBool()); setIcons(value(KEY_ICONS, defaultValue(KEY_ICONS)).toString()); setVout(value(KEY_VOUT, defaultValue(KEY_VOUT)).toInt()); setAout(value(KEY_AOUT, defaultValue(KEY_AOUT)).toInt()); setYuvToRgb(value(KEY_YUV_TO_RGB, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool()); setSpdif(value(KEY_SPDIF, defaultValue(KEY_SPDIF)).toBool()); setRememberVideoSettings(value(KEY_REMEMBER_VIDEO_SETTINGS, defaultValue(KEY_REMEMBER_VIDEO_SETTINGS)).toBool()); setRememberVideoPerChannel(value(KEY_REMEMBER_VIDEO_PER_CHANNEL, defaultValue(KEY_REMEMBER_VIDEO_PER_CHANNEL)).toBool()); setAspectRatio(value(KEY_ASPECT_RATIO, defaultValue(KEY_ASPECT_RATIO)).toInt()); setCropRatio(value(KEY_CROP_RATIO, defaultValue(KEY_CROP_RATIO)).toInt()); setDeinterlacing(value(KEY_DEINTERLACING, defaultValue(KEY_DEINTERLACING)).toInt()); setAudioLanguage(value(KEY_AUDIO_LANGUAGE, defaultValue(KEY_AUDIO_LANGUAGE)).toString()); setSubtitleLanguage(value(KEY_SUBTITLE_LANGUAGE, defaultValue(KEY_SUBTITLE_LANGUAGE)).toString()); setMuteOnMinimize(value(KEY_MUTE_ON_MINIMIZE, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool()); setTeletext(value(KEY_TELETEXT, defaultValue(KEY_TELETEXT)).toBool()); setRecorderDirectory(value(KEY_RECORDER_DIRECTORY, defaultValue(KEY_RECORDER_DIRECTORY)).toString()); setSnapshotsDirectory(value(KEY_SNAPSHOTS_DIRECTORY, defaultValue(KEY_SNAPSHOTS_DIRECTORY)).toString()); setSessionAutoplay(value(KEY_SESSION_AUTOPLAY, defaultValue(KEY_SESSION_AUTOPLAY)).toBool()); setSessionChannel(value(KEY_SESSION_CHANNEL, defaultValue(KEY_SESSION_CHANNEL)).toInt()); setSessionRememberVolume(value(KEY_SESSION_REMEMBER_VOLUME, defaultValue(KEY_SESSION_REMEMBER_VOLUME)).toBool()); setSessionVolume(value(KEY_SESSION_VOLUME, defaultValue(KEY_SESSION_VOLUME)).toInt()); setXmltvUpdate(value(KEY_XMLTV_UPDATE, defaultValue(KEY_XMLTV_UPDATE)).toBool()); setXmltvUpdateLocation(value(KEY_XMLTV_UPDATE_LOCATION, defaultValue(KEY_XMLTV_UPDATE_LOCATION)).toString()); setXmltvUpdateRemote(value(KEY_XMLTV_UPDATE_REMOTE, defaultValue(KEY_XMLTV_UPDATE_REMOTE)).toBool()); }
Sphere::Sphere(GLdouble x, GLdouble y, GLdouble z, GLfloat rad, GLfloat r, GLfloat g, GLfloat b,GLfloat alpha, GLfloat ambiental[4], GLfloat diffuse[4], GLfloat specular[4]){ initValues();//Init predef values //We Give the new values _posX = x, _posZ = z; setPosY(y); _radius = rad; _arrayColor[0] = r, _arrayColor[1] = g, _arrayColor[2] = b,_arrayColor[3] = alpha; _matAmbient[0] = ambiental[0] ,_matAmbient[1] = ambiental[1],_matAmbient[2] = ambiental[2], _matAmbient[3] = ambiental[3]; _matDiffuse[0] = diffuse[0] ,_matDiffuse[1] = diffuse[1],_matDiffuse[2] = diffuse[2], _matDiffuse[3] = diffuse[3]; _matSpecular[0] = specular[0] ,_matSpecular[1] = specular[1] ,_matSpecular[2] = specular[2] , _matSpecular[3] = specular[3]; }
Sprite::Sprite(float x, float y, float click_w, float click_h, float click_offset_x, float click_offset_y, float scale) { //click w and h define the width and height of click collide rect, offset are pos corrections mFilename = "res/images/iso/map/0.png"; setPosX(x); setPosY(y); mRenderer = nullptr; mWindow = nullptr; setClickHeight(click_h); setClickWidth(click_w); setClickOffsetX(click_offset_x); setClickOffsetY(click_offset_y); setScale(scale); }
Bomb::Bomb(int _X, int _Y): Sprites("Balst.png",3 , 5){ //set fuse animation loop loopMode(true, 0 ,5); setWH(20 ,20); //this is a blastlet setBlast(true); //initialises the objects member variables setPosX(_X); setPosY(_Y); setPos(getPosX(), getPosY()); }
TextLine::TextLine(float x, float y, float w, float h, std::string message, TextMaker * maker) { mTexture = nullptr; setPosX(x); setPosY(y); setWidth(w); setHeight(h); setTextMaker(maker); //loadText(message); setText(message); setActive(false); }
void Entity::load(QXmlStreamReader *xml) { setPosX(xml->attributes().value("x").toString().toInt()); setPosY(xml->attributes().value("y").toString().toInt()); setPosZ(xml->attributes().value("z").toString().toInt()); setTexX(xml->attributes().value("tx").toString().toFloat()); setTexY(xml->attributes().value("ty").toString().toFloat()); setAngle(xml->attributes().value("angle").toString().toInt()); setWidth(xml->attributes().value("width").toString().toInt()); setHeight(xml->attributes().value("height").toString().toInt()); tex = TexturesManager::getInstance()->getTexture(xml->attributes().value("texture").toString()); xml->skipCurrentElement(); xml->readNext(); }
Sprite::Sprite(std::string filename, float x, float y, SDL_Renderer *renderer, SDL_Window *window, float scale) { mTexture = nullptr; mRenderer = nullptr; mWindow = nullptr; mTexture = loadTexture(filename, renderer, true); mRenderer = renderer; mWindow = window; setPosX(x); setPosY(y); setScale(scale); //SDL_Rect * mRect = new SDL_Rect() }
Bomb::Bomb(int _X, int _Y, int _F, int _T): Sprites("Balst.png",3 , 5){ //set fuse animation loop loopMode(true, 10 ,15); //initialises the objects member variables setPosX(_X); setPosY(_Y); setPos(getPosX(), getPosY()); setBombTicks(_T); setFlame(_F); setWH(20 ,20); //not used yet setUsed(false); //not igniting setIgnite(false); //is a bomb not a blast setBlast(false); }
void CEnemy::update(){ if (isDieing){ return; } // Gravity if (getPosY() < 480 - entity.getHeight()){ velosityY += 0.5f; onGround = false; } else { onGround = true; velosityY = 0; } // Follow if (entity.getPosX() < player->getPosX()){ entity.setPosX(entity.getPosX() + 3); } if (entity.getPosX() > player->getPosX()){ entity.setPosX(entity.getPosX() - 3); } // if collide with player if (entity.getPosX() + entity.getWidth() > player->getPosX() && // Right entity.getPosX() - entity.getWidth() < player->getPosX() && // Left entity.getPosY() - entity.getWidth() <= player->getPosY()){ // Up player->hit(&isDieing); } setPosY(getPosY() + velosityY); }
void Drawable::setPosition(float x, float y) // Set position. Two coordinates. { setPosX(x); setPosY(y); }
void Element::updateStateY(void) { //accelerationY += 0; this->setVelocityY(this->getVelocityY() + this->getAccelerationY() / 100); setPosY(scenePos().y() + this->getVelocityY() * 10 / 100); }
void Ball::reset() { setPosX(4); setPosY(3); drop(); }
void Sphere::setPos(GLdouble pos[3]){ _posX = pos[0]; _posZ = pos[2]; setPosY((GLdouble)pos[1]); }