Exemplo n.º 1
0
    /*!
    * @brief Initilize everything SDL needs at the start
    */
    void GLGraphics::Init(void) //Initilize SDL
    {
      // Register the components needed for graphics.
      RegisterComponent(MC_Transform);
      RegisterComponent(MC_Sprite);

      CreateMesh();

      // Create the default shader.
      ShaderPtr defaultShader(new GLShader());

      // Load the shader files for the default shader.
      defaultShader->LoadShaderFile("dvert.glsl", "dfrag.glsl", 0);

      // Compile the shaders.
      defaultShader->Compile();

      // Find the variables in the shaders that will be modified by the end-users.
      defaultShader->FindUniforms("model");
      defaultShader->FindUniforms("view");
      defaultShader->FindUniforms("proj");
      defaultShader->FindUniforms("color");
      
      

      // Add the shader to the ShaderMap.
      addShader("Box", defaultShader);

    }
Exemplo n.º 2
0
    void Test::Init()
    {
      // Register the spaces that should be updated with this system.
      RegisterSpace("Game World");

      // Set which space this gamestate's Update() function should be used with.
      SetLogicalSpace("Game World");

      // Register for drawable objects
      RegisterComponent(MC_Transform);
      RegisterComponent(MC_Sprite);
      RegisterComponent(MC_Particle);


      switch (DemoToUse)
      {
      case (Demo::Pretzel):
        PretzelInit(200);
        break;
      case (Demo::FireBall):
        FireBallInit(200);
        break;
      case Demo::Explosion:
        ExplosionInit(200);
        break;
      default:
        break;
      }
      
    }
Exemplo n.º 3
0
	//Initializes Direct3D
	void Graphics::Initialize()
	{
		//Create the D3D object (the parameter is there to make sure the app was built correctly).
		pD3D = Direct3DCreate9(D3D_SDK_VERSION);

		D3DDISPLAYMODE displayMode;
		pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &displayMode);

		//Set up the structure used to create the D3DDevice.
		ZeroMemory(&PresentParameters, sizeof(PresentParameters));

		D3DPRESENT_PARAMETERS& pp = PresentParameters;
		pp.Windowed = true;						//You can't just set this to FALSE--you'll need to change other stuff as well.
		pp.SwapEffect = D3DSWAPEFFECT_DISCARD;	//Picks the best way to handle back buffers for you, but it means you have draw a full screen every time.
		pp.BackBufferFormat = D3DFMT_UNKNOWN;	//This is for windowed apps, full screen will need to be explicit.
		pp.PresentationInterval  = D3DPRESENT_DONOTWAIT;
		pp.BackBufferWidth = ScreenWidth;
		pp.BackBufferHeight = ScreenHeight;

		//Create the D3DDevice
    // IF THIS CALL FAILS:
    //   The most common cause is you are trying to run this on a machine that
    //   does not support hardware vertex processing. At DigiPen, this probably means
    //   your machine does not have a graphics card. Get one, switch machines, or 
    //   alternatively replace the D3DCREATE_HARDWARE_VERTEXPROCESSING constant below 
    //   with D3DCREATE_SOFTWARE_VERTEXPROCESSING.
		DXVerify(pD3D->CreateDevice(D3DADAPTER_DEFAULT,	//The graphics adapter to be used.
									  D3DDEVTYPE_HAL,		//Type of graphics device: Hardware acceleration or software
									  HWnd,					//Window Handle for the device.
									  D3DCREATE_HARDWARE_VERTEXPROCESSING,	//Device behavior: vertex processing (software, mixed, hardware), double precision, etc.
									  &pp,				//The presentation parameters created above.
 									  &pDevice));			//A pointer to the new device.

		//Set our render states (culling, lighting, shading, zbuffers, etc.).
		pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);			//Turn off culling
		pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);					//Turn off D3D lighting
		pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);			//Turn on alpha blending.
		pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);		//Use the texture's alpha channel.
		pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);	//Use the inverse of the texture's alpha channel.

		SurfaceSize = Vec2((float)ScreenWidth, (float)ScreenHeight);


		RegisterComponent(Sprite);
		RegisterComponent(Camera);
    RegisterComponent(Text);

		//FACTORY->AddComponentCreator("Sprite", new ComponentCreatorType<Sprite>() );
		//FACTORY->AddComponentCreator("CameraView", new ComponentCreatorType<CameraView>

		//Load all of our assets (textures and shaders)
		GRAPHICS->LoadAssets();



	}
Exemplo n.º 4
0
void			ClientManager::Init_Components()
{
  _session = new Component_Session(this);
  _channel = new Component_Channel(this);
  _friend  = new Component_Friend(this);
  _room  = new Component_Room(this);
  _jam  = new Component_Jam(this);
  RegisterComponent(_session);
  RegisterComponent(_channel);
  RegisterComponent(_friend);
  RegisterComponent(_room);
  RegisterComponent(_jam);
}
Exemplo n.º 5
0
void		ServerManager::Init_Components()
{
  _sessionManager = new Component_SessionManager(this);
  _channelManager = new Component_ChannelManager(this);
  _friendManager  = new Component_FriendManager(this);
  _roomManager  = new Component_RoomManager(this);
  _jamManager  = new Component_JamManager(this);
  RegisterComponent(_sessionManager);
  RegisterComponent(_channelManager);
  RegisterComponent(_friendManager);
  RegisterComponent(_roomManager);
  RegisterComponent(_jamManager);
}
Exemplo n.º 6
0
void RegisterWineDataHandler( void )
{
    ComponentRoutineUPP MyComponentRoutineUPP;

    MyComponentRoutineUPP = NewComponentRoutineUPP(&myComponentRoutineProc);
    RegisterComponent( &myType , MyComponentRoutineUPP, 0, NULL, NULL, NULL);
}
Exemplo n.º 7
0
void GameManager::AddComponentToGameObject(GameObject* object, Component* componentToAdd)
{
	if(object != NULL && componentToAdd != NULL)
	{
		object->AddComponent(componentToAdd);
		RegisterComponent(componentToAdd);
	}
}
void RegisterExampleIPBDecompressor(void)
{
	ComponentDescription td;
	
	td.componentType = decompressorComponentType;
	td.componentSubType = FOUR_CHAR_CODE('EIPB');
	td.componentManufacturer = kAppleManufacturer;
	td.componentFlags = cmpThreadSafe;
	td.componentFlagsMask = 0;

	RegisterComponent(&td,(ComponentRoutineUPP)ExampleIPB_DComponentDispatch, 0, NULL, NULL, NULL);
}
Exemplo n.º 9
0
void GameManager::AddGameObject(GameObject* gameObject)
{
	if(gameObject != NULL)
	{
		_gameObjects.push_back(std::unique_ptr<GameObject>(gameObject));

		const std::vector<Component*>& componentList = gameObject->GetComponents();
		for(unsigned int i = 0; i < componentList.size(); i++)
		{
			RegisterComponent(componentList[i]);
		}
	}
}
void DelegateOnly_CodecRegister(void)
{
	ComponentDescription td;

	ComponentRoutineUPP componentEntryPoint = NewComponentRoutineUPP((ComponentRoutineProcPtr)DelegateOnly_ImageCodecComponentDispatch);

	td.componentType = decompressorComponentType;
	td.componentSubType = FOUR_CHAR_CODE('DelO');		// remember to change the subType and manufacturer
	td.componentManufacturer = FOUR_CHAR_CODE('DTS ');  // for your application - Apple reserves all lowercase types
	td.componentFlags = codecInfoDoes32;
	td.componentFlagsMask = 0;

	RegisterComponent(&td, componentEntryPoint, 0, NULL, NULL, NULL);
}
Exemplo n.º 11
0
STDAPI
DllRegisterServer(void)
{
    RegisterComponent(CLSID_StartMenu, L"Shell Start Menu");
    RegisterComponent(CLSID_MenuDeskBar, L"Shell Menu Desk Bar");
    RegisterComponent(CLSID_MenuBand, L"Shell Menu Band");
    RegisterComponent(CLSID_MenuBandSite, L"Shell Menu Band Site");
    RegisterComponent(CLSID_MergedFolder, L"Merged Shell Folder");
    RegisterComponent(CLSID_RebarBandSite, L"Shell Rebar Band Site");
    return S_OK;
}
Exemplo n.º 12
0
void CPluginManager::EnumAllPlugins(CString strDir)
{
	CString strDllPath;
	CStringArray strArrPlugins;

	GetFilePathsFromDir(strDir, strArrPlugins, _T("dll"));

	for(int i = 0; i < strArrPlugins.GetSize(); i++)
	{
		PLUGINS* pPlugins = new PLUGINS;
		strDllPath = strArrPlugins.GetAt(i);
		pPlugins->strDllPath = strDllPath;
		pPlugins->strDllName = GetNameFormPath(strDllPath);
		pPlugins->bRegistered = RegisterComponent(strDllPath);
		m_lstPlugins.AddTail(pPlugins);
	}
}
Exemplo n.º 13
0
void MyQTImage2MovDirectRegister(void)
{   ComponentDescription	theComponentDescription;
    Handle					nameHdl;
#if !TARGET_API_MAC_CARBON
    ComponentRoutineUPP componentEntryPoint = NewComponentRoutineProc(QTImage2MovImportDirect_ComponentDispatch);
#else
    ComponentRoutineUPP componentEntryPoint = NewComponentRoutineUPP((ComponentRoutineProcPtr)QTImage2MovImportDirect_ComponentDispatch);
#endif

    PtrToHand("\pQI2MSource", &nameHdl, 8);
    theComponentDescription.componentType = MovieImportType;
    theComponentDescription.componentSubType = FOUR_CHAR_CODE('VOD ');
    theComponentDescription.componentManufacturer = kAppleManufacturer;
    theComponentDescription.componentFlags = canMovieImportFiles | canMovieImportInPlace | hasMovieImportMIMEList | canMovieImportDataReferences;
    theComponentDescription.componentFlagsMask = 0;

    RegisterComponent(&theComponentDescription, componentEntryPoint, 0, nameHdl, 0, 0);
}
Exemplo n.º 14
0
VolumeCatcherImpl::VolumeCatcherImpl()
{
	mVolume = 1.0;	// default to full volume
	mPan = 0.0;		// and center pan
		
	ComponentDescription desc;
	desc.componentType = kAudioUnitType_Output;
	desc.componentSubType = kAudioUnitSubType_DefaultOutput;
	desc.componentManufacturer = kAudioUnitManufacturer_Apple;
	desc.componentFlags = 0;
	desc.componentFlagsMask = 0;
	
	// Find the original default output component
	mOriginalDefaultOutput = FindNextComponent(NULL, &desc);

	// Register our own output component with the same parameters
	mVolumeAdjuster = RegisterComponent(&desc, NewComponentRoutineUPP(volume_catcher_component_entry), 0, NULL, NULL, NULL);

	// Capture the original component, so we always get found instead.
	CaptureComponent(mOriginalDefaultOutput, mVolumeAdjuster);

}
Exemplo n.º 15
0
WorldEntityManager::WorldEntityManager(Filesystem::path directory, int worldWidth, int minQuadWidth) : PersistenceEntityManager::PersistenceEntityManager(directory), m_player(nullptr), m_quadTree(Rectangle(0,0,worldWidth,worldWidth),minQuadWidth)
{
	//----------------------------------------------------------------
	// Register the components
	RegisterComponent([] {return new Components::Player();});
	RegisterComponent([] {return new Components::Position();});
	RegisterComponent([] {return new Components::Movement();});
	RegisterComponent([] {return new Components::Collision();});
	RegisterComponent([] {return new Components::Terrain();});
	RegisterComponent([] {return new Components::PositionNormalTextureVBO();});
	RegisterComponent([] {return new Components::PositionNormalTextureTangentColorVBO(); });
	RegisterComponent([] {return new Components::Model();});
	RegisterComponent([] {return new Components::Action();});
	RegisterComponent([] {return new Components::Building();});
	RegisterComponent([] {return new Components::Inventory();});
	//----------------------------------------------------------------
	// Tags
	RegisterDelegate([](string type) {return new Components::Tag(type);}, vector<string>{
		"Water",
		"Tree"
	});
	//----------------------------------------------------------------
	// Parse configuration file
	JsonParser config = JsonParser(std::ifstream("config/WorldEntityManager.json"));
	m_entityRegionWidth = (unsigned int)config["EntityRegionWidth"];
	JsonParser continentConfig = JsonParser(std::ifstream("config/continent.json"));
	m_worldWidth = (unsigned int)continentConfig["terrainMap"]["width"];

	

	//----------------------------------------------------------------
	// Event Handlers
	IEventManager::RegisterHandler(Entity_ComponentAdded, std::function<void(unsigned int, unsigned long)>([=](unsigned int target, unsigned long mask) {
		if (mask == ComponentMask("Position")) {
			AddEntityToRegion(target);
		}
	}));
	//----------------------------------------------------------------
	// Cache entity regions
	auto regions = FindEntities(ComponentMask(vector<string>{"EntityRegion", "Position"}));
	m_entityRegions = std::set<EntityPtr>(regions.begin(),regions.end());
}
Exemplo n.º 16
0
 /*!
 * @brief Gets everything the camera needs
 */
 void CameraSystem::Init()
 {
   RegisterComponent(MC_Camera);
   RegisterComponent(MC_Transform);
 }
 void RegisterComponents(void)
 {
   RegisterComponent(Transform);
   RegisterComponent(Model);
   RegisterComponent(Controller);
 }
Exemplo n.º 18
0
 void WeaponController::Init()
 {
   RegisterComponent(MC_Weapon);
   RegisterComponent(MC_Transform);
 }