Exemplo n.º 1
0
void Base::AddBackground(std::string const& file_name, latex::String const& latex_name, Crosssection const& crosssection, boca::Mass const& mass, std::string const& path)
{
    INFO0;
    auto file_info = boca::FileInfo{{file_name}, latex_name, crosssection, mass};
    file_info.SetPath(path);
    AddBackground(file_info);
}
Exemplo n.º 2
0
/*************************************************************************
 * AM-CONTROL-CHANGE-DATA-VIEW
 *************************************************************************/
AmControlChangeDataView::AmControlChangeDataView(	BRect frame,
													AmSongRef songRef,
													AmTrackWinPropertiesI& trackWinProps,
													const AmViewPropertyI& viewProp,
													TrackViewType viewType)
		: inherited(songRef, trackWinProps, viewProp, viewType, frame, STR_CONTROL_CHANGE_DATA,
				B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW | B_FRAME_EVENTS),
		  mMeasureBg(NULL), mCc(INITIAL_CC)
{
	mCachedPrimaryTrack = mTrackWinProps.OrderedTrackAt(0);
	mTarget = new _AmControlTarget(trackWinProps, this);
	if (viewProp.Configuration() ) Configure(viewProp.Configuration() );

	ArpBackground*		bg = new AmPropGridBackground(trackWinProps);
	if (bg) AddBackground(bg);
	mMeasureBg = new AmTrackMeasureBackground(mSongRef, mCachedPrimaryTrack, mMtc);
	if (mMeasureBg) AddBackground(mMeasureBg);
	bg = new ArpFloorBackground( this, Prefs().Color(AM_DATA_FG_C) );
	if (bg) AddBackground(bg);
}
Exemplo n.º 3
0
bool
Lua::StartFile(Path path, Error &error)
{
  lua_State *L = Lua::NewFullState();
  if (!RunFile(L, path, error)) {
    lua_close(L);
    return false;
  }

  if (IsPersistent(L))
    AddBackground(L);
  else
    lua_close(L);

  return true;
}
Exemplo n.º 4
0
//-----------------------------------------------------------------------------------------------------------------------------------
void LevelDesignScreen::HandleInput(float elapsedSeconds)
{
  BaseScreen::HandleInput(elapsedSeconds);

  if (AcceptsInput())
  {
    GameMouse& gameMouse = GetScreenManager()->GetGameMouse();
    KeyboardInput& keyboard = GetScreenManager()->GetKeyboardInput();

    // If the Q key is pressed we remove the current selected tile
    if (keyboard.IsKeyPressed(Keyboard::Q))
    {
      RemoveInGameUIObject(m_currentTile);
      m_currentTile = nullptr;
    }

    if (keyboard.IsKeyPressed(Keyboard::B))
    {
      AddBackground();
    }

    if (gameMouse.IsClicked(MouseButton::kLeftButton))
    {
      AddLevelObject(gameMouse.GetInGamePosition());
    }

    if (m_currentTile)
    {
      if (keyboard.IsKeyPressed(Keyboard::E))
      {
        m_currentTile->SetLocalRotation(m_currentTile->GetLocalRotation() + XM_PIDIV2);
      }
      else if (keyboard.IsKeyDown(Keyboard::A))
      {
        m_currentTile->SetLocalRotation(m_currentTile->GetLocalRotation() - 0.01f);
      }
      else if (keyboard.IsKeyDown(Keyboard::D))
      {
        m_currentTile->SetLocalRotation(m_currentTile->GetLocalRotation() + 0.01f);
      }
    }

    HandleObjectTypeChange(keyboard);
  }
}
Exemplo n.º 5
0
ScalingTest::ScalingTest( SDL_Surface* screen )
{
	int i, j;
	//KrMatrix2 xForm;
	state = BOTH;

	//
	// Create the engine, load the dat files, get the resource.
	//
	engine = new KrEngine( screen );
	GLASSERT( engine );

	if ( !engine->Vault()->LoadDatFile( "space.dat" ) )
	{
		GLOUTPUT(( "Error loading 'space.dat'\n" ));
		exit(100);
	}

	fontVault = new KrResourceVault();
	if ( !fontVault->LoadDatFile( "font.dat" ) )
	{
		GLOUTPUT(( "Error loading 'font.dat'\n" ));
		exit(100);
	}

	KrSpriteResource* shipRes = engine->Vault()->GetSpriteResource( "MED" );
	GLASSERT( shipRes );
	KrSpriteResource* smallShipRes = engine->Vault()->GetSpriteResource( "SMALL" );
	GLASSERT( smallShipRes );
	KrFontResource*	fontConsole = fontVault->GetFontResource( "CONSOLE" );
	GLASSERT( fontConsole );

	KrRGBA white, red;
	white.Set( 255, 255, 255 );
	red.Set( 255, 0, 0 );

	AddBackground();

	// A group of travelling ships.
	travellingShip = new KrSprite( shipRes );
	travellingShip->SetAction( "BODY" );
	travellingShip->SetPos( 500, 390 );
	engine->Tree()->AddNode( 0, travellingShip );

	for ( i=0; i<4; ++i )
	{
		KrSprite* escort = new KrSprite( smallShipRes );
		escort->SetPos( 10 + i*30, -55 + i*30 );
		engine->Tree()->AddNode( travellingShip, escort );
	}

	travelText = new KrTextBox( fontConsole, 300, 300, 1 );
	engine->Tree()->AddNode( travellingShip, travelText );
	travelText->SetPos( -60, 30 );
	travelText->SetTextChar( "sin wave motion", 0 );



	//
	// Zoom 3 canvases to compare. The canvas are set up by drawing
	// a sprite to a canvas.
	//
	int hotx, hoty;
	KrCanvasResource* canvasRes = shipRes->CreateCanvasResource( "BODY", 0, &hotx, &hoty );
	GLASSERT( canvasRes );
	GLASSERT( canvasRes->Alpha() );
	engine->Vault()->AddResource( canvasRes );

	for( i=0; i<canvasRes->Width(); ++i )
	{
		for( j=0; j<canvasRes->Height(); ++j )
		{
			KrRGBA* pixel = canvasRes->Pixels() + j*canvasRes->Width() + i;
			if ( pixel->c.alpha )
				pixel->c.alpha = i * 256 / canvasRes->Width();
		}
	}

	for( i=0; i<3; ++i )
	{
		canvas[i] = new KrCanvas( canvasRes );
		canvas[i]->SetPos( 50 + i * 200, 170 );
		engine->Tree()->AddNode( 0, canvas[i] );
	}
	canvas[0]->SetQuality( KrQualityFast );
	canvas[1]->SetQuality( KrQualityLinear );
	canvas[2]->SetQuality( KrQualityAdaptive );


	// A sprite that scales in the upper left.
	// A resource to mark the center of the sprite.
	KrBoxResource* centerRes = new KrBoxResource( "Center",
												  5, 5,
												  &red, 1,
												  KrBoxResource::CROSSHAIR );
	engine->Vault()->AddResource( centerRes );

	// The ship that scales in the upper left
	ship = new KrSprite( shipRes );
	ship->SetAction( "BODY" );
	ship->SetPos( SHIPX, SHIPY );
	engine->Tree()->AddNode( 0, ship );


	// Center marker of the sprite
	center = new KrBox( centerRes );
	engine->Tree()->AddNode( 0, center );
	center->SetPos( SHIPX, SHIPY );

	// Some text info.
	textBox = new KrTextBox( fontConsole, 1024, 1024, 0 );
	textBox->SetPos( 10, 10 );
	engine->Tree()->AddNode( 0, textBox );

	scaleX.v = GlFixed_1 - GlFixed_1 / 8;
	scaleY.v = GlFixed_1 - GlFixed_1 / 8;
	AddText( engine );
}