Esempio n. 1
0
void main() {
    blicketCubes.mark(blicket1);
    blicketCubes.mark(blicket2);
    nonBlicketCubes.mark(nonBlicket1);
    nonBlicketCubes.mark(nonBlicket2);

    // Initialize asset configuration and loader
    config.append(gMainSlot, BootstrapAssets);
    loader.init();

    // Subscribe to events (See pubsub design pattern)
    Events::cubeConnect.set(onCubeConnect);
    Events::cubeDisconnect.set(onCubeDisconnect);
    Events::cubeRefresh.set(onCubeRefresh);
    Events::neighborAdd.set(onNeighborAdd);
    Events::neighborRemove.set(onNeighborRemove);
    // Events::cubeTouch.set(onCubeTouch);
    Events::cubeTouch.set(onTouch);

    // Initialize cubes
    for(CubeID cid : CubeSet::connected()) {
        vbuf[cid].attach(cid);
        activateCube(cid);
    }

    // Run loop
    for(;;) {
        paintWrapper();
    }
}
Esempio n. 2
0
void main() {
    // initialize asset configuration and loader
    config.append(gMainSlot, BootstrapAssets);
    loader.init();

    // subscribe to events
    Events::cubeConnect.set(onCubeConnect);
    Events::cubeDisconnect.set(onCubeDisconnect);
    Events::cubeRefresh.set(onCubeRefresh);


    //Set events for interactive elements
    Events::neighborAdd.set(onNeighborAdd);
    Events::neighborRemove.set(onNeighborRemove);
    Events::cubeAccelChange.set(onAccelChange);
    
    // initialize cubes
    currentLearningTask=1;
    previousLearningTask=0;

    isDistracted = false;
    
    // Background music
    // AudioTracker::setVolume(0.2f * AudioChannel::MAX_VOLUME);
    // AudioTracker::play(Music);

    //Initial cube paint, also assigning character cubes. (should retain same IDs)
    int j = 0;
    for(CubeID cid : CubeSet::connected()) {
        currentBackgrounds[j] = j;
        vbuf[cid].attach(cid);
        motion[cid].attach(cid);
        activateCube(cid);
        cbs [j] = cid;
        j++;
    }

    toucan = cbs[0];
    monkey = cbs[1];
    giraffe = cbs[2];

    
    // run loop
    for(;;) {
        paintWrapper();

    }
}
Esempio n. 3
0
void main() {
	loader.init();
	config1.append(slot, grp1);
	config2.append(slot, grp2);
	Events::cubeConnect.set(onConnect);
	for(CubeID cid : CubeSet::connected()) {
		init(cid);
	}
	TimeDelta time(0.f);
	for(;;) {
		System::keepAwake();
		auto startTime = SystemTime::now();
		loader.start(config1);
		for(CubeID cid : CubeSet::connected()) {
			String<32> s;
			s << FixedFP(time.seconds(), 3, 3) << "s";
			g[cid].bg0rom.fill(vec(0,0), vec(16,16), BG0ROMDrawable::SOLID_BG);
			g[cid].bg0rom.text(vec(1,1), s.c_str(), BG0ROMDrawable::BLUE);
			g[cid].bg0rom.text(vec(1,14), "Loading GRP1", BG0ROMDrawable::BLUE);
		}
		while(!loader.isComplete()) {
			for(CubeID cid : CubeSet::connected()) {
				g[cid].bg0rom.hBargraph(vec(0, 4), loader.cubeProgress(cid, 128), BG0ROMDrawable::ORANGE, 8);
			}
			System::paint();
		}
		loader.finish();
		time = SystemTime::now() - startTime;
		startTime = SystemTime::now();
		loader.start(config2);
		for(CubeID cid : CubeSet::connected()) {
			String<32> s;
			s << FixedFP(time.seconds(), 3, 3) << "s";
			g[cid].bg0rom.fill(vec(0,0), vec(16,16), BG0ROMDrawable::SOLID_BG);
			g[cid].bg0rom.text(vec(1,1), s.c_str(), BG0ROMDrawable::BLUE);
			g[cid].bg0rom.text(vec(1,14), "Loading GRP2", BG0ROMDrawable::BLUE);
		}
		while(!loader.isComplete()) {
			for(CubeID cid : CubeSet::connected()) {
				g[cid].bg0rom.hBargraph(vec(0, 4), loader.cubeProgress(cid, 128), BG0ROMDrawable::ORANGE, 8);
			}
			System::paint();
		}
		loader.finish();
		time = SystemTime::now() - startTime;
		startTime = SystemTime::now();
	}
}
Esempio n. 4
0
void main()
{
    assetConfig.append(MainSlot, BetterflowAssets);
    loader.init();

    for (CubeID cube : CubeSet::connected())
    {
        onConnect(NULL, cube);
    }
    Events::cubeConnect.set(&onConnect);

    gVideo[0].setMode(BG0);

    MainMenu gameMenu(&gVideo[0]);

    int colour;
    Colormap colourList;
    colourList.setEGA();

    

    while(1)
    {
        colour = gameMenu.runMenu();

        gVideo[0].setMode(SOLID_MODE);

        gVideo[0].colormap[0].set(colourList[colour].get());
        System::paint();

        TimeStep ts;
        TimeTicker ticker = TimeTicker(1);
        int tickIncr;
        int tickCount  = 0;
        do
        {
            tickIncr = ticker.tick( ts.delta() );
            ts.next();
            tickCount += tickIncr;
        } while (tickCount < 3);

        gVideo[0].setMode(BG0);
        gVideo[0].bg0.erase(StripeTile);
    }

}
Esempio n. 5
0
static void begin() {
    // initialize asset configuration and loader
    config.append(gMainSlot, BootstrapAssets);
    loader.init();

    // subscribe to events
    Events::cubeConnect.set(onCubeConnect);
    Events::cubeDisconnect.set(onCubeDisconnect);
    Events::cubeRefresh.set(onCubeRefresh);
    Events::cubeTouch.set(onCubeTouch);

    Events::neighborAdd.set(onNeighborAdd);
    Events::neighborRemove.set(onNeighborRemove);

    // Blank screens, attach VideoBuffers
    for(CubeID cid : CubeSet::connected()) {
        auto &vid = vbuf[cid];
        vid.initMode(BG0);
        vid.attach(cid);
        vid.bg0.erase(StripeTile);
    }
}