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

SDL_jesse

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

100 Neutral

About SDL_jesse

  • Rank
    Newbie
  1. not only size , I have to flip the image also and some other things according to the game logic . Can I use putPiexl() and getPiexl() to do this?
  2. thank you for that , but I should change the size of the image ,so I can't use SDL_BlitSurface() to do this in my game.I have to draw it pixel by pixel. the code above can work with PNG-8 ,but it can't work with PNG-24 or PNG-32
  3. sorry , I am a freshman in SDL ,it does not help,the main code is here,: [color=#0000cd]int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); SDL_Surface *pScreen = ::SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE | SDL_DOUBLEBUF); SDL_Surface *image = IMG_Load("jbutton.png"); SDL_SetAlpha(image, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT); SDL_Surface *screen = SDL_DisplayFormatAlpha(image); for(int i=0;i<image->w;i++) { for(int j=0;j<image->h;j++) { Uint32 color=getPixel(screen,i,j); putPixel(pScreen,i,j,color); } } // SDL_BlitSurface(img, 0, video, 0); //this will be ok SDL_Flip(pScreen); SDL_Delay(5000); SDL_Quit(); return 0; }[/color]
  4. Does any one has ideas about it ? thank you for your reply!
  5. I created a png in photoshop with a transparent background, and when I load up the png it has transparency. But when I load it into my game using SDL_image it appears white where it should be transparent.I am not use SDL_BlitSurface(),I use getPiexl() and putPiexl() instead,here is my code: [color=#0000cd]#include <iostream> #include <string> #include "SDL/SDL_image.h" using namespace std; void putPixel(SDL_Surface *surface, int x, int y, Uint32 pixel) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to set */ Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch(bpp) { case 1: *p = pixel; break; case 2: *(Uint16 *)p = pixel; break; case 3: if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { p[0] = (pixel >> 16) & 0xff; p[1] = (pixel >> 8) & 0xff; p[2] = pixel & 0xff; } else { p[0] = pixel & 0xff; p[1] = (pixel >> 8) & 0xff; p[2] = (pixel >> 16) & 0xff; } break; case 4: *(Uint32 *)p = pixel; break; } } Uint32 getPixel(SDL_Surface *surface, int x, int y) { int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch(bpp) { case 1: return *p; case 2: return *(Uint16 *)p; case 3: if(SDL_BYTEORDER == SDL_BIG_ENDIAN) return p[0] << 16 | p[1] << 8 | p[2]; else return p[0] | p[1] << 8 | p[2] << 16; case 4: return *(Uint32 *)p; default: return 0; /* shouldn't happen, but avoids warnings */ } } int main(int argc, char *argv[]) { SDL_Init(SDL_INIT_VIDEO); SDL_Surface *pScreen = ::SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE | SDL_DOUBLEBUF); SDL_Surface *image = IMG_Load("jbutton.png"); SDL_DisplayFormatAlpha(image); for(int i=0;i<image->w;i++) { for(int j=0;j<image->h;j++) { Uint32 color=getPixel(image,i,j); putPixel(pScreen,i,j,color); } } // SDL_BlitSurface(img, 0, video, 0); //this will be ok SDL_Flip(pScreen); SDL_Delay(5000); SDL_Quit(); return 0; }[/color]