void Simulation::loadEnviornment() {

	loadWalls();

	backObjOptions.b2Shape.SetAsBox((1000.f / 2) / SCALE, (100.f / 2) / SCALE);
	backObjOptions.sfShape = Shape::square;
	backObjOptions.fixtDef.shape = &backObjOptions.b2Shape;

	for (int i = 0; i < backObjOptions.quantity; i++) {
		backObjOptions.bodyDef.position = b2Vec2(rand() % window->getSize().x / SCALE, rand() % window->getSize().y / SCALE);
		objectList.push_back(StaticObject(world, window, backObjOptions));
	}




	
}
Ejemplo n.º 2
0
//-------------------------------------------------------------------------------------
// This is the init callback function. You should load and create your in-game
// resources here.
//
//-------------------------------------------------------------------------------------
void GameApp::Create()
{
    JLOG("GameApp:Create 1");
    JFileSystem::init("./"); //to avoid having subfolders
    JLOG("GameApp:Create 2");
    JRenderer* renderer = JRenderer::GetInstance();
    JLOG("GameApp:Create 3");
    loadWalls(".");
    if (wallpapers.size()) {
        JLOG("GameApp:Create 4");
        int rnd = (rand() % wallpapers.size());
        backTex=renderer->LoadTexture(wallpapers[rnd].c_str());
        if (backTex) backQuad = new JQuad(backTex, 0, 0, 480, 272);
    }
    JLOG("GameApp:Create 5");
    // Load a font
    mFont=new JLBFont("font", 11);
    JLOG("GameApp:Create 6");
    scroller = new TextScroller(mFont, SCREEN_WIDTH/2 - 190 , SCREEN_HEIGHT-20,380);
    const char * const CreditsText[] = {
        "Thanks to n00b81, Tyranid, devs of the PSPSDK, Hitmen, Fanjita & Noobz, psp-hacks.com",
        "wMenu uses the JGE++ library ( http://code.google.com/p/wagic )"
    };

    menu = NULL;

#ifdef WIN32
    strcpy(dummy, "D:/Stuff/Programming/wmenu/projects/wmenu/bin/samples");
#else
    strcpy(dummy, "ms0:/PSP/GAME");
#endif
    ebootPath = dummy;
    JLOG("GameApp:Create 7");
    JGE* engine = JGE::GetInstance();
    vector<string>argv = engine->GetARGV();
    int settingsAddr = 0;
    JLOG("GameApp:Create 8");
    if (argv.size() > 1) {
        string hex = argv[1];
        hex[8] = 0; //bug in HBL ?
        fprintf(stderr, "Location: 0x %s\n", hex.c_str());
        settingsAddr = xstrtoi(hex.c_str(), 8);
    }
    fprintf(stderr, " settingsAddr : %d\n", settingsAddr);
    if (settingsAddr) {
        settings = (tMenuApi *) settingsAddr;
        ebootPath = (void *) settings->filename;
    }

    int size = sizeof(CreditsText) / sizeof(CreditsText[0]);
    string scroll = "wMenu 0.4 by Wololo  http://wololo.net    ";
    stringCode(scroll);
    scroll.append("--- HBL Info ---");

    if (settings) {
        scroll.append(settings->VersionName);
        scroll.append(" by ");
        scroll.append(settings->Credits);
        scroll.append("     ");
    }

    for (int i = 0; i < size; i++) {
        scroll.append(CreditsText[i]);
        scroll.append("     ");
    }
    scroller->Add(scroll);
    JLOG("GameApp:Create 9");
    loadFiles((char *)ebootPath);
    if (fileExists("menu.wav")) {
        menuSfx = JSoundSystem::GetInstance()->LoadSample("menu.wav");
        //runSfx = JSoundSystem::GetInstance()->LoadSample("run.wav");

        JSoundSystem::GetInstance()->SetSfxVolume(100);
    }
    JLOG("GameApp:Create 10");

    currentGameState = GAME_STATE_NONE;
}