Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - graider

Pages: [1]
1
Graphics / Re: Mouse not accurate when using views how can I fix this?
« on: October 19, 2013, 09:27:19 pm »
Thanks. This fixed some graphical glitches I was having as well, (rectangle would chop off when moved.)

can fix the same glitches with my other view.
Quote from: victorlevasseur

link=topic=13294.msg93314#msg93314 date=1382207935
I think you should use that function provided just for what you want to do : http://www.sfml-dev.org/documentation/2.1/classsf_1_1RenderTarget.php#a46eb08f775dd1420d6207ea87dde6e54

2
Graphics / Mouse not accurate when using views how can I fix this?
« on: October 19, 2013, 07:51:02 pm »
I have a split view as the code will show below. the mouse seems to only be close to the rect displayed in the center and as it moves towards the edges it drifts farther from the rect. I'm thinking this is caused by the fact that the mouse uses the total window for it positioning but the draw function scales with the view??? is there a way to tie the mouse to a view.

   sf::View tileView, mapView;
   tileView.setViewport(sf::FloatRect(0, 0, 1.0f, 1.0f));
   //tileView.setSize(100, DWIN_HEIGHT);
   mapView.setViewport(sf::FloatRect(0, 0.074f, 1.0f, 1.0f));
   //mapView.setSize(DWIN_WIDTH, DWIN_HEIGHT - (DWIN_HEIGHT/10) );
        ...

      displayWindow.setView(tileView);
      currentLevel->UpdateTileView(pWindow);

      //display are map here
      displayWindow.setView(mapView);
      currentLevel->UpdateMapView(pWindow);

         //event I'm using
            case sf::Event::MouseMoved:
               currentLevel->setTilePosistion(sf::Mouse::getPosition(displayWindow));
               break;

// last but not least drawing the rect
   sf::RectangleShape selector(sf::Vector2f(30, 30));
   selector.setFillColor(sf::Color::Transparent);
   selector.setOutlineColor(sf::Color::Black);
   selector.setOutlineThickness(1.0f);
   selector.setPosition((tileSelectedX), (tileSelectedY));

   window->draw(selector);

 

Pages: [1]
anything