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

Pages: [1] 2
1
General / Re: Need help in creating a game state manager class
« on: August 21, 2013, 06:50:06 pm »
Woops, my bad I had the wrong answer here...yea like Gobbles said below me.  You're missing the class scope on that function.

2
Dude, your game looks good especially only for 14 days work. Guess you have some prior experience?

3
General / Re: Level editor
« on: August 19, 2013, 10:51:53 am »
Just an editor for me to design the levels with. Was thinking this would be easy but I see no easy way to create even a primitive level designer. I basically just have a way to place different tile layers right now. Haven't even got to enemies. As for changing the properties of the enemies within the level...it seems like a ton of work.

4
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.

5
Graphics / Re: beginning of snake
« on: August 16, 2013, 09:12:54 am »
Are you trying to make your snake get bigger and bigger every time you go through the loop? Seems like you'll be adding and element to your deque every time through the loop which would make it huge very quickly.

6
I would guess you're not seeing any animation because

<code>
        clock.restart();
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
        {
            elapse = clock.getElapsedTime();

</code>

since you reset your clock right before you set elapse the time passed is always going to be very small. Just a quick guess from glancing at your code.

7
Graphics / Re: General question about sf::texture
« on: August 11, 2013, 10:53:18 am »
Yes I've been trying to use that example a lot. It just seems weird to have the texture defined at a higher level. To me, it's more intuitive for each low level object to have its own texture. I guess it's something I need to get used to.

8
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?

9
Yes it was unrelated. I think I understand how it will work. I will still need to load a sf::texture from a file and the texCoords are simply the area within the texture to look. Now I will just need to think of how to create a big vertex array to contain each objects vertex array. One challenge after another I suppose. Thanks.

10
I think I see now that you can still define a texture in the same way as I was doing before and pass it along with the vertex array to draw.

Let me ask this instead:

If I have multiple objects that all contain their own vertex array defining their quad vertices do I need to combine them all together into one huge vertex array before I draw them or can I iterate through a list of vertex arrays and draw each? I'm sure I CAN but does that negate the performance increase I'm hoping to get by using a vertex array instead of a sf::sprites?

11
I have been drawing everything so far with sf::sprite and sf::texture so this is a little different. I have probably missed something in a previous tutorial. I'll search for it.

12
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?

13
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.

14
Graphics / Re: Using pure openGL is super slow?
« on: August 05, 2013, 01:24:41 am »
Thanks, you are correct that was the problem. One more question: why does this draw a quad in the entire top right quarter of the screen?

glBegin(GL_QUADS);
glVertex2f( 0.0f, 0.0f);             
glVertex2f( 1.0f, 0.0f);             
glVertex2f( 1.0f, 1.0f);
glVertex2f( 0.0f, 1.0f);
glEnd();

I thought the numbers are supposed to represent pixels on the window? Not sure why it's the entire top right quarter of the screen?

15
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?

Pages: [1] 2
anything