andrern2000

Member
  • Content count

    24
  • Joined

  • Last visited

Community Reputation

122 Neutral

About andrern2000

  • Rank
    Member
  1. Check this out. This may help you. lazyfoo .net /SDL_tutorials/ lesson05 /index.php (without spaces) Also, you need the image to be saved as PNG. If you saved it as JPEG, the color maybe compressed, resulting the color converted into another channel. So white maybe converted into alittle greyish, so the alpha color code doesn't match with it anymore.
  2. (SDL) Collision Detection Malfunction???

    So, the check_collision() is overriden. Thanks.
  3. SDL - How do I erase a image??

    Basically you need to refresh the screen again, using update_screen() after SDL_freeSurface(). But, hey I get this from Lazyfoo tutorials too. So just go to it.
  4. SDL hardware surfaces not available?

    If I use SDL_HWSURFACE, ..will the rendering process take place in VGA card's hardware cpu? I want to make a 2D game with fast rendering process as SW_SURFACE I guess will sometimes lagging when there are too many 2D objects on screen.... 2. I compare this with: I saw a look on Dark GDK's demonstrations. One of them is 2D demontration. Very fast images pasting with 1000 cycles...
  5. SDL, fullscreen probs

    ..Bump.. I need this for my SDL game development.
  6. Play video files in SDL?

    Xcuse me, Where can I download this SMPEG to play MPEG in SDL? I need this. I currently work on game SDL development.
  7. SDL_PollEvent() problem

    Quote:Original post by rip-off It is hard to say. The only thing I find strange is that the only way "title_screen" can return is if quit is true, which indicates that a SDL_QUIT event occurred. It is usual to exit the program in this case, I don't know whether SDL does something internally to the event queue once a QUIT signal has been generated. It might conceivably disassociate itself from the windows or something. Have you tried using an alternative quit method, such as maybe the escape button? A minor point: is "event" global? It should be pretty trivial to make it local in all cases. Simply pass it as a parameter to any functions that need access to it. I think I'll try that escape button exit method for the exit. Event is global. Yes, I think I'm going to change it to local to avoid internal collision with multithreading compilation. Thanks. @JParishy: it's the actual code. Sorry I didn't write the bool quit = false in the init. But everything went well. It enters the while loop and execute title_screen().
  8. I assume that when 'OTHER_VARIABLE_CHANGES', the tracking become online. This tracking tracks the EVENT_TRIGGERER variable. You have 3 following variables: 1. The tracking online variable. 2. The EVENT_TRIGGERER variable. 3. The OTHER_VARIABLE which experience a change, setting the tracking to online. IMHO, make tracking and this EVENT_TRIGGERER variable as GLOBAL. This way, when the OTHER_VARIABLE is triggered somewhere in a function, the variable 1 is set to online. The variable 1 is used to keep monitoring whether to start the tracking or not. If yes, the tracking is run, keeping an eye of the EVENT_TRIGGERER variable. You can use the variable EVENT_TRIGGERER anywhere in the program to trigger an event and the Track() will report if it works. But the tracking won't work unless it's set online if OTHER_VARIABLE changes. So: BOOL TRACKING_ONLINE BOOL EVENT_TRIGGERER int function() { if(OTHER_VARIABLE_CHANGES) TRACKING_ONLINE = true; } int main() { if(TRACKING_ONLINE) track(); } int track() { if(EVENT_TRIGGERER) cout<<"The variable EVENT_TRIGGERER has triggered an event!"; else cout<<"The variable EVENT_TRIGGERER is inactive"; } Is it what you're looking for?
  9. Hi, nobody answers my thread in For Beginner section, so I post it here ----------------- Has anyone experienced SDL_PollEvent(&event) in a function quits its while loop when it's executed? while(SDL_PollEvent(&event)) ...in this code: int title_screen() { bool quit = false; Title theTitle; while( quit == false ) { //While there's events to handle while( SDL_PollEvent( &event ) ) { theTitle.handle_input(); if( event.type == SDL_QUIT ) { //Quit the program quit = true; } } //Apply surfaces apply_surface ( 0, 0, title, screen ); //Update the screen if( SDL_Flip( screen ) == -1 ) { return 1; } } return 0; } I'm using Multithreaded DLL code generation. The first time title_screen()executed it's normal. That function title_screen() is called within main(). But second time it's executed (the flow is after title_screen() -> main_menu() -> title_screen(), so this function is called again) the SDL_PollEvent() returns false, avoiding the handle_input() function. The main_menu() uses SDL_PollEvent() too and experiencing same problem: First time called it's normal, second call PollEvent() quits irresponsibly. What possibly happening? --------- Btw, this is my main() function: main(...) { while (quit=false) { if mode=1 { title_screen(); } else { mainmenu(); } //While there's events to handle while( SDL_PollEvent( &event ) ) <-- Could it be collides with &event here? { if( event.type == SDL_QUIT ) { //Quit the program quit = true; } } }
  10. Game Design Problem: Game Events

    class Character { int velocity; int distance; bool fire; void keydown(); void move(); } Character::keydown() { switch(input) { case up: velocity +=... case down: velocity -=... case left: velocity +=... case right: velocity -=... case FIRE: fire = true; } } Character::move() { if(fire = true) ... else { distance += velocity; If (outbound of screen) { velocity=0 } } } Does this help you? IMHO this is the more standardized way using OOP
  11. What do you think of this Game Engine?

    That is a clean concept of a game engine. But what game are you planning to make? A game engine like that link is capable of doing worthy project like 3D game. If you try to create simple 2D game, you can make the engine in just a function instead of creating one whole engine like that. Example: create_level(), create_star(), load_files(). Does this help u? [Edited by - andrern2000 on March 29, 2009 6:13:55 AM]
  12. SDL_PollEvent() problem

    Nobody want to help? I need the solution immediately. Wait, let me rewind a bit detail: There are no errors, just the missing condition somewhere in... while( SDL_PollEvent(&event) ) ...which makes it returns false when executed inside a function that's called twice within the main(), so that it won't enter the body. My question is: What causes it to return false? ==== Btw, my main() function: main(...) { while (quit=false) { if mode=1 { title_screen(); } else { mainmenu(); } //While there's events to handle while( SDL_PollEvent( &event ) ) <-- Could it be collides with &event here? { if( event.type == SDL_QUIT ) { //Quit the program quit = true; } } }
  13. SDL_PollEvent() problem

    Sorry! No intend to spam. The double post is unintentional. I clicked the Submit button twice.
  14. SDL_PollEvent() problem

    Has anyone experienced SDL_PollEvent(&event) in a function quits its while loop at the beginning it's executed? while(SDL_PollEvent(&event)) ...in this code: int title_screen() { bool quit = false; Title theTitle; while( quit == false ) { //While there's events to handle while( SDL_PollEvent( &event ) ) { theTitle.handle_input(); if( event.type == SDL_QUIT ) { //Quit the program quit = true; } } //Apply surfaces apply_surface ( 0, 0, title, screen ); //Update the screen if( SDL_Flip( screen ) == -1 ) { return 1; } } return 0; } I'm using Multithreaded DLL code generation. The first time title_screen()executed it's normal. That function title_screen() is called within main(). But second time it's executed (the flow is after title_screen() -> main_menu() -> title_screen(), so this function is called again) the SDL_PollEvent() returns false, avoiding the handle_input() function. The main_menu() uses SDL_PollEvent() too and experiencing same problem: First time called it's normal, second call PollEvent() quits irresponsibly. What possibly happening? [Edited by - andrern2000 on March 28, 2009 4:56:12 AM]
  15. About unique Identifiers for game objects

    Perhaps you need a separate function to number the objects you want to represent its ID.