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 - hipsterdufus

Pages: [1]
1
General / Level editor
« on: August 19, 2013, 08:10:50 am »
Hi all, I'm trying to make my own level editor for a 2d platformer but it is becoming super time consuming. Adding all the features is taking forever. I don't want to use Tiled because I've already incorporated saving/loading using the boost serialization library. From what I see tiled saves level data into xml format. Is there any easy or easier way to go about level design? If you look at any 2d side scroller there must have been a ton of work that went into the level editor. I would think there is an easy way to do this sort of thing.

2
Graphics / General question about sf::texture
« on: August 11, 2013, 08:26:31 am »
Hi all, just a question about how this sort of thing is usually done. I have a list of "tiles" that make up my level. Should each tile have it's own sf::Texture or should the sf::Texture be contained in my "level" class. Seems kind of wasteful when each object is going to have a copy of the same texture ("tileset.png") but without owning its own copy I'm not sure how each one can individually draw itself if it wants to. I'm trying to use a big vertex array instead of sprites to draw the map btw so I'm rethinking my entire design. Any tips on how this should be done?

3
Graphics / Drawing a tilemap with a sf::VertexArray like in the example
« on: August 08, 2013, 09:21:30 am »
Hi, could someone please clarify something for me? I'm trying to draw my tilemap with a big sf::VertexArray sort of like in this example: http://www.sfml-dev.org/tutorials/2.0/graphics-vertex-array.php

I'm confused on how to texture each quad. I will be loading my big tileset file into a texture right? I guess I'm lost by this part:

                quad[0].texCoords = sf::Vector2f(tu * tileSize.x, tv * tileSize.y);
                quad[1].texCoords = sf::Vector2f((tu + 1) * tileSize.x, tv * tileSize.y);
                quad[2].texCoords = sf::Vector2f((tu + 1) * tileSize.x, (tv + 1) * tileSize.y);
                quad[3].texCoords = sf::Vector2f(tu * tileSize.x, (tv + 1) * tileSize.y);

I need to set each vertex texCoords but how does it know where to look based on a sf::Vector2f? I guess the real question is what are texCoords? How do I pick a piece of my tileset to texture the quad with?

4
Hi everyone, I decided to use boost::serialize to input or output my level data into a file. My level data basically just consists of a few std::vectors that contain the tiles in the level. Each tile contains sf::sprites and sf::textures along with a position. I can serialize everything in the tile class with the exception of the sf::sprite and sf::texture data. These are sfml types that boost doesn't know how to output or read in. Does anyone have any ideas on how to do this? I feel like there should be a simple solution that I'm overlooking here.

5
Graphics / Using pure openGL is super slow?
« on: August 04, 2013, 10:30:50 pm »
Hi all, I am stumped by the following problem. I created a class that will represent my game's menu screen. There's really nothing in this class other than it inherits public sf::Drawable and I'm overriding the draw function as follows:

void ScreenMenu::draw(sf::RenderTarget& target, sf::RenderStates states) const {

   target.clear(sf::Color::Black);
   glBegin(GL_QUADS);
   glVertex3f( 0.0f, 0.0f, 0.f);             
    glVertex3f( 5.0f, 0.0f, 0.f);             
    glVertex3f( 5.0f, 5.0f, 0.f);
   glVertex3f( 0.0f, 5.0f, 0.f);
   glEnd();

}



This gets called here from my main class:

   while (mWindow.isOpen()){
      // check all the window's events that were triggered since the last iteration of the loop
      sf::Event event;
      while (mWindow.pollEvent(event)){
         // "close requested" event: we close the window
         if (event.type == sf::Event::Closed)
            mWindow.close();
      }

      mWindow.draw(screenMenu);
   }



There must be something stupid I'm not initializing correctly...the screen comes up all white and its laggy as hell. I can close the window (after some serious lag) or if I don't my graphics card driver crashes and restarts. Is there something I'm forgetting to do here?

6
SFML projects / The best SFML games
« on: July 13, 2013, 06:59:00 pm »
Hi all, just wondering if anyone can point me to a few of the best of the best SFML games out there. It'd be cool to see what is possible with the library. Unfortunately, it's hard to know what games are made with what tools. So what do you think are a few of the best games made with SFML?

7
General / General C++ question: Defining a struct within a class
« on: July 11, 2013, 09:00:54 am »
Hi all, this is a general question about C++. I'm trying to make a Camera class which will contain 2 private member values: an sf::View and a struct containing various camera properties. So basically my idea is, outside this class, you will be able to call Camera.setProperties(<STRUCT CONTAINING DESIRED PROPERTIES>) and that will effectively set up the entire Camera class. So in Camera.h I have my private struct m_CameraProperties. In Camera.cpp I have the definition of that struct - struct Camera::m_CameraProperties{<stuff>};

But when I try to declare my setProperties(<camera properties struct>) it's not letting me use the struct in here. Any ideas? I know I could just ditch a struct and use several variables but I'd like to be able to pass a neat little structure instead of a bunch of random variables. Thanks for any help.

8
Graphics / sf::view is incredibly slow?
« on: July 10, 2013, 06:54:25 am »
Hi all, I am working on the next big thing and everything was running pretty smoothly with no lag until I decided to attach an sf::view to the renderwindow. Basically the goal is to make the camera stay on the player (2d side scroller style). So the view center is updated with the player center every frame. Unfortunately this is unbelievably horribly slow. I went from my standard 60fps to probably around 1...no idea how something like this could happen. Is there something about the View class that I didn't catch? Do I need to go about moving the camera in another way - using my own class? Thanks for any help!

Pages: [1]
anything