Esempio n. 1
0
Crate::Crate(b2World* world, RenderWindow* win, float x, float y, float w, float h) : MovableObject(world,win,x,y,w,h)
{
	m_weight = 3.0f;
	createBox2dBody();
	loadAssets();

}
Esempio n. 2
0
int Game::InitSDL() {
	if( SDL_Init( SDL_INIT_EVERYTHING )<0 ) {
		fprintf( stderr, "Unable to init SDL: %s\n", SDL_GetError() );
		SDL_Quit();
		return 1;
	}
	if( TTF_Init()<0 ) {
		fprintf( stderr, "Unable to init SDL_TTF: %s\n", SDL_GetError() );
		return 7;
	}
	window_ = SDL_CreateWindow(
		"SDL Test Window",
		SDL_WINDOWPOS_CENTERED,
		SDL_WINDOWPOS_CENTERED,
		screenWidth_,
		screenHeight_,
		SDL_WINDOW_SHOWN );
	if( window_==nullptr ) {
		fprintf( stderr, "Create window failed: %s\n", SDL_GetError() );
		SDL_Quit();
		return 2;
	}
	renderer_ = SDL_CreateRenderer( window_, -1, SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC );
	if( renderer_==nullptr ) {
		fprintf( stderr, "Create Renderer fails: %s\n", SDL_GetError() );
		SDL_DestroyWindow( window_ );
		SDL_Quit();
		return 3;
	}
	SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "nearest" ); 
	SDL_RenderSetLogicalSize( renderer_, screenWidth_, screenHeight_ );
	loadAssets();
	return 0;
}
Esempio n. 3
0
bool ofxFlashXFL :: loadFile ( const string& file )
{
    vector<string> xflFileSplit;
    xflFileSplit	= ofSplitString( file, "/" );

    xflFile			= xflFileSplit[ xflFileSplit.size() - 1 ];
    xflFolder		= "";
    for( int i=0; i<xflFileSplit.size()-1; i++ )	// drop the file
    {
        xflFolder += xflFileSplit[ i ] + "/";
    }

    string xflPath;
    xflPath = xflFolder + xflFile;

    cout << "Loading, " << xflPath << endl;

    bLoaded = xml.loadFile( xflPath );

    if( !bLoaded )
    {
        cout << "DOMDocument.xml did not load." << endl;

        return bLoaded;
    }

    loadXFLMedia();
    loadXFLSymbols();
    loadAssets();

    return bLoaded;
}
Esempio n. 4
0
	HGAssets::HGAssets(bool mLevelsOnly) : levelsOnly{mLevelsOnly}
	{
		if(!levelsOnly) loadAssetsFromJson(assetManager, "Assets/", getFromFile("Assets/assets.json"));
		loadAssets();

		for(auto& v : levelDataIdsByPack) sort(begin(v.second), end(v.second), [&](const string& mA, const string& mB){ return levelDatas[mA]->menuPriority < levelDatas[mB]->menuPriority; });
		sort(begin(packIds), end(packIds), [&](const string& mA, const string& mB){ return packDatas[mA]->priority < packDatas[mB]->priority; });
	}
	void prepare()
	{
		VulkanExampleBase::prepare();
		loadAssets();
		setupDescriptors();
		preparePipelines();
		buildCommandBuffers();
		prepared = true;
	}
Esempio n. 6
0
	void setUpExample()
	{
		Assets assets;
		loadAssets(assets);
		createMaterial(assets);

		setUp3DScene(assets);
		setUpInput();
	}
Esempio n. 7
0
Scene::Scene(SDL_Renderer* renderer, SDL_Texture* targetTexture, bool withoutSensor)
	:particles{ Constants::MAX_PARTICLES }, renderer{ renderer }, targetTexture { targetTexture }, noSensor{ withoutSensor }
{
	dataCollection = noSensor ? &Scene::getMouseData : &Scene::getSensorData;
	SDL_SetRenderTarget(renderer, targetTexture);
	SDL_SetTextureBlendMode(targetTexture, SDL_BLENDMODE_BLEND);
	loadAssets();	
	buildDefaultLevel();
	currentTime = SDL_GetPerformanceCounter();
}
Esempio n. 8
0
	void prepare()
	{
		VulkanExampleBase::prepare();
		loadAssets();
		prepareConditionalRendering();
		prepareUniformBuffers();
		setupDescriptorSets();
		preparePipelines();
		buildCommandBuffers();
		prepared = true;
	}
Esempio n. 9
0
File: Main.cpp Progetto: mly/BMW
int main(int argc, char** argv) {

    initOpenGL();
    loadAssets();
	handleInput();
	renderFrame();
    while (window.IsOpened()) {       
		window.Display();
    }
		
    return 0;
}
Esempio n. 10
0
	void prepare()
	{
		VulkanExampleBase::prepare();
		loadAssets();
		prepareUniformBuffers();
		setupDescriptorSetLayout();
		preparePipelines();
		setupDescriptorPool();
		setupDescriptorSet();
		buildCommandBuffers();
		prepared = true;
	}
Esempio n. 11
0
	void prepare()
	{
        sampleCount = getMaxUsableSampleCount();
		VulkanExampleBase::prepare();
		loadAssets();
		setupVertexDescriptions();
		prepareUniformBuffers();
		setupDescriptorSetLayout();
		preparePipelines();
		setupDescriptorPool();
		setupDescriptorSet();
		buildCommandBuffers();
		prepared = true;
	}
Esempio n. 12
0
int main(int argc, char** argv) {

    initOpenGL();
    loadAssets();

    // Put your game loop here (i.e., render with OpenGL, update animation)
    while (window.IsOpened()) {
        handleInput();
        renderFrame();
        window.Display();
    }

    return 0;
}
Esempio n. 13
0
void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) {
	TTnpcScript *npcScript = getNpcScript(npc);
	TTroomScript *roomScript = getRoomScript();

	_titleEngine.reset();
	uint charId = npcScript->charId();
	loadAssets(npc, charId);

	_currentNPC = npc;
	_titleEngine._scriptHandler->scriptChanged(roomScript, npcScript, id);
	_currentNPC = nullptr;

	setDialogue(npc, roomScript, view);
}
Esempio n. 14
0
int main(int argc, const char **argv)
{	
	init(argc, argv);
	loadAssets();
	while (window.IsOpened()) {
		clockdiff = clck.GetElapsedTime();
		elapsed += clockdiff;
		clck.Reset();
		inputFn();
		renderFn();
		window.Display();
	}
	return 0;
}
Esempio n. 15
0
	void D3D12Render::v_init()
	{
		m_viewport.Width = getClientWidth();
		m_viewport.Height = getClientHeight();
		m_viewport.MaxDepth = 1.0f;

		m_scissorRect.right = static_cast<LONG>(getClientWidth());
		m_scissorRect.bottom = static_cast<LONG>(getClientHeight());

		loadPipeline();
		m_triangle.init(m_pD3D12Device);
		loadAssets();


	}
Esempio n. 16
0
void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view) {
	TTnpcScript *npcScript = getNpcScript(npc);
	TTroomScript *roomScript = getRoomScript();
	_titleEngine.reset();

	if (npcScript && roomScript) {
		_currentNPC = npc;
		_titleEngine._scriptHandler->processInput(roomScript, npcScript, TTstring(msg->_input));
		_currentNPC = nullptr;

		loadAssets(npc, npcScript->charId());
		setDialogue(npc, roomScript, view);
	}

	_currentNPC = nullptr;
}
Esempio n. 17
0
 bool		ApplicationManager::init()
 {
   if (mInitialised)
     return true;
   LOG("Initializing ApplicationManager");
   if (!mCanBeInit)
     return false;
   if (!mPluginsLoaded)
     loadPlugins();
   setupSystems();
   mInitialised = initSystems();
   if (!mInitialised)
     return mInitialised;
   mInitialised = loadAssets();
   return mInitialised;
 }
Esempio n. 18
0
Game::Game()
{
	window.create(sf::VideoMode(1280, 720), "Untitled Zombie Game");
	window.setKeyRepeatEnabled(false);
	window.setMouseCursorVisible(false);

	// For more smoothing, set VSync to false and Framerate to ~500
	window.setFramerateLimit(60);
	window.setVerticalSyncEnabled(true);

	camera.setCenter(sf::Vector2f(640, 360));

	fireTime = fireClock.restart().asSeconds();

	loadAssets();

	GameState = mainMenu;
}
Esempio n. 19
0
bool Renderer::init(int width, int height, int numJewels)
{
	bool result = true;
		
	result = (SDL_Init(SDL_INIT_VIDEO) == 0);

	if (result)
	{		
		m_window.reset(SDL_CreateWindow("Jewels", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_SHOWN));

		if (m_window != nullptr)
		{
			m_surface.reset(SDL_GetWindowSurface(m_window.get()));

			SDL_FillRect(m_surface.get(), NULL, SDL_MapRGB(m_surface->format, 0, 0, 0));
			SDL_UpdateWindowSurface(m_window.get());

			// Renderer
			m_renderer.reset(SDL_CreateRenderer(m_window.get(), -1, SDL_RENDERER_ACCELERATED));
			if (m_renderer != nullptr)
			{
				SDL_SetRenderDrawColor(m_renderer.get(), 0, 0, 0, 0);
			}
			else
			{
				result = false;				
			}
		}
		else
		{
			result = false;
		}
	}

	if (result)
	{
		result = loadAssets(numJewels);
	}
	
	return result;
}
Esempio n. 20
0
	TheGame::TheGame(int argc, char** argv)
	:	Game("TheGame", 60),
		soundLevel(100),
		musicLevel(75)
	{
		// init Logger first
		swift::Logger::setFile(getResourcePath() / "TheGame.log");
		
		// get System Info
		swift::Logger::get()	<< "OS:\t\t" << swift::getOSName() << '\n'
								<< "Version:\t" << swift::getOSVersion() << '\n'
								<< "Arch:\t\t" << swift::getOSArch() << '\n'
								<< "Total Mem:\t" << swift::getTotalMem() << '\n'
								<< "CPU:\t\t" << swift::getCPUModel() << '\n'
								<< "Video Vendor:\t" << swift::getVideoVendor() << '\n'
								<< "Video Card:\t" << swift::getVideoCard() << '\n'
								<< "Video Driver:\t" << swift::getVideoDriver() << "\n\n";
		
		// get settings to initialize engine
		loadSettings(getResourcePath() / "settings.ini");
		
		// arguments override settings
		handleArgs(argc, argv);
		
		// get stuff so we can do stuff
		loadAssets();
		
		// gotta set this if you want any text to display
		defaultFont = assets.getFont("segoeuisl.ttf");
		
		//window.setIcon(SwiftEngineIcon.width, SwiftEngineIcon.height, SwiftEngineIcon.pixel_data);	// need to figure out icon stuff
		
		// can't do anything without state (well, in this case)
		initState();
		
		// scripting if you want it
		initScripting();
		
		// set saves directory for saving/loading
		swift::SaveManager::setResourcePath(getResourcePath());
	}
Esempio n. 21
0
bool GameController::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Node::init() )
    {
        return false;
    }
    
    bool_first_touch = true;
    
    //screen variables
    visibleSize = Director::getInstance()->getVisibleSize();
    origin = Director::getInstance()->getVisibleOrigin();
    
    
    
    
    
    //catching touch
    auto eventListener = EventListenerTouchOneByOne::create();
    eventListener->onTouchBegan = CC_CALLBACK_2(GameController::onTouchBegan, this);
    eventListener->onTouchMoved = CC_CALLBACK_2(GameController::onTouchMoved, this);
    eventListener->onTouchEnded = CC_CALLBACK_2(GameController::onTouchEnded, this);
    
    Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(eventListener, this);
    
    auto physicsContactListener = EventListenerPhysicsContact::create();
    physicsContactListener->onContactBegin = CC_CALLBACK_1(GameController::onContactBegin, this);
    Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(physicsContactListener, this);
    
    
    //designing background
    loadAssets();
    
    //moving board
    moveBoard();
    
    return true;
}
Esempio n. 22
0
int main(int argc, char** argv) {

    initOpenGL();
    loadAssets();
    
    // go to a square Viewport
    glViewport(0, 0, CUBE_MAP_SIZE, CUBE_MAP_SIZE);
    generateEnvironmentMap();
    
    // go to our window Viewport
    glViewport(0, 0, window.GetWidth(), window.GetHeight());

    // Put your game loop here (i.e., render with OpenGL, update animation)
    while (window.IsOpened()) {
        handleInput();
        renderFrame();
        window.Display();
        
        updatePositions();
    }
    
    return 0;
}
Esempio n. 23
0
int main( int argc, char* argv[] ) {
	
	bool success = initGUI( argc, argv );

	if ( success ) {
		
		success = loadAssets();
		
		if ( success ) {

			printf("Assets loaded!\nStarting game loop...\n");
			startGameLoop();

		} else {
			printf("Asset Load fail\n");
			success = false;
		}
	} else {
		printf("initGUI fail\n");
		success = false;
	}

	return success;
}
Esempio n. 24
0
OpticPack::OpticPack(const std::string& fileName) {
    handle = open(fileName);
    metadata = loadMeta(handle);
    loadAssets();
}
Esempio n. 25
0
Core::Core(std::string filename): Core() {
	loadAssets(filename);
}
Esempio n. 26
0
	void MenuLoad::load()
	{
		loadIconMasks();
		loadProperties();
		loadAssets();
	}
Esempio n. 27
0
Ball::Ball() : currentBall(0)
{
    loadAssets();
}
Esempio n. 28
0
Enemy::Enemy() {

	loadAssets();

}
Esempio n. 29
0
void ofApp::setup() {

	// SYSTEM
	ofSetLogLevel(OF_LOG_VERBOSE);
	ofHideCursor();
	ofSetFrameRate(60);
	
	// SCREEN
    ofEnableAlphaBlending();
    ofBackground(100);
    width = ofGetWindowWidth();
    height = ofGetWindowHeight();
    
    // STATE
    presenting = true;
    tooSunny = false;
    fboAge = 0;
    imageTimer = 0;
    imageMAX = 500;
    playState = 1;
    currentBrightness = 0;
    targetAlpha = 155;
	
    #ifdef INTERACTIVE
        // KINECT
        #ifdef KINECT
            kinect.setRegistration(true);
            kinect.init();	
            kinect.open();
            if(kinect.isConnected()) {
                ofLogNotice() << "sensor-emitter dist: " << kinect.getSensorEmitterDistance() << "cm";
                ofLogNotice() << "sensor-camera dist:  " << kinect.getSensorCameraDistance() << "cm";
                ofLogNotice() << "zero plane pixel size: " << kinect.getZeroPlanePixelSize() << "mm";
                ofLogNotice() << "zero plane dist: " << kinect.getZeroPlaneDistance() << "mm";
            }
            angle = 23;
            kinect.setCameraTiltAngle(angle);
        #else
            camera.setVerbose(true);
            camera.initGrabber(320, 240);
        #endif
    
        // CAPTURE SIZE
        int capture_width, capture_height;
        #ifdef KINECT
            capture_width = kinect.width;
            capture_height = kinect.height;
        #else
            capture_width = camera.width;
            capture_height = camera.height;
        #endif
        
        // OPENCV
        colorImg.allocate(capture_width, capture_height);
        grayImage.allocate(capture_width, capture_height);
        grayThreshNear.allocate(capture_width, capture_height);
        grayThreshFar.allocate(capture_width, capture_height);
        grayBg.allocate(capture_width, capture_height);
        grayDiff.allocate(capture_width, capture_height);
        closePoints.allocate(capture_width, capture_height, GL_RGBA32F_ARB);

        nearThreshold = 350;
        farThreshold = 112;
        bLearnBakground = true;
        threshold = 80;
        bThreshWithOpenCV = false;
        minBlob = 25; 
        maxBlob = (capture_width * capture_height)/2;
    
        // FBO & GLSL SHADER
        setupGL(width, height);
    #else
        playState = 2;
        imageMAX = 2500;
    #endif
    

	
    // XML ASSETS
    BASEPATH = "../../../MEDIA/";
    assets.loadFile("xml/assets.xml");
    if( assets.loadFile("xml/assets.xml") ) {
        ofLog(OF_LOG_NOTICE, "Loaded xml file !!! \n");
        loadFonts();
        loadArtists();
        loadAssets();
    }
    else {
        ofLog(OF_LOG_ERROR, "UNABLE to load xml file :( \n");
    }

    //  INDEX
    currentIndex = 0;
    updateCurrentIndex();

    // ASSETS
    brush.loadImage("mouse/brush.png");
	stamp.loadImage("logo/stamp_white2.png");
	demo.loadMovie(BASEPATH + "demo/studio_in_the_city_6_promo.mp4");
    
    // MEMORY
    checkMemory();

	cout << "Setup Is Done \n" << endl;
}
Esempio n. 30
0
Door::Door(b2World* world, RenderWindow* win, float x, float y, float w, float h) : m_world(world), m_win(win), position(x, y), size(w, h)
{
	rotatingDoor = false;
	createBox2dBody();
	loadAssets();
}