Path: chuka.playstation.co.uk!news From: "Richard Maddocks" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Background Images Date: 22 Mar 1997 02:43:13 GMT Organization: The World's Fair Ltd Lines: 93 Message-ID: <01bc366a$dde16220$5b18989e@civy> References: <3332DF3B.14F5@innotts.co.uk> NNTP-Posting-Host: civy.demon.co.uk X-Newsreader: Microsoft Internet News 4.70.1155 Richard Haskey wrote in article <3332DF3B.14F5@innotts.co.uk>... > Hi, > > > > Does anyone know where I can get source for displaying a > > background image (GsBG definition)? > > > > I have tried all day to display a repeated texture cell > > but have been so far been unsuccessful. > > > > Also, is it possible to rotate the background image using > > hardware - There is a rotate field within the GsBG structure > > but the comments describing the function GsSortFixBg16 > > (which I am trying to use to display the image) say :- > > "BG rotation/scaling/reduction not possible" Just had a look at it as well I've sort of got it to work ish. It's all hardwired and only uses one cell but here goes. Hope it helps Richard unsigned long m_work[(((320/16+1)*(240/16 +1+1)*6+4)*2+2)]; GsCELL m_cell[2]; unsigned short m_index[400]; GsMAP m_map; GsBG m_bg; //Put before main game loop MWbload("tile.tim",(void *)TIM_ADDRESS); //CodeWarrior Only I think LoadTimFile (TIM_ADDRESS); //Get from TimView in demo area initBG(TIM_ADDRESS); GsInitFixBg16( &m_bg,&m_work[0] ); //Put in main game loop GsSortFixBg16(&m_bg,m_work,&WorldOT[activeBuffer], 0); void initBG(u_long mainMemoryAddress) { GsIMAGE timImage; // structure holding info on TIM file int i; GsGetTimInfo( (u_long *)(mainMemoryAddress+4), &timImage); m_cell[0].u=(timImage.px % 64)*2; //For 8 bit clut m_cell[0].v=timImage.py % 256; m_cell[0].cba=(timImage.cx/16) | (timImage.cy << 6); m_cell[0].flag=0; m_cell[0].tpage=GetTPage(1, 0, timImage.px, timImage.py); for (i=0;i<400;i++) { m_index[i]=0; } m_map.cellw=16;//timImage.pw *2; m_map.cellh=16;//timImage.ph; m_map.ncellw=20; m_map.ncellh=20; m_map.base=&m_cell[0]; m_map.index = &m_index[0]; m_bg.x=0; m_bg.y=0; m_bg.w=320; //N/A:( m_bg.h=240; //N/A:( m_bg.scrollx=0; m_bg.scrolly=0; m_bg.r=m_bg.g=m_bg.b=128; m_bg.map=&m_map; m_bg.mx=0; //N/A :( m_bg.my=0; //N/A :( m_bg.scalex=4096*2; //N/A :( m_bg.scaley=4096*2; //N/A :( m_bg.rotate=0; //N/A :( m_bg.attribute=0x41000000; }