コード例 #1
0
ファイル: main.c プロジェクト: JonatanWang/LearnMongoDB
int main(int argc, char* args[]){
    bool quit = false;
    int select = -1;
    int modeMaxButtons[6];
    int keyboardMode = -1;
    isConnected = false;

    for(int i=0; i < MAX_PLAYERS; i++)
        playerReady[i] = 0;

    SDL_Event event;
    SDL_Rect buttonPlacement[MAXBUTTONS];   // Interactable buttons
    SDL_Rect windowPlacement[2];            // Window backgrounds

    initSDL();
    loadMedia();
    initModeMaxButtons(modeMaxButtons);
    setWindows(windowPlacement);
    clearTextStrings(6);
    //SDL_StartTextInput();

    while(!quit){
        while (SDL_PollEvent(&event))
            handleEvent(&event, buttonPlacement, &select, &mode, modeMaxButtons, &keyboardMode, &quit);

        renderScreen(&mode, &select, buttonPlacement, windowPlacement);
        SDL_Delay(10);
    }

    closeRenderer();
    return 0;
}
コード例 #2
0
ファイル: JPEGCodec.cpp プロジェクト: MOXfiles/libmox
JPEGCodec::JPEGCodec(const Header &header, const ChannelList &channels) :
	VideoCodec(header, channels),
	_descriptor(header.frameRate(), header.width(), header.height(), MoxMxf::VideoDescriptor::VideoCodecJPEG)
{
	setWindows(_descriptor, header);
	
	assert(channels.size() == 3);
	
	const Channel *r_channel = channels.findChannel("R");
	
	if(r_channel)
	{
		assert(r_channel->type == UINT8);
	}
	else
		assert(false);
	
	
	MoxMxf::RGBADescriptor::RGBALayout layout;
	
	layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('R', 8));
	layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('G', 8));
	layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('B', 8));
	
	_descriptor.setPixelLayout(layout);
	
	
	_quality = (isLossless(header) ? 100 : getQuality(header));
}
コード例 #3
0
string Container::getState()
{
    clearWndConfig();
    string windows;
    list<UserWnd*> userWnds = m_tabBar->windows();
    for (list<UserWnd*>::iterator it = userWnds.begin(); it != userWnds.end(); ++it){
        if (!windows.empty())
            windows += ',';
        windows += number((*it)->id());
        setWndConfig((*it)->id(), (*it)->getConfig().c_str());
    }
    setWindows(windows.c_str());
    UserWnd *userWnd = m_tabBar->currentWnd();
    if (userWnd)
        setActiveWindow(userWnd->id());
    saveGeometry(this, data.geometry);
    saveToolbar(m_bar, data.barState);
    if (m_tabBar->isVisible())
        setStatusSize(m_status->width());
    return save_data(containerData, &data);
}
コード例 #4
0
ファイル: DPXCodec.cpp プロジェクト: MOXfiles/libmox
DPXCodec::DPXCodec(const Header &header, const ChannelList &channels) :
	VideoCodec(header, channels),
	_descriptor(header.frameRate(), header.width(), header.height(), MoxMxf::VideoDescriptor::VideoCodecDPX),
	_pixelAspectRatio(header.pixelAspectRatio()),
	_frameRate(header.frameRate())
{
	setWindows(_descriptor, header);
	
	const Channel *r_channel = channels.findChannel("R");
	const Channel *a_channel = channels.findChannel("A");
	
	if(r_channel == NULL)
		throw MoxMxf::ArgExc("Expected RGB(A) channels");
	
	
	_channels = (a_channel != NULL ? DPX_RGBA : DPX_RGB);
	
	
	const unsigned int bit_depth = PixelBits(r_channel->type);
	
	_depth = (bit_depth == 8 ? DPX_8 :
				bit_depth == 10 ? DPX_10 :
				bit_depth == 12 ? DPX_12 :
				bit_depth == 16 ? DPX_16 :
				DPX_10);
	
	
	MoxMxf::RGBADescriptor::RGBALayout layout;
	
	layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('R', bit_depth));
	layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('G', bit_depth));
	layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('B', bit_depth));
	
	if(_channels == DPX_RGBA)
		layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('A', bit_depth));
	
	_descriptor.setPixelLayout(layout);
}
コード例 #5
0
void Container::init()
{
    if (m_bInit)
        return;
    m_bInit = true;

    showBar();
    string windows = getWindows();
    while (!windows.empty()){
        unsigned long id = strtoul(getToken(windows, ',').c_str(), NULL, 10);
        Contact *contact = getContacts()->contact(id);
        if (contact == NULL)
            continue;
        addUserWnd(new UserWnd(id, getWndConfig(id), false));
    }
    if (m_tabBar->count() == 0)
        QTimer::singleShot(0, this, SLOT(close()));
    setWindows(NULL);
    clearWndConfig();
    m_tabBar->raiseTab(getActiveWindow());

    show();
}
コード例 #6
0
void Container::init()
{
	if (m_bInit)
		return;

    QFrame *frm = new QFrame(this, "container");
    setCentralWidget(frm);

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    QVBoxLayout *lay = new QVBoxLayout(frm);
    m_wnds = new QWidgetStack(frm);
    m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(m_wnds);

    m_tabSplitter = new Splitter(frm);
    m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    m_tabBar = new UserTabBar(m_tabSplitter);
    m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
    m_tabBar->hide();

    m_bInit = true;

    m_status = new ContainerStatus(m_tabSplitter);
    lay->addWidget(m_tabSplitter);
    connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*)));
    connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int)));
    m_accel = new QAccel(this);
    connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int)));
    setupAccel();
    showBar();

	for (list<UserWnd*>::iterator it = m_childs.begin(); it != m_childs.end(); ++it)
		addUserWnd((*it), false);
	m_childs.clear();

    string windows = getWindows();
    while (!windows.empty()){
        unsigned long id = strtoul(getToken(windows, ',').c_str(), NULL, 10);
        Contact *contact = getContacts()->contact(id);
        if (contact == NULL)
            continue;
        Buffer config;
        const char *cfg = getWndConfig(id);
        if (cfg && *cfg){
            config << "[Title]\n" << cfg;
            config.setWritePos(0);
            config.getSection();
        }
        addUserWnd(new UserWnd(id, &config, false, true), true);
    }

    if (m_tabBar->count() == 0)
        QTimer::singleShot(0, this, SLOT(close()));
    setWindows(NULL);
    clearWndConfig();
    m_tabBar->raiseTab(getActiveWindow());

    show();
}