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 - memerson.d

Pages: [1]
1
Graphics / Re: Just Declaring a View Makes Screen Blank
« on: August 06, 2019, 11:21:50 pm »
I have done that. I think I mentioned in my first post that it does not have any arguments in this example because I removed them while just messing with the code trying to get something to work.

A point I was trying to make was that just declaring the view:
Quote
sf::View mainView;
and then doing nothing else at all with it, would stop anything from rendering, which is very odd to me. I would guess that I would have to at least call setView for anything to change, but that doesn't appear to be the case.

2
Graphics / Re: Just Declaring a View Makes Screen Blank
« on: August 05, 2019, 10:20:26 pm »
So an update:

The view works correctly with the circle example given in the tutorial, but the circle is only drawn if I don't declare my Map class.

I went through and commented out all the SFML functions in my Map class, and the draw event, but just having the Map object in my Main file makes the circle not render.

At this point my Map class is essentially just a 2d array being constructed so I am not sure why it would affect the rendering of anything (It had a vertex array as well before I commented it out).

The reverse seems to be true as well. If I have the circle declared, my map will not render, even if I do not draw the circle.


Is there any chance this is because I have included Graphics.hpp in both files?

3
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;
}

4
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