Advertisement

game intro screens

Started by April 28, 2002 05:34 AM
2 comments, last by edwinnie 22 years, 7 months ago
ok, i finishing the tetris soon, if not for this old problem. from TOTWGPG, there is this Copy_Screen() which is used in the intro for its outpost demo. but as usual,its for 8bit, and there are no updates for a 24bit one. but this function really is similar to the Draw_Bitmap(). there is a Draw_Bitmap16() for 24bit bitmaps. currently, i thought of 3 possible solutions, but dunno how to implement them. 1) using create_bitmap then load_image_bitmap16 in game_init() 2) using draw_bitmap16 in game_init() 3) update the Copy_Screen() to 24bit i would be most appreciated if u had created game intro screens using any of the above solutions, pls teach mi. i seem to be missing something but dunno wat. thx!
Why not have a look at how these functions work and write your own one to do what you want?

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Advertisement
well, i thought of that.
i tried to modify the Copy_Screen() to 24bit but it turned out
to be similar to the Draw_Bitmap16(), which it didnt work.

this is wat i did(in GAME_INIT),

  void Do_Intro(void){// the worlds simplest intro// clear out buffersDDraw_Fill_Surface(lpddsback, 0);DDraw_Fill_Surface(lpddsprimary, 0);// draw in logo screenLoad_Bitmap_File(&bitmap24bit, "elven.bmp");// copy the bitmap to primary bufferDDraw_Lock_Primary_Surface();Draw_Bitmap16(&elven,primary_buffer, primary_lpitch, 0);DDraw_Unlock_Primary_Surface();// unload bitmap fileUnload_Bitmap_File(&bitmap24bit);Sleep(3000);// transition to black//Screen_Transitions(SCREEN_DARKNESS,NULL,0);// clear out buffersDDraw_Fill_Surface(lpddsback, 0);DDraw_Fill_Surface(lpddsprimary, 0);//game title----------------------------------------------------------Load_Bitmap_File(&bitmap24bit, "etris.bmp");// copy the bitmap to primary bufferDDraw_Lock_Primary_Surface();Draw_Bitmap16(&etris,primary_buffer, primary_lpitch, 0);DDraw_Unlock_Primary_Surface();// unload bitmap fileUnload_Bitmap_File(&bitmap24bit);Sleep(3000);// transition to black//Screen_Transitions(SCREEN_DARKNESS,NULL,0);// clear out buffersDDraw_Fill_Surface(lpddsback, 0);DDraw_Fill_Surface(lpddsprimary, 0);    } // end Do_Intro  



i was wondering, if copy_screen() is similar to draw_bitmap16()
then why dun i just use draw_bitmap16(),
which i did, as above, din work!

i oso wonder if there is a problem,
if its done in the primary buffer, in game_init.
this is the draw_bitmap16()

  int Draw_Bitmap16(BITMAP_IMAGE_PTR source_bitmap,UCHAR *dest_buffer, int lpitch, int transparent){// this function draws the bitmap onto the destination memory surface// if transparent is 1 then color 0 (8bit) or 0.0.0 (16bit) will be transparent// note this function does NOT clip, so be carefull!!!// test if this bitmap is loadedif (!(source_bitmap->attr & BITMAP_ATTR_LOADED))   return(0);   USHORT *dest_addr,   // starting address of bitmap in destination          *source_addr; // starting adddress of bitmap data in source   USHORT pixel;        // used to hold pixel value   int index,           // looping vars       pixel_x,       lpitch_2 = lpitch >> 1; // lpitch in USHORT terms   // compute starting destination address   dest_addr = ((USHORT *)dest_buffer) + source_bitmap->y*lpitch_2 + source_bitmap->x;   // compute the starting source address   source_addr = (USHORT *)source_bitmap->buffer;   // is this bitmap transparent   if (transparent)   {   // copy each line of bitmap into destination with transparency   for (index=0; index<source_bitmap->height; index++)       {       // copy the memory       for (pixel_x=0; pixel_x<source_bitmap->width; pixel_x++)           {           if ((pixel = source_addr[pixel_x])!=0)               dest_addr[pixel_x] = pixel;           } // end if       // advance all the pointers       dest_addr   += lpitch_2;       source_addr += source_bitmap->width;       } // end for index   } // end if   else      {      // non-transparent version      // copy each line of bitmap into destination      int source_bytes_per_line = source_bitmap->width*2;      for (index=0; index < source_bitmap->height; index++)          {          // copy the memory          memcpy(dest_addr, source_addr, source_bytes_per_line);          // advance all the pointers          dest_addr   += lpitch_2;          source_addr += source_bitmap->width;          } // end for index      } // end else   // return success   return(1);} // end Draw_Bitmap16  

This topic is closed to new replies.

Advertisement