예제 #1
0
// Window
Window::Window(uint16 id, int16 xPos, int16 yPos,
		int16 width, int16 height,
		Bitmap* background)
	:
	fID(id),
	fBackground(background),
	fWidth(width),
	fHeight(height),
	fActiveControl(NULL)
{
	fPosition.x = xPos;
	fPosition.y = yPos;

	// TODO: Not very nice. Here we check if the window would sit
	// on the right side on the screen on 640x480, and move it if
	// the screen is larger than that. We also check if the window would
	// span into the full width of the screen, and resize it accordingly.
	GFX::rect screenRect = GraphicsEngine::Get()->ScreenFrame();
	if (screenRect.w > 640) {
		if (xPos + width == 640) {
			if (xPos == 0) {
				// Full screen window. Resize
				SetFrame(xPos, yPos, screenRect.w, screenRect.h);
			} else {
				SetFrame(screenRect.w - width, yPos, width, height);
			}
		}
	}
}
예제 #2
0
파일: CalcWindow.cpp 프로젝트: mariuz/haiku
CalcWindow::CalcWindow(BRect frame, BMessage* settings)
	: BWindow(frame, kWindowTitle, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	// create calculator view with calculator description and
	// desktop background color
	BScreen screen(this);
	rgb_color baseColor = screen.DesktopColor();

	SetSizeLimits(100.0, 400.0, 100.0, 400.0);

	frame.OffsetTo(B_ORIGIN);
	fCalcView = new CalcView(frame, baseColor, settings);

	// create replicant dragger
	BRect replicantFrame(frame);
	replicantFrame.top = replicantFrame.bottom - 7.0f;
	replicantFrame.left = replicantFrame.right - 7.0f;
	BDragger* dragger = new BDragger(replicantFrame, fCalcView,
		B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);

	// attach views
	AddChild(fCalcView);
	fCalcView->AddChild(dragger);

	BRect rect;
	if (settings->FindRect("window frame", &rect) == B_OK)
		SetFrame(rect);
	else
		SetFrame(frame, true);
}
예제 #3
0
void Body::UpdateFrame()
{
	if (!(GetFlags() & Body::FLAG_CAN_MOVE_FRAME)) return;

	// falling out of frames
	if (!GetFrame()->IsLocalPosInFrame(GetPosition())) {
		printf("%s leaves frame %s\n", GetLabel().c_str(), GetFrame()->GetLabel().c_str());

		Frame *new_frame = GetFrame()->m_parent;
		if (new_frame) { // don't let fall out of root frame
			matrix4x4d m = matrix4x4d::Identity();
			GetFrame()->ApplyLeavingTransform(m);

			vector3d new_pos = m * GetPosition();

			matrix4x4d rot;
			GetRotMatrix(rot);
			SetRotMatrix(m * rot);
			
			m.ClearToRotOnly();
			SetVelocity(GetFrame()->GetVelocity() + m*(GetVelocity() - 
				GetFrame()->GetStasisVelocityAtPosition(GetPosition())));

			SetFrame(new_frame);
			SetPosition(new_pos);

			Pi::luaOnFrameChanged->Queue(this);
			
			return;
		}
	}

	// entering into frames
	for (std::list<Frame*>::iterator j = GetFrame()->m_children.begin(); j != GetFrame()->m_children.end(); ++j) {
		Frame *kid = *j;
		matrix4x4d m;
		Frame::GetFrameTransform(GetFrame(), kid, m);
		vector3d pos = m * GetPosition();
		if (!kid->IsLocalPosInFrame(pos)) continue;
		
		printf("%s enters frame %s\n", GetLabel().c_str(), kid->GetLabel().c_str());

		SetPosition(pos);
		SetFrame(kid);

		matrix4x4d rot;
		GetRotMatrix(rot);
		SetRotMatrix(m * rot);
				
		// get rid of transforms
		m.ClearToRotOnly();
		SetVelocity(m*(GetVelocity() - kid->GetVelocity())
			+ kid->GetStasisVelocityAtPosition(pos));

		Pi::luaOnFrameChanged->Queue(this);

		break;
	}
}
예제 #4
0
void ShipCockpit::RenderCockpit(Graphics::Renderer* renderer, const Camera* camera, Frame* frame)
{
	PROFILE_SCOPED()
	renderer->ClearDepthBuffer();
	SetFrame(frame);
	Render(renderer, camera, m_translate, m_transform);
	SetFrame(nullptr);
}
예제 #5
0
void hgeAnimation::Play()
{
    bPlaying=true;
    fSinceLastFrame=-1.0f;
    if(Mode & HGEANIM_REV) {
        nDelta = -1;
        SetFrame(nFrames-1);
    } else {
        nDelta = 1;
        SetFrame(0);
    }
}
예제 #6
0
파일: hgeanim.cpp 프로젝트: kvakvs/hge
void hgeAnimation::SetMode(const int mode) {
    mode_ = mode;

    if (mode & HGEANIM_REV) {
        delta_ = -1;
        SetFrame(frames_ - 1);
    }
    else {
        delta_ = 1;
        SetFrame(0);
    }
}
예제 #7
0
파일: hgeanim.cpp 프로젝트: kvakvs/hge
void hgeAnimation::Play() {
    is_playing_ = true;
    since_last_frame_ = -1.0f;
    if (mode_ & HGEANIM_REV) {
        delta_ = -1;
        SetFrame(frames_ - 1);
    }
    else {
        delta_ = 1;
        SetFrame(0);
    }
}
예제 #8
0
void hgeAnimation::SetMode(int mode)
{
    Mode=mode;

    if(mode & HGEANIM_REV) {
        nDelta = -1;
        SetFrame(nFrames-1);
    } else {
        nDelta = 1;
        SetFrame(0);
    }
}
예제 #9
0
파일: animation.cpp 프로젝트: bagobor/hgepp
void hgeAnimation::SetMode(anim_mode_t mode)
{
	m_play_mode = mode;

	if (mode & HGEANIM_REV)
	{
		m_delta = -1;
		SetFrame(m_frame_count - 1);
	}
	else
	{
		m_delta = 1;
		SetFrame(0);
	}
}
예제 #10
0
파일: animation.cpp 프로젝트: bagobor/hgepp
void hgeAnimation::Play()
{
	m_playing_flag = true;
	m_since_last_frame = -1.0f;
	if (m_play_mode & HGEANIM_REV)
	{
		m_delta = -1;
		SetFrame(m_frame_count - 1);
	}
	else
	{
		m_delta = 1;
		SetFrame(0);
	}
}
예제 #11
0
void Vessel::SetFrameGroup(StartAndEndFrameInfo* pFameInfo, float FrameSpeed)
{
	SetFrameStart( pFameInfo->StartFrame );
	SetEndFrame( pFameInfo->EndFrame );
	SetFrame( GetFrameStart() );
	SetFrameSpeed( FrameSpeed );  
}
예제 #12
0
void CWallHealth::Recharge(void)
{
	EMIT_SOUND( this, CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM );
	m_iJuice = gSkillData.GetHealthChargerCapacity();
	SetFrame( 0 );
	SetThink( &CWallHealth::SUB_DoNothing );
}
예제 #13
0
파일: view.cpp 프로젝트: Bluehorn/wxPython
// Clean up windows used for displaying the view.
bool DrawingView::OnClose(bool deleteWindow)
{
  if (!GetDocument()->Close())
    return false;

  // Clear the canvas in  case we're in single-window mode,
  // and the canvas stays.
  canvas->ClearBackground();
  canvas->view = (wxView *) NULL;
  canvas = (MyCanvas *) NULL;

  wxString s(wxTheApp->GetAppName());
  if (frame)
    frame->SetTitle(s);

  SetFrame((wxFrame*)NULL);

  Activate(false);

  if (deleteWindow)
  {
    delete frame;
    return true;
  }
  return true;
}
예제 #14
0
void CE_CBeam::BeamInit( const char *pSpriteName, float width )
{
	SetColor( 255, 255, 255 );
	SetBrightness( 255 );
	SetNoise( 0 );
	SetFrame( 0 );
	SetScrollRate( 0 );
	SetModelName( MAKE_STRING( pSpriteName ) );
	SetRenderMode( kRenderTransTexture );
	SetTexture( engine->PrecacheModel( pSpriteName ) );
	SetWidth( width );
	SetEndWidth( width );
	SetFadeLength( 0 );			// No fade

	for (int i=0;i<MAX_BEAM_ENTS;i++)
	{
		Set_m_hAttachEntity(i,NULL);
		Set_m_nAttachIndex(i, 0);
	}

	m_nHaloIndex	= 0;
	m_fHaloScale	= BEAM_DEFAULT_HALO_SCALE;
	m_nBeamType		= 0;
	m_nBeamFlags    = 0;
}
예제 #15
0
//////////////////////////////////////////////////////////////////////////////////
//Calculates tensor in reaction CM frame
//This is the same as KVTensP after using SetFrame("CM")
//_________________________________________________________________
KVTensPCM::KVTensPCM(void)
{
//
// Createur par default
//
   SetFrame("CM");
}
예제 #16
0
파일: view.cpp 프로젝트: czxxjtu/wxPython-1
// What to do when a view is created. Creates actual
// windows for displaying the view.
bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
{
    MyApp& app = wxGetApp();
    if ( app.GetMode() != MyApp::Mode_Single )
    {
        // create a new window and canvas inside it
        m_frame = app.CreateChildFrame(doc, this, true);
        m_frame->SetTitle("Drawing View");

        m_canvas = new MyCanvas(this, m_frame);
        m_frame->Show(true);
    }
    else // single document mode
    {
        // reuse the existing window and canvas
        m_frame = wxStaticCast(app.GetTopWindow(), wxFrame);
        m_canvas = app.GetMainWindowCanvas();
        m_canvas->SetView(this);

        // Associate the appropriate frame with this view.
        SetFrame(m_frame);

        // Make sure the document manager knows that this is the
        // current view.
        Activate(true);

        // Initialize the edit menu Undo and Redo items
        doc->GetCommandProcessor()->SetEditMenu(app.GetMainWindowEditMenu());
        doc->GetCommandProcessor()->Initialize();
    }

    return true;
}
예제 #17
0
// Clean up windows used for displaying the view.
bool DrawingView::OnClose(bool deleteWindow)
{
    if ( !wxView::OnClose(deleteWindow) )
        return false;

    Activate(false);

    // Clear the canvas in single-window mode in which it stays alive
    if ( wxGetApp().GetMode() == MyApp::Mode_Single )
    {
        m_canvas->ClearBackground();
        m_canvas->ResetView();
        m_canvas = NULL;

        if (GetFrame())
            wxStaticCast(GetFrame(), wxFrame)->SetTitle(wxTheApp->GetAppDisplayName());
    }
    else // not single window mode
    {
        if ( deleteWindow )
        {
            GetFrame()->Destroy();
            SetFrame(NULL);
        }
    }
    return true;
}
예제 #18
0
void
SpriteEditWindow::AddFrame	(sint32 add)
{
	m_frame +=add;

	SetFrame(m_frame);
}
예제 #19
0
void
TableBackgroundPainter::TableBackgroundData::SetFull(nsIFrame* aFrame)
{
  NS_PRECONDITION(aFrame, "null frame");
  SetFrame(aFrame);
  SetData();
}
예제 #20
0
// Fonction à appeler à chaque tours de boucle, prend le temps
// écoulé depuis le dernier appel à la fonction en paramètre
void Animated::anim(float ElapsedTime)
{
    // Si il n'est pas en pause et que l'animation est valide
    if (!Paused && myAnim != NULL)
    {
        // on retranche le temps écoulé a notre compteur
        myElapsedTime -= ElapsedTime;

        // Si Le temps entre chaque frame est atteint
        if (myElapsedTime <= 0.f)
        {
            // On réinitialise notre compteur
            myElapsedTime = myTime;

            // On passe a la frame suivante
            if (static_cast<unsigned>(myCurrentFrame + 1) < myAnim->Size())
                myCurrentFrame++;
            else
            {
                // Ou on a la premiere
                if (myLoop)
                    myCurrentFrame = 0;
                else
                {
                    // Si le mode Loop est désactivé, on stop l'animation
                    Stop();
                }
            }

            // On change la frame
            SetFrame(myCurrentFrame);
        }
    }
}
예제 #21
0
파일: aboutwin.cpp 프로젝트: PyroOS/Pyro
AboutWindow::AboutWindow(const Rect & r)
	:Window(r, "AboutAlbert", MSG_ABOUTWND_TITLE,
//	WND_NO_CLOSE_BUT | WND_NO_ZOOM_BUT | WND_NO_DEPTH_BUT |
//	WND_NO_BORDER | WND_NO_TITLE |
	WND_NOT_RESIZABLE,
	CURRENT_DESKTOP)
{
	os::Resources cRes(get_image_id());
	os::ResStream* pcStream = cRes.GetResourceStream("Calculator.png");
	if(pcStream == NULL)
		throw(os::errno_exception("Can't find resource Calculator.png!"));

	m_pcImage = new BitmapImage( pcStream );
	BitmapView* imv = new BitmapView( m_pcImage->GetBounds(), "bitmap", m_pcImage );
	AddChild(imv);

	Rect	frame = m_pcImage->GetBounds();
	Desktop	desktop;
	Point offset(desktop.GetResolution());

	offset.x = offset.x/2 - frame.Width()/2;
	offset.y = offset.y/2 - frame.Height()/2;

	SetFrame(frame + offset);
	
	delete pcStream;
}
예제 #22
0
void Image::Reset()
{
	// Set amount of rows & cols if animation is non-null
	rows = (animation == nullptr) ? 1 : animation->rows;
	cols = (animation == nullptr) ? 1 : animation->cols;

	max_frame = rows * cols - 1;
	
	// Find dimensions of the texture
	int _query = SDL_QueryTexture(texture, NULL, NULL, &width, &height);

	// Check for texture error
	if (_query < 0) Log::s(Log::e << "Texture query error occured on an Image" << SDL_GetError());

	frame_width = width / cols;
	frame_height = height / rows;
	src->w = frame_width;
	src->h = frame_height;

	// Reset routine for position, animation data, frame, and scale
	SetFrameDelay( (animation == nullptr) ? 1 : animation->delay );
	SetAnimate(true);
	SetPosition(0, 0);
	SetFrame(0);
	Scale(1.0f);
}
GUIinfoSelection::GUIinfoSelection(int x, int y, int w, int h):GUIpane(x, y, w, h)
{
	SetFrame(false);
	SetResizeable(true);
	minW=220;
	minH=h;
}
예제 #24
0
// 
// Sprite::VOnRestore - Chapter 10, page 321
//
void Sprite::VOnUpdate(int deltaMS)
{
	if (m_IsPaused)
	{
		return;	
	}

	m_ElapsedTime += deltaMS;

	// Only call SetFrame() if we have to.
	// We're guaranteed to have to advance at least one frame...

	if (m_ElapsedTime >= m_MSPerFrame)
	{
		DWORD const numFramesToAdvance = (m_ElapsedTime / m_MSPerFrame);

		m_ElapsedTime -= (numFramesToAdvance * m_MSPerFrame);

		int desiredFrame = GetFrame() + numFramesToAdvance;

		//Check if we're looping...
		if ((false==m_LoopingAnim) && (desiredFrame >= GetFrameCount()))
		{
			desiredFrame = GetFrameCount() - 1;	//Stay on last frame...
		}
		
		//Now advance our frame properly...
		SetFrame(desiredFrame);		
	}
}
예제 #25
0
PiranhaPlant::PiranhaPlant(int objectTypeID, int positionX, int positionY)
{
	//Object											//set id
	_Position = D3DXVECTOR2(positionX, positionY - 1.4 * 32);						//set position: positionY - 1.4 * 32 mục đích cho đi từ trên xuống lúc bắt đầu
	_Sprite = SpriteManager::GetInstance()->GetSprite(eSpriteID::ePiranhaPlant);	//set sprite
	_Size = D3DXVECTOR2(PIRANHAPLANT_WIDTH, PIRANHAPLANT_HEIGHT);					//set size
	_Velocity = D3DXVECTOR2(0, PIRANHAPLANT_VELOCITY_Y);	//set position
	_TypeSpriteID = eSpriteID::ePiranhaPlant;										//set type spriteID
	_MonsterTypeID = objectTypeID;
	SetObjectType(eMonsterDead);													//trạng thái chết tạm thời: để không bị va chạm khi mới vào: do đang ở dưới

	// PiranhaPlant
	_TimeStartFrame = GetTickCount();												//set time now
	_TimePerFrame = TIMES_TURN;														//set time the turn
	_TimeStartVelocity = GetTickCount();											//set time now
	_TimePerVelocity = TIMES_TURN_VELOCITY;											//set time the turn position+velocity
	SetFrame(objectTypeID);
	_MonsterVelocityX = -PIRANHAPLANT_VELOCITY_X;
	_MonsterVelocityY = -PIRANHAPLANT_VELOCITY_Y;
	_PositionY = positionY;															//set position turn away
	_TimeStartStop = GetTickCount();
	_TimePerStop = TIMES_TURN_STOP;
	_PiranhaPlantStop = false;
	_PiranhaPlantDanger = false;
}
예제 #26
0
//________________________________________________________________
void KVFlowTensor::init_KVFlowTensor()
{
    // PRIVATE method
    // Private initialisation method called by all constructors.
    // All member initialisations should be done here.
    //
    // You should also (if your variable calculates several different quantities)
    // set up a correspondance between named values and index number
    // using method SetNameIndex(const Char_t*,Int_t)
    // in order for GetValue(const Char_t*) to work correctly.
    // The index numbers should be the same as in your getvalue_int(Int_t) method.

    fType = KVVarGlob::kOneBody; // this is a 1-body variable

    // reference frame = "CM"
    // weight = NRKE [non-relativistic kinetic energy] (1/2m)

    SetFrame("CM");
    SetOption("weight", "NRKE");

    fTensor.Zero();

    SetNameIndex("FlowAngle", kFlowAngle);
    SetNameIndex("KinFlowRatio13", kKinFlowRatio13);
    SetNameIndex("KinFlowRatio23", kKinFlowRatio23);
    SetNameIndex("PhiReacPlane", kPhiReacPlane);
    SetNameIndex("SqueezeAngle", kSqueezeAngle);
    SetNameIndex("SqueezeRatio", kSqueezeRatio);
    SetNameIndex("NumberParts", kNumberParts);
}
예제 #27
0
파일: demux.c 프로젝트: qkepia/looplab
int WebPDemuxGetFrame(const WebPDemuxer* dmux, int frame, WebPIterator* iter) {
  if (iter == NULL) return 0;

  memset(iter, 0, sizeof(*iter));
  iter->private_ = (void*)dmux;
  return SetFrame(frame, iter);
}
예제 #28
0
void SkeletalEntity::Update(){
	if(!mAnimation.Get()) return;

	if(clock() - mLastUpdate > mUpdateInterval){
		if(!mPaused)
			SetFrame(mCurFrame + 1);

		if(max_loops != 0 && nb_loops >= max_loops){
				PauseAnimation();
			}

		mLastUpdate = clock();
	}

	for(unsigned int i = 0; i < mBoundEntities.Size(); ++i){
		BoundEntity& bound = mBoundEntities[i];
		bound.mEntity->SetTransform(mBoneMatricesAbs[mCurFrame][bound.mBoneID]);
	}

	BoundingBox tmp = mBoundingBox;
	tmp.mMax += Vector3(0.0f, 0.0f, 0.25f);

	mBoundingBoxTransformed.Reset();
	mBoundingBoxTransformed.AddTransformedBox(tmp, mBoneMatrices[mCurFrame][0] * mTransform);
}
예제 #29
0
ColorButton::ColorButton()
{
	style = &ToolBar::StyleDefault().buttonstyle;
	SetFrame(NullFrame());
	NoTrack();
	Transparent();
}
예제 #30
0
LogPosPopUp::LogPosPopUp()
{
	CtrlLayoutCancel(*this, "");
	cktype = CKOKCANCEL;
	SetFrame(BlackFrame());

	l.SetLabel("<");
	r.SetLabel(">");
	t.SetLabel("/\\");
	b.SetLabel("\\/");
	
	xa <<= THISBACK(XaCB);
	xb <<= THISBACK(XbCB);
	ya <<= THISBACK(YaCB);
	yb <<= THISBACK(YbCB);

	l <<= THISBACK(LRCB);
	r <<= THISBACK(LRCB);
	t <<= THISBACK(TBCB);
	b <<= THISBACK(TBCB);
	
	lt <<= THISBACK(LTCB);
	rt <<= THISBACK(RTCB);
	lb <<= THISBACK(LBCB);
	rb <<= THISBACK(RBCB);

	hc <<= THISBACK(HCCB);
	vc <<= THISBACK(VCCB);
	cc <<= THISBACK(CCCB);

	hs <<= THISBACK(HSCB);
	vs <<= THISBACK(VSCB);
	ss <<= THISBACK(SSCB);
}