• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

coderx04

Members
  • Content count

    43
  • Joined

  • Last visited

Community Reputation

122 Neutral

About coderx04

  • Rank
    Member
  1. Thank you very much eville, its really help. Its working fine now. I will rate you *_*
  2. Unity

    ooww thank you, Im giving funny question yeah? :P.. Thankss..
  3. Unity

    How to check if there is any key being pressed??
  4. ok cool , thanks for the help...
  5. void CSprite::clearBG() { if(mDrawn==1) { SDL_Rect dest; dest.x = mOldX; dest.y = mOldY; dest.w = mSpriteBase->mW; dest.h = mSpriteBase->mH; SDL_BlitSurface(mBackreplacement, NULL, mScreen, &dest); } } void CSprite::updateBG() { SDL_Rect srcrect; srcrect.w = mSpriteBase->mW; srcrect.h = mSpriteBase->mH; srcrect.x = mX; srcrect.y = mY; mOldX=mX;mOldY=mY; SDL_BlitSurface(mScreen, &srcrect, mBackreplacement, NULL); } Where is wrong with that? And actually Im not quite understand how to - Erase all the Image in the screen? - when to use the SDL_FLIP? - Whats wrong with the transparant image?
  6. Soory I dont understand what you mean by dirty rectangle method? Is it because I flip the whole screen? I have to flip every rectangle sprite or what? Please help ... And what is Antiliasing ? how to solve this? please..
  7. The one with yellow circle is what im complain about..
  8. void DrawScene() { sun.clearBG(); Swords.clearBG(); sun.updateBG(); Swords.updateBG(); sun.draw(); Swords.draw(); SDL_Flip(screen); } SDL_Surface * ImageLoad(char *file) { SDL_Surface *temp1, *temp2; temp1 = SDL_LoadBMP(file); temp2 = SDL_DisplayFormat(temp1); SDL_FreeSurface(temp1); return temp2; } int InitImages() { back = ImageLoad("back.bmp"); image = ImageLoad("map1.bmp"); return 0; } //--------------------------------------------- void DrawBG(SDL_Surface *bg) { //Slock(screen); SDL_FillRect(screen, NULL, 0); DrawIMG(bg, 0, 0); } //--------------------------------------------- int main(int argc, char *argv[]) { Uint8* keys; my_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param); if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_TIMER) <0 ) { printf("Unable to init SDL: %s\n", SDL_GetError()); return 1; } atexit(SDL_Quit); if(Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0) { printf("Warning: Couldn't set 44100 Hz 16-bit audio\n - Reason: %s\n", SDL_GetError()); } screen=SDL_SetVideoMode(SCREENWIDTH,SCREENHEIGHT,32,SDL_SWSURFACE|SDL_FULLSCREEN|SDL_HWPALETTE); if ( screen == NULL ) { printf("Unable to set 640x480 video: %s\n", SDL_GetError()); exit(1); } //load the music music = Mix_LoadMUS("data/sound/(sblu)moon6.xm"); //play the music if(!Mix_PlayingMusic()) { // then start playing it. Mix_PlayMusic(music, 0); } Swordsbase.init("data/testC/down"); sunbase.init("data/sun"); sun.init(&sunbase,screen); sun.set(480,50); sun.setSpeed(1); Swords.init(&Swordsbase,screen); Swords.set(150,300); Swords.setSpeed(2); SDL_ShowCursor(0); font = initFont("data/font"); InitImages(); //DrawBG(back); while (game_state!=GAME_EXIT) { SDL_Event event; while ( SDL_PollEvent(&event) ) { if ( event.type == SDL_QUIT ) { game_state=GAME_EXIT;} if ( event.type == SDL_KEYDOWN ) { if ( event.key.keysym.sym == SDLK_ESCAPE ) { game_state=GAME_EXIT; } } } keys = SDL_GetKeyState(NULL); if ( keys[SDLK_UP] ) { Swords.yadd(-1); } if ( keys[SDLK_DOWN] ) { Swords.yadd(1); } if ( keys[SDLK_LEFT] ) { Swords.xadd(-1); } if ( keys[SDLK_RIGHT] ) { Swords.xadd(1); } if ( keys[SDLK_s] ) { if(game_state!=GAME_RUN||game_state!=GAME_STARTING) { SDL_FillRect(screen,0,0); sun.clearBG(); Swords.clearBG(); game_state = GAME_STARTING; } //SDL_FillRect(screen,0,0); //DrawIMG(image, 0, 0); //SDL_Flip(screen); } if(game_state == GAME_INIT) DrawBG(back); if(game_state == GAME_STARTING) { SDL_FillRect(screen, NULL, 0); DrawBG(image); //SDL_Flip(screen); //game_state++; } DrawScene(); } return 0; } I have problem, when the character move down, it have some red colour on the screen.. And when I change the background image, it still have a square colour from the previous background image... Ill show you the picture how to upload a picture in here?
  9. ok thanks.. One Question, I can just basically use SDL_DELAY(100) for 10 millisecond rite?.. thankss..
  10. Quote:Original post by coderx04 Or make the movement time based, so instead of saying move 1 unit per frame, you can say more X units per second. how to move X units per second actually? using the SDL_DELAY?
  11. [quote]Or make the movement time based, so instead of saying move 1 unit per frame, you can say more X units per second. [\quote] how to move X units per second actually? using the SDL_DELAY?
  12. How to get the correct time in SDL? is there any example of using SDL_TIMER?
  13. Why not hard Code it? Is there any other way to force change the resolution when the game start. because, I dont want to have the game be different if the use change the display settings. And thanks, After I include windows.h before include winuser.h It did compile, but still no different.
  14. Quote: void ChangeRes() { // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_7gz7.asp // #include <winuser.h> // get the current devices display settings DEVMODE lpDevMode; ZeroMemory(&lpDevMode, sizeof(DEVMODE)); lpDevMode.dmSize = sizeof(DEVMODE); lpDevMode.dmDriverExtra = 0; if (!EnumDisplaySettings(NULL/* current device */,ENUM_CURRENT_SETTINGS, &lpDevMode)) ExitProcess(1); if (lpDevMode.dmPelsWidth == 800 && lpDevMode.dmPelsHeight == 600) return; // no need to change // set settings lpDevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; lpDevMode.dmPelsWidth = 800; lpDevMode.dmPelsHeight = 600; lpDevMode.dmDisplayFrequency = 85; // change settings long status; do { status = ChangeDisplaySettings(&lpDevMode, CDS_FULLSCREEN /* temporary, till program exits*/); lpDevMode.dmDisplayFrequency -= 5; } while (status != DISP_CHANGE_SUCCESSFUL && lpDevMode.dmDisplayFrequency >= 60); if (status != DISP_CHANGE_SUCCESSFUL) { lpDevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT ; status = ChangeDisplaySettings(&lpDevMode, CDS_FULLSCREEN /* temporary, till program exits*/); if (status != DISP_CHANGE_SUCCESSFUL) ExitProcess(1); } } I got this code from my tutor for borland C++ builder, But When I use it in Visual C++ win32 application. and use SDL library, its not working, Can you tell me whats wrong with that..? This is the error when im compiling it : c:\program files\microsoft visual studio\vc98\include\winuser.h(39) : error C2146: syntax error : missing ';' before identifier 'HDWP' c:\program files\microsoft visual studio\vc98\include\winuser.h(39) : fatal error C1004: unexpected end of file found Error executing cl.exe.