Example #1
0
void GLAppMain::idle()
{
    float ratio = (float)window_width / (float) window_height;
    projection.perspective(45,ratio,1,10000);

    vec3 lat = vec3(0,1,0)^lookat;
    lat.normalize();

    // keyboard events
    if(keys[KEY_ESC]) exit();
    if(keys[' ']){ 
	    goon = !goon;
	    keys[' '] = 0;
	  }
    if(keys[KEY_UP]) {
        pos += lookat*(50/fps);
        keys[KEY_UP] = 0;
    }
    if(keys[KEY_DOWN]) {
        pos -= lookat*(50/fps);
        keys[KEY_DOWN] = 0;
    }
    if(keys[KEY_LEFT]) {
        pos += lat*(50/fps);
        keys[KEY_LEFT] = 0;
    }
    if(keys[KEY_RIGHT]) {
        pos -= lat*(50/fps);
        keys[KEY_RIGHT] = 0;
    }

    static int look = 0;
    if(!look && mouse_button & BUTTON_LEFT) {
        setCursor(window_width / 2,window_height / 2);
        mouse_x = window_width / 2;
        mouse_y = window_height / 2;
        look = 1;
    }
    if(mouse_button & BUTTON_RIGHT) look = 0;

    if(look) {
        showCursor(0);
        mat3 m;
        m.rotate( lat, (mouse_y - window_height / 2) * 0.2 );
        lookat = m*lookat;
        m.rotate_y( -(mouse_x - window_width / 2) * 0.2 );
        lookat = m*lookat;
        setCursor(window_width / 2,window_height / 2);
    } else showCursor(1);

    vec3 up = lookat^lat;
    up.normalize();
    modelview.look_at(pos,pos+lookat,up);
}
Example #2
0
		int main(void)
		{

			DlList_T myList =dll_create();
			void *one=5;
			void *two=6;
			void *three=9;
			dll_append(myList,one);
			dll_append(myList,two);
			dll_append(myList,three);
			dll_move_to(myList,2);
			showCursor(myList);
			dll_move_to(myList,1);
			showCursor(myList);
			dll_move_to(myList,3);
			showCursor(myList);
			dll_move_to(myList,257);
			showCursor(myList);
			dll_move_to(myList,1);
			showCursor(myList);

			printList(myList);
			printf("SIZE IS %d\n",dll_size(myList));
			

			dll_clear(myList);
			dll_append(myList,one);
			dll_append(myList,two);
			dll_append(myList,three);
			dll_move_to(myList,2);
			showCursor(myList);
			dll_move_to(myList,1);
			showCursor(myList);
			dll_move_to(myList,3);
			showCursor(myList);
			dll_move_to(myList,257);
			showCursor(myList);
			dll_move_to(myList,1);
			showCursor(myList);
			printList(myList);
			printf("SIZE IS %d\n",dll_size(myList));
			


			return 0;



		}
Example #3
0
// Select the next/previous neighbour of the selected point
void CanvasPicker::shiftPointCursor( bool up )
{
    if ( !d_selectedCurve )
        return;

    int index = d_selectedPoint + ( up ? 1 : -1 );
    index = ( index + d_selectedCurve->dataSize() ) % d_selectedCurve->dataSize();

    if ( index != d_selectedPoint )
    {
        showCursor( false );
        d_selectedPoint = index;
        showCursor( true );
    }
}
Console::Console(int width, int height)
{
	m_width = width;
	m_height = height;
	m_cursorX = 0;
	m_cursorY = 0;
	m_textAttributes = NormalText;

	m_pBuffer = new CHAR_INFO[width*height];
	memset(m_pBuffer, 0, sizeof(CHAR_INFO) * width * height);

	AllocConsole();
	m_input = GetStdHandle(STD_INPUT_HANDLE);
	m_output = GetStdHandle(STD_OUTPUT_HANDLE);

	// disable line input mode
	SetConsoleMode(m_input, 0);

	// resize console
	COORD size;
	size.X = width;
	size.Y = height;
	SetConsoleScreenBufferSize(m_output, size);
    MoveWindow(GetConsoleWindow(), 100, 100, width*9, height*13, TRUE);

	showCursor(false);
}
Example #5
0
void
COSXScreen::enter()
{
	showCursor();

	if (m_isPrimary) {
		CGSetLocalEventsSuppressionInterval(0.0);
		
		// enable global hotkeys
		//setGlobalHotKeysEnabled(true);
	}
	else {
		// reset buttons
		m_buttonState.reset();

		// avoid suppression of local hardware events
		// [email protected]
		CGSetLocalEventsFilterDuringSupressionState(
								kCGEventFilterMaskPermitAllEvents,
								kCGEventSupressionStateSupressionInterval);
		CGSetLocalEventsFilterDuringSupressionState(
								(kCGEventFilterMaskPermitLocalKeyboardEvents |
								kCGEventFilterMaskPermitSystemDefinedEvents),
								kCGEventSupressionStateRemoteMouseDrag);
	}

	// now on screen
	m_isOnScreen = true;
}
Example #6
0
void Window::setWindowDecoration(bool hasDecoration)
{
    if (_screenId != -1)
        return;

    glfwWindowHint(GLFW_VISIBLE, true);
    glfwWindowHint(GLFW_RESIZABLE, hasDecoration);
    glfwWindowHint(GLFW_DECORATED, hasDecoration);
    GLFWwindow* window;
    window = glfwCreateWindow(_windowRect[2], _windowRect[3], ("Splash::" + _name).c_str(), 0, _window->getMainWindow());

    // Reset hints to default ones
    glfwWindowHint(GLFW_RESIZABLE, true);
    glfwWindowHint(GLFW_DECORATED, true);

    if (!window)
    {
        Log::get() << Log::WARNING << "Window::" << __FUNCTION__ << " - Unable to update window " << _name << Log::endl;
        return;
    }

    _window = move(make_shared<GlWindow>(window, _window->getMainWindow()));
    updateSwapInterval();
    setupRenderFBO();
    setupReadFBO();

    setEventsCallbacks();
    showCursor(false);

    return;
}
Example #7
0
void
COSXScreen::disable()
{
	if (m_autoShowHideCursor) {
		showCursor();
	}
    
	// FIXME -- stop watching jump zones, stop capturing input
	
	if (m_eventTapRLSR) {
		CFRelease(m_eventTapRLSR);
		m_eventTapRLSR = nullptr;
	}

	if (m_eventTapPort) {
		CFRelease(m_eventTapPort);
		m_eventTapPort = nullptr;
	}
	// FIXME -- allow system to enter power saving mode

	// disable drag handling
	m_dragNumButtonsDown = 0;
	enableDragTimer(false);

	// uninstall clipboard timer
	if (m_clipboardTimer != NULL) {
		m_events->removeHandler(CEvent::kTimer, m_clipboardTimer);
		m_events->deleteTimer(m_clipboardTimer);
		m_clipboardTimer = NULL;
	}

	m_isOnScreen = m_isPrimary;
}
Example #8
0
// Move the selected point
void CanvasPicker::move(const QPoint &pos)
{
    if ( !d_selectedCurve )
        return;

    QVector<double> xData(d_selectedCurve->dataSize());
    QVector<double> yData(d_selectedCurve->dataSize());

    for ( int i = 0; i < (int)d_selectedCurve->dataSize(); i++ )
    {
        if ( i == d_selectedPoint )
        {
            xData[i] = plot()->invTransform(
                d_selectedCurve->xAxis(), pos.x());
            yData[i] = plot()->invTransform(
                d_selectedCurve->yAxis(), pos.y());
        }
        else
        {
            const QPointF sample = d_selectedCurve->sample(i);
            xData[i] = sample.x();
            yData[i] = sample.y();
        }
    }
    d_selectedCurve->setSamples(xData, yData);

    plot()->replot();
    showCursor(true);
}
Example #9
0
void EventsManager::setCursor(int cursorId) {
	XSurface cursor;
	_sprites.draw(cursor, cursorId);

	CursorMan.replaceCursor(cursor.getPixels(), cursor.w, cursor.h, 0, 0, 0);
	showCursor();
}
Example #10
0
TEditor::TEditor( const TRect& bounds,
                  TScrollBar *aHScrollBar,
                  TScrollBar *aVScrollBar,
                  TIndicator *aIndicator,
                  size_t aBufSize ) :
    TView( bounds ),
    hScrollBar( aHScrollBar ),
    vScrollBar( aVScrollBar ),
    indicator( aIndicator ),
    bufSize( aBufSize ),
    canUndo( True ),
    selecting( False ),
    overwrite( False ),
    autoIndent( False ) ,
    lockCount( 0 ),
    keyState( 0 )
{
    growMode = gfGrowHiX | gfGrowHiY;
    options |= ofSelectable;
    eventMask = evMouseDown | evKeyDown | evCommand | evBroadcast;
    showCursor();
    initBuffer();
    if( buffer != 0 )
        isValid = True;
    else
    {
        editorDialog( edOutOfMemory );
        bufSize = 0;
        isValid = False;
    }
    setBufLen(0);
}
Example #11
0
void LLWindowMacOSX::showCursorFromMouseMove()
{
	if (!mHideCursorPermanent)
	{
		showCursor();
	}
}
Example #12
0
/*!
  Handle a mouse press event for the observed widget.

  \param mouseEvent Mouse event
  \sa eventFilter(), widgetMouseReleaseEvent(),
      widgetMouseMoveEvent(),
*/
void QwtPanner::widgetMousePressEvent( QMouseEvent *mouseEvent )
{
    if ( ( mouseEvent->button() != d_data->button )
        || ( mouseEvent->modifiers() != d_data->buttonModifiers ) )
    {
        return;
    }

    QWidget *w = parentWidget();
    if ( w == NULL )
        return;

#ifndef QT_NO_CURSOR
    showCursor( true );
#endif

    d_data->initialPos = d_data->pos = mouseEvent->pos();

    setGeometry( parentWidget()->rect() );

    // We don't want to grab the picker !
    QVector<QwtPicker *> pickers = qwtActivePickers( parentWidget() );
    for ( int i = 0; i < pickers.size(); i++ )
        pickers[i]->setEnabled( false );

    d_data->pixmap = grab();
    d_data->contentsMask = contentsMask();

    for ( int i = 0; i < pickers.size(); i++ )
        pickers[i]->setEnabled( true );

    show();
}
Example #13
0
bool System::execute(const char *bas) {
  _stackTrace.removeAll();
  _output->reset();
  reset_image_cache();

  // reset program controlled options
  opt_antialias = true;
  opt_show_page = false;
  opt_quiet = true;
  opt_pref_width = _output->getWidth();
  opt_pref_height = _output->getHeight();
  opt_base = 0;
  opt_usepcre = 0;
  opt_autolocal = 0;

  _state = kRunState;
  setWindowTitle(bas);
  showCursor(kArrow);
  int result = ::sbasic_main(bas);
  if (isRunning()) {
    _state = kActiveState;
  }

  if (_editor == NULL) {
    opt_command[0] = '\0';
  }
  enableCursor(true);
  opt_file_permitted = 1;
  _output->selectScreen(USER_SCREEN1);
  _output->resetFont();
  _output->flush(true);
  _userScreenId = -1;
  return result;
}
Example #14
0
void IUIMapWindow::onPushedOver ()
{
	showHud();
	UIWindow::onPushedOver();
	if (_cursorActive)
		showCursor(true);
}
Example #15
0
void drawReminder()
{	
	fb_setClipping(3,41,252, 150);
	
	fb_drawRect(0,37,255,148,textAreaFillColor);
	setFont(font_arial_9);
	setColor(textAreaTextColor);	
	setWrapToBorder();
	
	if(blinkOn())
	{
		if(isInsert())
			setCursorProperties(cursorNormalColor, 1, -1, 0);
		else
			setCursorProperties(cursorOverwriteColor, 1, -1, 0);
			
		showCursor();
		setCursorPos(getKBCursor());		
	}
	
	setFakeHighlight();
	
	fb_dispString(0,-3,reminder);
	
	setWrapNormal();
	hideCursor();
	clearHighlight();
	drawCurDay();
}
Example #16
0
/*!
  Handle a mouse release event for the observed widget.

  \param me Mouse event
  \sa eventFilter(), widgetMousePressEvent(),
      widgetMouseMoveEvent(),
*/
void QwtPanner::widgetMouseReleaseEvent(QMouseEvent *me)
{
    if ( isVisible() )
    {
        hide();
#ifndef QT_NO_CURSOR
        showCursor(false);
#endif

        QPoint pos = me->pos();
        if ( !isOrientationEnabled(Qt::Horizontal) )
            pos.setX(d_data->initialPos.x());
        if ( !isOrientationEnabled(Qt::Vertical) )
            pos.setY(d_data->initialPos.y());

        d_data->pixmap = QPixmap();
        d_data->pos = pos;

        if ( d_data->pos != d_data->initialPos )
        {
            emit panned(d_data->pos.x() - d_data->initialPos.x(), 
                d_data->pos.y() - d_data->initialPos.y());
        }
    }
}
Example #17
0
void ToucheEngine::op_setFlag() {
	debugC(9, kDebugOpcodes, "ToucheEngine::op_setFlag()");
	uint16 flag = _script.readNextWord();
	int16 val = *_script.stackDataPtr;
	_flagsTable[flag] = val;
	switch (flag) {
	case 104:
		_currentKeyCharNum = val;
		break;
	case 611:
		if (val != 0)
			quitGame();
		break;
	case 612:
		_flagsTable[613] = getRandomNumber(val);
		break;
	case 614:
	case 615:
		_fullRedrawCounter = 1;
		break;
	case 618:
		showCursor(val == 0);
		break;
	case 619:
		debug(0, "Unknown music flag %d", val);
		break;
	}
}
Example #18
0
App::App( double deltaTime, int width, int height, float fov, const char* windowTitle )
    :	GameApp( deltaTime, width, height, fov, windowTitle )
    ,	m_subdivisions( 4 )
    ,	m_currentMatBeingTestedName( "StaticShield.xml" )
    ,	m_currentMatBeingTestedPath( "./materials/StaticShield_01.xml" )
    ,	m_unlit( false )
{
    showCursor( true );
    m_materialGenerator = new MaterialGenerator();

    m_materialGenerator->GenerateMaterial( m_currentMatBeingTestedPath );

    m_icosahedron = MeshFactory::generateIcosahedron( 5.0f, m_subdivisions, m_currentMatBeingTestedName, Color4f(1.f,1.f,1.f,0.f) );

    m_light = new Light();
    m_light->direction = vec3f( 0.0f, -1.0f, 0.0f );
    m_light->color = color::WHITE;
    m_icosahedron->addLight( m_light, 0 );

    m_dudLight = new Light();
    for( int i = 1; i < MAX_NUM_LIGHTS; ++i )
    {
        m_icosahedron->addLight( m_dudLight, i );
    }
}
Example #19
0
void ConWindow::shutdown()
{
    if (!isendwin()) {
        showCursor();
        endwin();
    }
} // end ConWindow::shutdown
Example #20
0
void JListBox::afterPaint(JRect *rect) {
  if (!--updateLock) {
    if (focusOn && !cursorVisible) {
      showCursor(rect);
      cursorVisible++;
    }
  }
}
void *TCluster::read( ipstream& is )
{
    TView::read( is );
    is >> value >> sel >> strings;
    setCursor( 2, 0 );
    showCursor();
    return this;
}
Example #22
0
void JListBox::beforePaint(JRect *rect) {
  if (!updateLock++) {
    if (focusOn && cursorVisible) {
      showCursor(rect);
      cursorVisible--;
    }
  }
}
Example #23
0
// Select the next/previous curve
void CanvasPicker::shiftCurveCursor( bool up )
{
    QwtPlotItemIterator it;

    const QwtPlotItemList &itemList = plot()->itemList();

    QwtPlotItemList curveList;
    for ( it = itemList.begin(); it != itemList.end(); ++it )
    {
        if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve )
            curveList += *it;
    }
    if ( curveList.isEmpty() )
        return;

    it = curveList.begin();

    if ( d_selectedCurve )
    {
        for ( it = curveList.begin(); it != curveList.end(); ++it )
        {
            if ( d_selectedCurve == *it )
                break;
        }
        if ( it == curveList.end() ) // not found
            it = curveList.begin();

        if ( up )
        {
            ++it;
            if ( it == curveList.end() )
                it = curveList.begin();
        }
        else
        {
            if ( it == curveList.begin() )
                it = curveList.end();
            --it;
        }
    }

    showCursor( false );
    d_selectedPoint = 0;
    d_selectedCurve = static_cast<QwtPlotCurve *>( *it );
    showCursor( true );
}
Example #24
0
void PhotoView::mouseMoveEvent ( QMouseEvent * event )
{
    // logDebug() << endl;
    _idleTimer.start( _idleTimeout );
    showCursor();

    QGraphicsView::mouseMoveEvent( event );
}
Example #25
0
void IUIMapWindow::start ()
{
	_startButton->setVisible(false);
	_waitLabel->setVisible(false);
	if (_cursorActive)
		showCursor(false);
	_nodeMap->start();
	Config.setBindingsSpace(BINDINGS_MAP);
}
void *TCluster::read(ipstream &is) {
   TView::read(is);
   is >> value >> sel >> enableMask >> strings;

   setCursor(2, 0);
   showCursor();
   setButtonState(0, True);
   return this;
}
Example #27
0
bool CanvasPicker::event( QEvent *ev )
{
    if ( ev->type() == QEvent::User )
    {
        showCursor( true );
        return true;
    }
    return QObject::event( ev );
}
Example #28
0
 bool CanvasPicker::event(QEvent *e)
 {
     qDebug() << __FILE__ << __FUNCTION__;
     if ( e->type() == QEvent::User )
     {
         showCursor();
         return true;
     }
     return QObject::event(e);
 }
Example #29
0
void exceptionMessage(const exception &excp) {
	string message, title;
	showCursor(true);

	message += "ERROR(S):\n\n";
	message += excp.what();

	title = "Error: Unhandled Exception";
	MessageBox(NULL, message.c_str(), title.c_str(), MB_ICONSTOP | MB_OK | MB_TASKMODAL);
}
Example #30
0
void DestroyKeyboard() {
	XkbSetDetectableAutoRepeat(g.Disp, 0, NULL);

    // Enable cursor and revert grab cursor if mouse
    if (g.cfg.PadDef[0].Type == PSE_PAD_TYPE_MOUSE ||
        g.cfg.PadDef[1].Type == PSE_PAD_TYPE_MOUSE) {
        grabCursor(g.Disp, window, 0);
        showCursor(g.Disp, window, 1);
    } else if (g.cfg.HideCursor) {
        showCursor(g.Disp, window, 1);
    }

    // Enable screensaver if it was disabled - this could be in different place
    if (resumeScrSaver) {
        char buf[64];
        printf("Resuming Window ID 0x%x to activate screensaver.\n", window);
        snprintf(buf, 64, "xdg-screensaver resume 0x%x", window);
        FILE *phandle = popen(buf, "r");
        pclose(phandle);
    }
}