//Because views are positioned by their center, I have to do funky math
void Window::scroll(sf::Keyboard::Key code)
{
    //get the current position of the view
    sf::Vector2f viewPos = view.getCenter();
    //get the size of the viewport
    sf::Vector2f viewSize = view.getSize();

    switch(code)
    {
        //Move the view around
        case sf::Keyboard::Up:  //Move up
            //consider x's at the top of the screen,
            //we want to keep from pushing any part of the view off the world
            //subtract half the screen to the x and y positions in the
            //center of the screen
            //we subtract because screen coords start with 0-y at the top
            viewPos.y -= viewSize.y/2;
            if(isOnMap((viewPos.x)/32, (viewPos.y-32)/32))
            {
                view.move(0, -32);
                setView(view);
            }
            break;
        case sf::Keyboard::Right:   //Move right
            viewPos.x += viewSize.x/2;
            if(isOnMap((viewPos.x+32)/32, (viewPos.y)/32))
            {
                view.move(32, 0);
                setView(view);
            }
            break;
        case sf::Keyboard::Down:    //Move down
            viewPos.y += viewSize.y/2;
            if(isOnMap((viewPos.x)/32, (viewPos.y+32)/32))
            {
                view.move(0, 32);
                setView(view);
            }
            break;
        case sf::Keyboard::Left:    //move left
            viewPos.x -= viewSize.x/2;
            if(isOnMap((viewPos.x-32)/32, (viewPos.y)/32))
            {
                view.move(-32, 0);
                setView(view);
            }
            break;
        default:
            break;

    }
}
Beispiel #2
0
    void QmlMapControl::touchEvent(QTouchEvent *evnt)
    {
        const QList<QTouchEvent::TouchPoint> & touchs = evnt->touchPoints();
        if( touchs.count() != 2 )
        {
            QQuickPaintedItem::touchEvent(evnt);
        }
        else
        {
            evnt->accept();

            const QTouchEvent::TouchPoint & t0 = touchs.first();
            const QTouchEvent::TouchPoint & t1 = touchs.last();

            if( last_t0_startPos.isNull() )
                last_t0_startPos = t0.startPos();
            if( last_t1_startPos.isNull() )
                last_t1_startPos = t1.startPos();

            qreal startW = qPow( qPow(last_t0_startPos.x()-last_t1_startPos.x(),2)+qPow(last_t0_startPos.y()-last_t1_startPos.y(),2), 0.5 );
            qreal endW = qPow( qPow(t0.pos().x()-t1.pos().x(),2)+qPow(t0.pos().y()-t1.pos().y(),2), 0.5 );

            if( startW*4/3<endW )
            {
                QPoint pnt( last_t0_startPos.x()/2+last_t1_startPos.x()/2, last_t0_startPos.y()/2+last_t1_startPos.y()/2 );
                QPoint newPoint( width()-pnt.x(), height()-pnt.y() );

                setView(clickToWorldCoordinate(pnt));
                zoomIn(pnt);
                setView(clickToWorldCoordinate(newPoint));

                last_t0_startPos = t0.pos();
                last_t1_startPos = t1.pos();
            }
            else
            if( startW*3/4>endW )
            {
                QPoint pnt( t0.pos().x()/2+t1.pos().x()/2, t0.pos().y()/2+t1.pos().y()/2 );
                QPoint newPoint( width()-pnt.x(), height()-pnt.y() );

                setView(clickToWorldCoordinate(pnt));
                zoomOut(pnt);
                setView(clickToWorldCoordinate(newPoint));

                last_t0_startPos = t0.pos();
                last_t1_startPos = t1.pos();
            }
        }
    }
Beispiel #3
0
void keyboard( unsigned char key, int x, int y )
{
    switch( key )
    {
        case 'i':
        case 'I':
            cameraR -= 0.5;
            if( cameraR < 0.5 )
            {
                cameraR = 0.5;
            }
            break;
        case 'o':
        case 'O':
            cameraR += 0.5;
            break;
            
        case 'a':
        case 'A':
            --lookAt.z;
            break;
        case 's':
        case 'S':
            ++lookAt.z;
            break;
            
        case 'r':
        case 'R':
            rebuildTree();
            sendData();
            setView();
            break;
            
        case 'w':
        case 'W':
            wireFrame = !wireFrame;
            glPolygonMode( GL_FRONT_AND_BACK, wireFrame ? GL_LINE : GL_FILL );
            break;
            
        case 033:  // ESC
        case 'q':
        case 'Q':
            exit( EXIT_SUCCESS );
    }
    
    setView();
    glutPostRedisplay();
}
Beispiel #4
0
void LLViewerCamera::setDefaultFOV(F32 vertical_fov_rads) 
{
	vertical_fov_rads = llclamp(vertical_fov_rads, getMinView(), getMaxView());
	setView(vertical_fov_rads);
	mCameraFOVDefault = vertical_fov_rads; 
	mCosHalfCameraFOV = cosf(mCameraFOVDefault * 0.5f);
}
Beispiel #5
0
Player::Player(TileMapLand* land)
    : Entity()
    , hitEnemy(false)
    , m_sprite_view(new AnimatedSpriteView(*this,"Animation/player.txt"))
    , m_plateforme_physics(new PlateformerPhysic(*this,land))
{
    name =  "Player";

    setBody(new Body(*this));
    body()->setSize(sf::Vector2f(16,16));
    body()->setOrigin(sf::Vector2f(8,8));
    body()->setPosition(sf::Vector2f(38,38));

    setPhysics(m_plateforme_physics);
    m_plateforme_physics->gravity = sf::Vector2f(0,0.3);
    m_plateforme_physics->max_speed = sf::Vector2f(2.0,8.0);
    m_plateforme_physics->jump_power = 8.0;
    m_plateforme_physics->walk_speed = 2.0;
    m_plateforme_physics->run_speed  = 3.0;
    m_plateforme_physics->walk_deceleration = 0.3;


    setGamepad(new KeyBoardGamePad(*this));

    setView(m_sprite_view);

}
void MainWindow::openBS()
{
    QString path = QFileDialog::getOpenFileName( this, tr("Open File"), "D:\\Project\\Qt_Creator\\DataBase_0.6", tr("*.sqlite") );

    if( path != "" )
    {
        closeBS();

        base = QSqlDatabase::addDatabase("QSQLITE");

        base.setDatabaseName(path);

        if( base.open() )
            qDebug() << "Open successful";
        else
        {
            qDebug() << "Open falied";
            return;
        }

        model = new SqlTableModel;
        model->setTable("my_table");
        model->select();
        model->setEditStrategy(QSqlTableModel::OnFieldChange);

        setView();

        this->setWindowTitle(path);
    }
}
VNotebookSelector::VNotebookSelector(QWidget *p_parent)
    : QComboBox(p_parent),
      VNavigationMode(),
      m_notebooks(g_vnote->getNotebooks()),
      m_lastValidIndex(-1),
      m_muted(false),
      m_naviLabel(NULL)
{
    m_listWidget = new QListWidget(this);
    m_listWidget->setItemDelegate(new VNoFocusItemDelegate(this));
    m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_listWidget, &QListWidget::customContextMenuRequested,
            this, &VNotebookSelector::popupListContextMenuRequested);

    setModel(m_listWidget->model());
    setView(m_listWidget);

    m_listWidget->viewport()->installEventFilter(this);
    m_listWidget->installEventFilter(this);

    initActions();

    connect(this, SIGNAL(currentIndexChanged(int)),
            this, SLOT(handleCurIndexChanged(int)));
}
void AP_Win32Dialog_Styles::runModal(XAP_Frame * pFrame)
{
	UT_return_if_fail (pFrame);
//
// Get View and Document pointers. Place them in member variables
//
	setFrame(pFrame);

	setView((FV_View *) pFrame->getCurrentView());
	UT_return_if_fail (getView());

	setDoc(getView()->getLayout()->getDocument());
	UT_return_if_fail (getDoc());


	// raise the dialog
	_win32Dialog.runModal(pFrame, AP_DIALOG_ID_STYLES, AP_RID_DIALOG_STYLES_TOP, this);
	
	
	if (m_answer == AP_Dialog_Styles::a_OK)
	{
		const char* szStyle = getCurrentStyle();
		if (szStyle)
		{
			getDoc()->updateDocForStyleChange(szStyle, true);
			getView()->getCurrentBlock()->setNeedsRedraw();
			getDoc()->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
		}
	}

}
ActionComboBoxWidget::ActionComboBoxWidget(QWidget *parent) : QComboBox(parent),
	m_view(new ItemViewWidget(this)),
	m_filterLineEdit(NULL),
	m_wasPopupVisible(false)
{
	setEditable(true);
	setView(m_view);
	setItemDelegate(new ItemDelegate(this));

	m_view->setHeaderHidden(true);

	lineEdit()->hide();

	view()->viewport()->parentWidget()->installEventFilter(this);

	QStandardItemModel *model = new QStandardItemModel(this);
	const QVector<ActionDefinition> definitions = ActionsManager::getActionDefinitions();

	for (int i = 0; i < definitions.count(); ++i)
	{
		QStandardItem *item = new QStandardItem(definitions.at(i).icon, QCoreApplication::translate("actions", (definitions.at(i).description.isEmpty() ? definitions.at(i).text : definitions.at(i).description).toUtf8().constData()));
		item->setData(definitions.at(i).identifier, Qt::UserRole);
		item->setToolTip(ActionsManager::getActionName(definitions.at(i).identifier));
		item->setFlags(item->flags() | Qt::ItemNeverHasChildren);

		model->appendRow(item);
	}

	setModel(model);
	setCurrentIndex(-1);
}
Beispiel #10
0
TileView::TileView(const std::list<std::string> & columns, IDelegateFactory * delegateFactory, QWidget * parent)
	: CompositeListView(parent), m_listview(0), m_sorter(0)
{
	if (! delegateFactory)
		throw std::runtime_error("TileView requires a Custom Tile Delegate");

	m_listview = new QListView(this);
	m_listview->setUniformItemSizes(true);
	m_listview->setItemDelegate(delegateFactory->create());
	m_listview->setResizeMode(QListView::Adjust);
	m_listview->setSelectionBehavior(QAbstractItemView::SelectRows);
	m_listview->setSelectionMode(QAbstractItemView::ExtendedSelection);
	m_listview->setSpacing(16);
	m_listview->setViewMode(QListView::IconMode);

	setView(m_listview);

	m_sorter = new TileViewSorter(columns, this);
	connect(m_sorter, SIGNAL(sortChanged(int, Qt::SortOrder)), this, SLOT(onSortChanged(int, Qt::SortOrder)));

	QVBoxLayout * vbox = new QVBoxLayout;
	vbox->setContentsMargins(0, 0, 0, 0);
	vbox->setSpacing(0);
	vbox->addWidget(m_listview);
	vbox->addWidget(m_sorter);

	setLayout(vbox);
}
Beispiel #11
0
void QgsDualView::setMultiEditEnabled( bool enabled )
{
  if ( enabled )
    setView( AttributeEditor );

  mAttributeForm->setMode( enabled ? QgsAttributeEditorContext::MultiEditMode : QgsAttributeEditorContext::SingleEditMode );
}
Beispiel #12
0
void setupData()
{
    // build tree
    rebuildTree();

    // matrices
    setView();
    
    // create shader program
    GLuint sProgram = InitShader( "vert.glsl", "frag.glsl" );
    
    // object buffer
    glGenBuffers( 1, &objectBuffer );
    glBindBuffer( GL_ARRAY_BUFFER, objectBuffer );
    
    // vertices
    vertLoc = glGetAttribLocation( sProgram, "a_vPosition" );

    // indices
    glGenBuffers( 1, &indexBuffer );
    glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, indexBuffer );

    // texture coordinates
    //texCoordLoc = glGetAttribLocation( sProgram, "a_vTexCoord" );
    
    // normals
    normalLoc = glGetAttribLocation( sProgram, "a_vNormal" );
    
    // buffer to GPU
    sendData();
}
Beispiel #13
0
void mouseMove( int x, int y )
{
    int dx = mouseX - x;
    int dy = y - mouseY;
    
    thetaXY += dx / static_cast<float>( windowW / 2 );
    thetaZ += dy / static_cast<float>( windowH / 2 );

    if( thetaXY >= 2.0 * M_PI )
    {
        thetaXY -= 2.0 * M_PI;
    }
    else if( thetaXY < 0.0 )
    {
        thetaXY += 2.0 * M_PI;
    }
    if( thetaZ < -0.5 * M_PI + 0.01 )
    {
        thetaZ = -0.5 * M_PI + 0.01;
    }
    else if( thetaZ > 0.5 * M_PI - 0.01 )
    {
        thetaZ = 0.5 * M_PI - 0.01;
    }

    setView();
    
    mouseX = x;
    mouseY = y;
    
    glutPostRedisplay();
}
Beispiel #14
0
void Camera::setTransform(const Vec4 &_pos, const Vec4 &_rotation )
{
  m_position = _pos;
  m_rotation = _rotation;

  m_viewMatrix.identity();

//  // Rotation
  m_viewMatrix.rotate(_rotation);

  // Translate
  Mat4 tmp;
  tmp.identity();
  tmp.m_m[3][0] = _pos.m_x;
  tmp.m_m[3][1] = _pos.m_y;
  tmp.m_m[3][2] = _pos.m_z;

//  tmp.m_m[0][3] *= -1;
//  tmp.m_m[3][0] *= -1;

//  tmp.m_m[1][3] *= -1;
//  tmp.m_m[3][1] *= -1;

  tmp *= m_viewMatrix;
  m_viewMatrix = tmp;

  setView();
}
Ti::TiView *Ti::TiViewProxy::getView()
{
	if(view == NULL) {
		setView(new Ti::TiView(this));
	}
	return view;
}
Beispiel #16
0
void LocalFrame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent)
{
    ASSERT(this);

    setView(nullptr);

    RefPtr<FrameView> frameView;
    frameView = FrameView::create(this, viewportSize);

    // The layout size is set by WebViewImpl to support @viewport
    frameView->setLayoutSizeFixedToFrameSize(false);

    setView(frameView);

    frameView->updateBackgroundRecursively(backgroundColor, transparent);
}
TiUIWebViewProxy::TiUIWebViewProxy(const char* name) : Ti::TiViewProxy(name)
{
	createPropertySetterGetter("data", _setData,  _getData);
	createPropertySetterGetter("disableBounce", _setDisableBounce,  _getDisableBounce);
	createPropertySetterGetter("hideLoadIndicator", _setHideLoadIndicator,  _getHideLoadIndicator);
	createPropertySetterGetter("html", _setHtml,  _getHtml);
	createPropertySetterGetter("ignoreSslError", _setIgnoreSslError,  _getIgnoreSslError);
	createPropertySetterGetter("loading", _setLoading,  _getLoading);
	createPropertySetterGetter("overScrollMode", _setOverScrollMode,  _getOverScrollMode);
	createPropertySetterGetter("pluginState", _setPluginState,  _getPluginState);
	createPropertySetterGetter("scrollsToTop", _setScrollsToTop,  _getScrollsToTop);
	createPropertySetterGetter("showScrollbars", _setShowScrollbars,  _getShowScrollbars);
	createPropertySetterGetter("enableZoomControls", _setEnableZoomControls,  _getEnableZoomControls);
	createPropertySetterGetter("scalesPageToFit", _setScalesPageToFit,  _getScalesPageToFit);
	createPropertySetterGetter("url", _setUrl,  _getUrl);
	createPropertySetterGetter("userAgent", _setUserAgent,  _getUserAgent);
	createPropertySetterGetter("willHandleTouches", _setWillHandleTouches,  _getWillHandleTouches);

	createPropertyFunction("canGoBack", _canGoBack);
	createPropertyFunction("canGoForward", _canGoForward);
	createPropertyFunction("evalJS", _evalJS);
	createPropertyFunction("goBack", _goBack);
	createPropertyFunction("goForward", _goForward);
	createPropertyFunction("pause", _pause);
	createPropertyFunction("reload", _reload);
	createPropertyFunction("repaint", _repaint);
	createPropertyFunction("release", _release);
	createPropertyFunction("resume", _resume);
	createPropertyFunction("setBasicAuthentication", _setBasicAuthentication);
	createPropertyFunction("stopLoading", _stopLoading);

	_tiWebView = new UIWebView(this);
	setView(_tiWebView);
	webViews_.append(this);
}
Beispiel #18
0
Game::Game() :  KTopLevelWidget()
{
    setCaption( kapp->getCaption() );

    setIcon(klocale->translate("Snake Race"));

    conf = kapp->getConfig();
    if(conf == NULL) {
	printf(klocale->translate("KConfig error ??\n"));
	kapp->quit();
    }

    levels = new Levels();
    score  = new Score;
    menu();
    checkMenuItems();

    View *view = new View(this);
    rattler = view->rattler;
    rattler->setFocus();

    connect(rattler, SIGNAL(setPoints(int)), view->lcd, SLOT(display(int)));
    connect(rattler, SIGNAL(setTrys(int)), view->trys, SLOT(set(int)));
    connect(rattler, SIGNAL(rewind()), view->pg, SLOT(rewind()));
    connect(rattler, SIGNAL(advance()), view->pg, SLOT(advance()));
    connect(view->pg, SIGNAL(restart()), rattler, SLOT(restartTimer()));

    connect(rattler, SIGNAL(togglePaused()), this, SLOT(togglePaused()));
    connect(rattler, SIGNAL(setScore(int)), score, SLOT(setScore(int)));

    menubar->show();
    setMenu(menubar);
    view->show();
    setView(view);
}
Beispiel #19
0
void KMyMoneyAccountCombo::setModel(QAbstractItemModel *model)
{
  delete d->m_popupView;

  KComboBox::setModel(model);

  AccountNamesFilterProxyModel* filterModel = qobject_cast<AccountNamesFilterProxyModel*>(model);
  if(filterModel) {
    filterModel->setFilterKeyColumn(AccountsModel::Account);
    filterModel->setFilterRole(AccountsModel::FullNameRole);
  }

  d->m_popupView = new QTreeView(this);
  d->m_popupView->setSelectionMode(QAbstractItemView::SingleSelection);
  setView(d->m_popupView);

  d->m_popupView->installEventFilter(this);

  d->m_popupView->setHeaderHidden(true);
  d->m_popupView->setRootIsDecorated(false);
  d->m_popupView->setAlternatingRowColors(true);
  d->m_popupView->setAnimated(true);

  d->m_popupView->expandAll();

  connect(this, SIGNAL(activated(int)), SLOT(activated()));
  connect(d->m_popupView, SIGNAL(activated(QModelIndex)), this, SLOT(selectItem(QModelIndex)));
  connect(d->m_popupView, SIGNAL(pressed(QModelIndex)), this, SLOT(selectItem(QModelIndex)));

  if(isEditable()) {
    connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(makeCompletion(QString)));
  }
}
Beispiel #20
0
void PWS::show(){
    if(createdUI == FALSE){
        QPopupMenu *file_menu = new("QPopupMenu") QPopupMenu();
        file_menu->insertItem(i18n("E&xit"), kapp, SLOT(quit()));

        QPopupMenu *help_menu = new("QPopupMenu") QPopupMenu();
        help_menu->insertItem(i18n("&Help"), this, SLOT(invokeHelp()));

        //	menuBar = new("KMenuBar") KMenuBar(this, "menubar");
        //	menuBar->insertItem(i18n("&File"), file_menu);
        //	menuBar->insertItem(i18n("&Help"), help_menu);

        //	setMenu(menuBar);

        //	toolBar = new("KToolBar") KToolBar(this);
        //	addToolBar(toolBar);

        //	statusBar = new("KStatusBar") KStatusBar(this);
        //	setStatusBar(statusBar);

        //        resize(600,440);
        view = new("PWSWidget") PWSWidget(this);
        setView(view);

        connect(view, SIGNAL(quitPressed(QObject *)),
                this, SLOT(closeView(QObject *)));

        createdUI = TRUE;
    }
servercontroller::servercontroller /*FOLD00*/
(
 QWidget*,
 const char* name
 )
  :
  KTopLevelWidget( name )
{


  MenuBar = new("KMenuBar") KMenuBar(this, QString(name) + "_menu");
  setMenu(MenuBar);

  if(kSircConfig->DisplayMode == 0){
  SDI:
    displayMgr = new("DisplayMgrSDI") DisplayMgrSDI();
    sci = new("scInside") scInside(this, QString(name) + "_mainview");
    setView(sci, TRUE);
  }
  else if(kSircConfig->DisplayMode == 1){
    DisplayMgrMDI *displayMgrMDI = new("DisplayMgrMDI") DisplayMgrMDI(this);
    sci = new("scInside") scInside(this, QString(name) + "_mainview");
    displayMgrMDI->newTopLevel(sci, TRUE);
    
    displayMgrMDI->setCaption(sci, "Server Controller");
    KMDIMgrBase *mgr = (KMDIMgrBase *)displayMgrMDI->getMGR();
    KMDIWindow *km = mgr->getWindowByName((char *) sci->name());
    if(km != 0)
      connect(km, SIGNAL(minimized(KMDIWindow *)),
              this, SLOT(MDIMinimized(KMDIWindow *)));
    else
Beispiel #22
0
void RenderTarget::resetGLStates()
{
    if (activate(true))
    {
        // Make sure that GLEW is initialized
        priv::ensureGlewInit();

        // Define the default OpenGL states
        glCheck(glDisable(GL_CULL_FACE));
        glCheck(glDisable(GL_LIGHTING));
        glCheck(glDisable(GL_DEPTH_TEST));
        glCheck(glDisable(GL_ALPHA_TEST));
        glCheck(glEnable(GL_TEXTURE_2D));
        glCheck(glEnable(GL_BLEND));
        glCheck(glMatrixMode(GL_MODELVIEW));
        glCheck(glEnableClientState(GL_VERTEX_ARRAY));
        glCheck(glEnableClientState(GL_COLOR_ARRAY));
        glCheck(glEnableClientState(GL_TEXTURE_COORD_ARRAY));
        m_cache.glStatesSet = true;

        // Apply the default SFML states
        applyBlendMode(BlendAlpha);
        applyTransform(Transform::Identity);
        applyTexture(NULL);
        if (Shader::isAvailable())
            applyShader(NULL);
        m_cache.useVertexCache = false;

        // Set the default view
        setView(getView());
    }
}
Beispiel #23
0
void SimApp::cmdInput(const QSimCommand &cmd)
{
    SimInput *input = new SimInput(cmd, iconReader, stack);
    connect(input, SIGNAL(sendResponse(QSimTerminalResponse)),
            this, SLOT(sendResponse(QSimTerminalResponse)) );
    setView(input);
}
Beispiel #24
0
XFE_HistoryFrame::XFE_HistoryFrame(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec) 
  : XFE_Frame("history", toplevel, parent_frame,
	      FRAME_HISTORY, chromespec, False, True, False, True, False)
{
  // create the History view
  XFE_HistoryView *view = new XFE_HistoryView(this, getViewParent(), NULL, m_context);
  setView(view);

  XtVaSetValues(view->getBaseWidget(),
  		XmNleftAttachment, XmATTACH_FORM,
		XmNtopAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		NULL);

  setMenubar(menu_bar_spec);

  //
  // Make the bookmark frame title more reasonable
  //
  char title[kMaxFullNameLength+64];

  PR_snprintf(title, 
			  sizeof(title),
              XP_GetString(XFE_HISTORY_FRAME_TITLE),
    	      FE_UsersFullName());

  setTitle(title);

  view->show();

  m_dashboard->setShowStatusBar(True);
  m_dashboard->setShowProgressBar(True);
}
Beispiel #25
0
void ZLApplication::initWindow() {
    if (KeyboardControlOption.value()) {
        grabAllKeys(true);
    }
    myWindow->init();
    setView(myInitialView);
}
Beispiel #26
0
    void MapControl::wheelEvent(QWheelEvent *evnt)
    {
        if(mouse_wheel_events &&
            evnt->orientation() == Qt::Vertical)
        {
            if(evnt->delta() > 0)
            {
                if( currentZoom() == layermanager->maxZoom() )
                {
                    return;
                }

                setView(clickToWorldCoordinate(evnt->pos())); //zoom in under mouse cursor
                zoomIn();
            }
            else
            {
                if( currentZoom() == layermanager->minZoom() )
                {
                    return;
                }
                zoomOut();
            }
            evnt->accept();
        }
        else
        {
            evnt->ignore();
        }
    }
Beispiel #27
0
MainEngine::MainEngine(upMainViewInterface&& view,
                       spFunctionalAccounts fAcs,
                       spFunctionalAccount fAc,
                       spFunctionalLL fLL,
                       upAdapterSimpleRef&& adapterLL,
                       upAdapterHideRows&& adapterLanguages,
                       upAdapterSimple&& adapterDct,
                       upAdapterWords&& adapterWords) :
    fAcs_(fAcs),
    fAc_(fAc),
    fLL_(fLL),
    adapterLL_(std::move(adapterLL)),
    adapterLanguages_(std::move(adapterLanguages)),
    adapterDct_(std::move(adapterDct)),
    adapterWords_(std::move(adapterWords))
{
    argument(fAcs_);
    argument(fAc_);
    argument(fLL_);
    argument(adapterLL_);
    argument(adapterLanguages_);
    argument(adapterDct_);
    argument(adapterWords_);
    setView(std::move(view));
    view_->setModelLL(adapterLL_.get());
    view_->setModelLanguages(adapterLanguages_.get());
    view_->setModelDct(adapterDct_.get());
    view_->setModelWords(adapterWords_.get());
}
Beispiel #28
0
void GameState::draw() {
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glUseProgram(assets.ShadeProg);
   setView();
   setPerspectiveMat();
   for (int i = 0; i < actors.size(); i++) {
      if (actors[i].timeToDeath > 0) {
         glUniform3f(assets.h_uMatAmb, 0.1, 0.0, 0.0);
         glUniform3f(assets.h_uMatDif, 0.1, 0.0, 0.0);
      } else {
         glUniform3f(assets.h_uMatAmb, .988, .776, .255);
         glUniform3f(assets.h_uMatDif, .988, .776, .255);
         glUniform3f(assets.h_uMatSpec, 0.14, 0.14, 0.4);
         glUniform1f(assets.h_uMatShine, 120.0);
      }
      actors[i].draw(assets);
   }

   glUniform3f(assets.h_uMatAmb, .584, .102, 0);
   glUniform3f(assets.h_uMatDif, .012, .271, .369);
   glUniform3f(assets.h_uMatSpec, 0.02, 0.02, 0.04);
   glUniform1f(assets.h_uMatShine, 120.0);
   groundPlane->draw(assets);
   glDisableVertexAttribArray(assets.h_aPosition);
   glDisableVertexAttribArray(assets.h_aNormal);

   glfwSwapBuffers(window);
   glfwPollEvents();
}
TiUIScrollViewProxy::TiUIScrollViewProxy(const char* name) :
		Ti::TiViewProxy(name),
		_contentWidthSet(false),
		_contentHeightSet(false)

{
	createPropertySetterGetter("canCancelEvents", _setCanCancelEvents,  _getCanCancelEvents);
	createPropertySetterGetter("contentHeight", _setContentHeight,  _getContentHeight);
	createPropertySetterGetter("contentOffset", _setContentOffset,  _getContentOffset);
	createPropertySetterGetter("contentWidth", _setContentWidth,  _getContentWidth);
	createPropertySetterGetter("disableBounce", _setDisableBounce,  _getDisableBounce);
	createPropertySetterGetter("horizontalBounce", _setHorizontalBounce,  _getHorizontalBounce);
	createPropertySetterGetter("maxZoomScale", _setMaxZoomScale,  _getMaxZoomScale);
	createPropertySetterGetter("minZoomScale", _setMinZoomScale,  _getMinZoomScale);
	createPropertySetterGetter("overScrollMode", _setOverScrollMode,  _getOverScrollMode);
	createPropertySetterGetter("scrollsToTop", _setScrollsToTop,  _getScrollsToTop);
	createPropertySetterGetter("scrollIndicatorStyle", _setScrollIndicatorStyle,  _getScrollIndicatorStyle);
	createPropertySetterGetter("scrollType", _setScrollType,  _getScrollType);
	createPropertySetterGetter("scrollingEnabled", _setScrollingEnabled,  _getScrollingEnabled);
	createPropertySetterGetter("showHorizontalScrollIndicator", _setShowHorizontalScrollIndicator,  _getShowHorizontalScrollIndicator);
	createPropertySetterGetter("showVerticalScrollIndicator", _setShowVerticalScrollIndicator,  _getShowVerticalScrollIndicator);
	createPropertySetterGetter("verticalBounce", _setVerticalBounce,  _getVerticalBounce);
	createPropertySetterGetter("zoomScale", _setZoomScale,  _getZoomScale);

	createPropertyFunction("scrollTo", _scrollTo);
	createPropertyFunction("scrollToBottom", _scrollToBottom);

	_scrollView = new TiUIScrollView(this);
	_nativeScrollView = _scrollView->getScrollView();
	setView(_scrollView);

	_scrollView->childViews.append(_scrollView->getInnerView());
	_scrollView->viewLayout->addChild(_scrollView->getInnerView());
}
Beispiel #30
0
int main(int argc, char *argv[]) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
  glutInitWindowSize(500,500);
  glutInitWindowPosition(10,10);
  glutCreateWindow("Spline");
  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutKeyboardFunc(keyboard);
	glutMouseFunc(mouse);
	glutMotionFunc(mouseMotion);
  installShaders();
/*
	matrixIdentity(ModelView);
	matrixLookat(ModelView,
								.1, 0, 600,
								0, 0, 0,
								0, 0, 1);
	matrixIdentity(Projection);
	matrixPerspective(Projection,
										fovy, 1, 0.01, 1000);
*/
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(40.0, 1.0, 0.1, 1000);
	setView();
  Color[0] = 1.0; Color[1] = 1.0; Color[2] = 0.0;

  glutMainLoop();
  return 0;
}