Пример #1
0
int main(int argc, char *argv[])
{
    char command, parameters[MAXFILENAME+3];
    FILE *file;

    /* Initialize the limits. */
    cleanLimits();
    if (argc == 2) {
        file = fopen(argv[1], "r");
        readFile(file);
        fclose(file);
        strcpy(fileToWrite, argv[1]);
    }

    do {
        command = getchar();
        /* trailing space, \n, \0 */
        fgets(parameters, MAXFILENAME+3, stdin);
        switch(command) {
            case 'a':
                addElement(parameters);
                break;
            case 'p':
                listRelevant();
                break;
            case 'i':
                printMatrixInfo();
                break;
            case 'l':
                printLine(parameters);
                break;
            case 'c':
                printColumn(parameters);
                break;
            case 'o':
                sortElements(parameters);
                break;
            case 'z':
                changeZero(parameters);
                break;
            case 's':
                compressMatrix();
                break;
            case 'w':
                writeToFile(parameters);
                break;
        }
    } while (command != 'q');
    
    return 0;
}
Пример #2
0
void PGE_LevelCamera::update(float ticks)
{
    objects_to_render.clear();

    if(!cur_section) return;
    fader.tickFader(ticks);

    if(isAutoscroll) processAutoscroll(ticks);

    LvlSceneP::s->queryItems(posRect, &objects_to_render);

    int contacts = 0;
    for(int i=0; i<objects_to_render.size();i++)
    {
        contacts++;
        PGE_Phys_Object * visibleBody = objects_to_render[i];
        bool renderable=false;
        if(!visibleBody->isVisible())
        {
            objects_to_render.removeAt(i); i--; continue;
        }
        switch(visibleBody->type)
        {
            case PGE_Phys_Object::LVLBlock:
            case PGE_Phys_Object::LVLBGO:
            case PGE_Phys_Object::LVLNPC:
            case PGE_Phys_Object::LVLPlayer:
            case PGE_Phys_Object::LVLEffect:
                renderable=true;
        }

        if(visibleBody->type==PGE_Phys_Object::LVLNPC)
        {
            LVL_Npc *npc = dynamic_cast<LVL_Npc*>(visibleBody);
            if(npc && npc->isVisible())
            {
                if(!npc->isActivated && !npc->wasDeactivated)
                {
                    npc->Activate();
                    LvlSceneP::s->active_npcs.push_back(npc);
                }
                else
                {
                    if(npc->wasDeactivated)
                        npc->activationTimeout=0;
                    else
                    {
                        if(npc->is_activity)
                            npc->activationTimeout = npc->setup->deactivetionDelay;
                        else
                            npc->activationTimeout = 150;
                    }
                }
            }
        }

        if(!PGE_Window::showPhysicsDebug && !renderable)
        {
            objects_to_render.removeAt(i); i--;
        }
    }

    //Sort array
    sortElements();
}