Jump to content
  • Advertisement

dsage

Member
  • Content count

    136
  • Joined

  • Last visited

Community Reputation

133 Neutral

About dsage

  • Rank
    Member
  1. dsage

    nehe help

    Yeah but it's also defined here: LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); Which hWnd is it using in that function?
  2. dsage

    nehe help

    http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01 Can someone tell me what the hell is global and what is being passed to a function. Like the global window handle or the window instance?
  3. I'm looking for code snippits of collision detection and response for 2d tile based platformers like jnrdev. Mostly stuff on the player's sprite colliding with the tiles.
  4. Thanks for the reply. I see alot of page ripping. I'm going to try to average out the 3-5 delta totals and see if that helps. Thanks again.
  5. I don't know if i'm getting a good figure for my delta. At 319fps i'm geting 0.004 and 0.003 as my delta. Then at 154fps i'm getting 0.006 and 0.007 as my delta. It doesn't sem very percise does it? Check out my code. // FPS if(SDL_GetTicks() - m_startTime >= 1000) { m_fps = m_totalFrames; m_totalFrames = 0; m_startTime = SDL_GetTicks(); } m_totalFrames++; // Time based movement m_oldTime = m_newTime; m_newTime = SDL_GetTicks(); m_diffTime = m_newTime - m_oldTime; m_delta = float(m_diffTime)/1000.0f; // <- o_0 Any ideas?
  6. dsage

    bitshift?

    buffer is an array of chars
  7. dsage

    bitshift?

    I'm getting some strange output... byteCount = recv(client, buffer, 4, 0); std::cout << "bytes recv: " << byteCount << std::endl; std::cout << "buffer: " << buffer << std::endl; number = ((unsigned int)buffer[0] << 0) | ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[2] << 16) | ((unsigned int)buffer[3] << 24); std::cout << "number: " << number << std::endl;[\source] output: bytes recv: 4 buffer: ±äòm number: 4294967281 bytes recv: 4 buffer: j.&#8319;, number: 4294717034 bytes recv: 4 buffer: &#9580;F&#8730;H number: 4294967246 bytes recv: 4 buffer: 2&#8593;ªA number: 4289075250
  8. dsage

    bitshift?

    I have 4 bytes I recieved from a socket. I need to turn the 4 bytes into an unsigned int. Can i do this with bitshift? and how? Thanks...
  9. I'm having trouble comming up with an idea of what to do about my situation. I'm playing with a top-down style game much like legend of zelda. At the moment i'm loading a text file with frame and collision information. I center the image on the bottom of the collision box and use the collision box as the x/y cords of the player. Sample collision/frame file. Note: name | # of frames | time in ms | frame rect in the bmp | collision box name "Link" animations 5 idle_down 1 1:{0,0,31,47}{0,0,26,26} idle_up 1 1:{0,49,31,47}{0,0,26,26} idle_right 1 1:{0,98,31,47}{0,0,26,26} idle_left 1 1:{0,147,31,47}{0,0,26,26} walk_down 9 100:{0,0,31,47}{0,0,26,26},100:{33,0,31,47}{0,0,26,26},100:{66,0,31,47}{0,0,26,26},100:{99,0,31,47}{0,0,26,26},100:{132,0,31,47}{0,0,26,26},100:{165,0,31,47}{0,0,26,26},100:{198,0,31,47}{0,0,26,26},100:{231,0,31,47}{0,0,26,26},100:{264,0,31,47}{0,0,26,26} My question is this: Am I going about this in the right way? Should I have the frame centered in the center of the collision box? Should I use the collision box as the x/y cords? Also how does my animated sprite class look? frame.h #ifndef FRAME_H #define FRAME_H #include <iostream> #include "./sdl/sdl.h" class CFrame { public: CFrame(); ~CFrame(); int time; SDL_Rect rect; SDL_Rect coll; }; #endif // FRAME_H animation.h #ifndef ANIMATION_H #define ANIMATION_H #include "frame.h" class CAnimation { public: CAnimation(); ~CAnimation(); std::string name; unsigned int count; signed int loopCount; // 0 dont loop / -1 loop forever CFrame *frames; }; #endif // ANIMATION_H anim_srpite.h #ifndef ANIM_SPRITE_H #define ANIM_SPRITE_H #include <iostream> #include <string> #include "./sdl/sdl.h" #include "map.h" #include "animation.h" #include "frame.h" class CAnimSprite { public: CAnimSprite(); ~CAnimSprite(); void render(SDL_Rect tempViewRect, SDL_Surface *dest); void setcolorkey(const unsigned int tempR, const unsigned int tempG, const unsigned int tempB); void setalpha(const unsigned int tempAlpha); void setimage(SDL_Surface *tempImage); void setpos(const float tempX, const float tempY); void setvel(const float tempXVel, const float tempYVel); void update(); void setinfo(const std::string &tempFileName); void setanim(const int tempAnim, const signed int tempCount); void setloop(const signed int tempCount); void showcollsion(const bool tempBool); std::string getname(); std::string getanimname(); float getx(); float gety(); int getw(); int geth(); int getcollx(); int getcolly(); int getcollw(); int getcollh(); int getloopcount(); int getanimation(); private: std::string fileName; std::string name; SDL_Surface *image; SDL_Rect s_rect; SDL_Rect d_rect; SDL_Rect coll_rect; bool showCollision; int r; int g; int b; int alpha; float x; float y; int w; int h; bool isLoaded; int startTime; int count; int currentFrame; int currentAnimation; CAnimation *animations; }; #endif // ANIM_SPRITE_H And lastly how does my SDL_Surface manager look? I'm still very newbish using STL. man_image.cpp #include "man_image.h" CImageManager::CImageManager() { } CImageManager::~CImageManager() { for(std::map<std::string, SDL_Surface *>::iterator imageIter = imageMap.begin(); imageIter != imageMap.end(); ++imageIter) { if(imageIter->second != NULL) { SDL_FreeSurface(imageIter->second); std::cerr << "Freeing surface." << std::endl; } } imageMap.clear(); std::cerr << "Clear() called on imageMap." << std::endl; } SDL_Surface * CImageManager::getimage(const std::string &tempFileName) { std::map<std::string, SDL_Surface *>::iterator imageIter = imageMap.find(tempFileName); if(imageIter != imageMap.end()) { std::cerr << "Found image: " << tempFileName << std::endl; return imageIter->second; } else { std::cerr << "Image not found. Trying to load: " << tempFileName << std::endl; SDL_Surface *image = SDL_LoadBMP(tempFileName.c_str()); if(image == NULL) { std::cerr << "Couldn't find image: " << tempFileName << std::endl; return NULL; } imageMap[tempFileName] = image; std::map<std::string, SDL_Surface *>::iterator imageIter = imageMap.find(tempFileName.c_str()); if(imageIter != imageMap.end()) { std::cerr << "Loaded image: " << tempFileName << std::endl; return imageIter->second; } else { std::cerr << "Couldn't find image: " << tempFileName << std::endl; return NULL; } } }
  10. dsage

    this n00b can't find OpenGL libraries

    The first file is the opengl sdk. The second file is a custom opengl project template for c++ .net.
  11. dsage

    this n00b can't find OpenGL libraries

    http://nehe.gamedev.net/files/glsdk.zip You may also want http://nehe.gamedev.net/counter.asp?file=files/appwizards/nehe_opengl_appwizard_vs_net.zip
  12. dsage

    Angel Delight

    The spaceship looks like a Relic Homeworld 2 ripoff. The skinner of the model even copied the default game colors too. Unoriginal stuff like this only hurts your teams credibility. I have been following Hamish's game for some time at http://www.faind.com when it was called FX2 and was freeware and can't wait to see how well it does on the indie market.
  13. dsage

    Center text above an image

    It's amazing what a little pad of paper and some thinking can do. x2 = x1+(w1/2) - (w2/2) Note: I didn't make the background or fish. So i'm not claiming them. Just test images. [Edited by - dsage on September 23, 2005 10:12:35 AM]
  14. dsage

    Center text above an image

    I figured it out.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!