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.


Topics - memerson.d

Pages: [1]
1
Graphics / Just Declaring a View Makes Screen Blank
« on: August 05, 2019, 09:29:01 pm »

I am using the below code to display a map. However, when I uncomment the mainView declaration, all my graphics disappear. This occurs even if I do not call setView on my window.

I know the view needs arguments to work correctly, but I removed them just messing around to see if anything would work. Why are things changing without calling setView? any ideas?

Quote
int main()
{


   //Get Window Size

   int screenWidth = sf::VideoMode::getDesktopMode().width;
   int screenHeight = sf::VideoMode::getDesktopMode().height -22;



   //Create Window
   sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");

   window.setSize( sf::Vector2u(screenWidth, screenHeight) );
   window.setPosition( sf::Vector2i(0, 0) );


   //sf::View mainView;


   //window.setView(mainView);

   //Init Game

   Map map;

   map.initMap();

   //Main loop
   while (window.isOpen())
   {
      sf::Event event;
      while (window.pollEvent(event))
      {
         //Window Closed
         if (event.type == sf::Event::Closed)
            window.close();      
      }

      //Drawing
      window.clear();

      map.drawMap(window);

      window.display();
   }

   return 0;
}

2
Graphics / How to Create Simple GUI With SFML
« on: September 11, 2016, 08:05:07 pm »
I am trying to create simple menus for my game and level editor I am working on. I would like to implement this GUI without another library, but I am not sure where to start when making separate sections on the screen.

For example, In my level editor I would like a side bar with pictures of sprites to choose from. How do I separate these two areas while keeping the level area to scale? I considered using two separate views, one for the level and one for the GUI so it would be easy to scale the image of the level. I also thought that maybe I could just use a color filled shape or image for my "window" and then draw text and other GUI elements on top, but then I'm not sure how to keep the level to scale.

When searching online, all I found were people saying to use other libraries like imGUI. I am not asking for someone to write the code for me. I would just like to know if there is a best or most efficient way of doing this and what kinds of objects I should be using to accomplish this.

Thank you in advance.

Pages: [1]
anything