   Horizontal screen wipe problem
  Hey guys,I am trying to get a horizontal screen wipe to work going from right to left, using my textured sprite. I've checked the values in the rect I create numerous times, and I can't see why it's going left to right instead of right to left. Any help would be greatly appreciated. Here is my short render function. The d3d object, sprites, and textures are pre-defined. "g_xOffset  = g_xOffSpeed" should be "g_xOffset += g_xOffSpeed". The preview just isn't showing it correctly. g_xOffSpee = 3.void Render(){// 1. clear the back bufferHRESULT hr=gD3dDevice->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1.0f,0);// 2. begin the scenehr=gD3dDevice->BeginScene();if (SUCCEEDED(hr)){//RECT r;RECT r2; //r.top = 0;//r.bottom = gTextureHeight;r2.top = 0;r2.bottom = gTextureHeight;D3DXVECTOR3 pos(0,0,0);//pos.x = (float)g_xOffSpeed;/*////////// SPRITE 1 ////////////////////gSprite1->Begin(0);r.right = gTextureWidth - g_xOffset;r.left =0;gSprite1->Draw(gTexture1, &r, NULL, &pos, 0xFFFFFFFF);// DonegSprite1->End();*/  ////////////// END SPRITE 1 ///////////////   ////////////// SPRITE 2 //////////////////gSprite2->Begin(0);// Right side of rect = right side of screenr2.right = gTextureWidth;// Left side of rect decreases from right side of screen to 0r2.left = gTextureWidth - g_xOffset;gSprite2->Draw(gTexture1, &r2, NULL, &pos, 0xFFFFFFFF);gSprite2->End();/////////////// END SPRITE 2 /////////////gD3dDevice->EndScene();gD3dDevice->Present(NULL,NULL,NULL,NULL);}// Increment our offset and loop if requiredg_xOffset += g_xOffSpeed;if (g_xOffset>gTextureWidth)g_xOffSpeed=0;}
  r2 you are using to set the rectangle area is the source rectangle not the destination rectangle is that correct? Is the texture the render target surface that your are using sprite to draw or is it a blank texture that you are moving over the top to do a wipe?;  r2 is the source rect. I am using a sprite with a texture attached to it. The reason I'm doing this is because in my game, I want to have smooth scrolling between areas, but my bitmaps would be way too big to load into memory at once. Each level in my game will have 5 areas. The game is a light gun shooter, so the player won't be transitioning to the next area until the beat the current one. What I'm ultimately trying to do is move Area 1's texture to the left at the exact same time as I move Area 2's texture to the left. Thus, I can create smooth scrolling with multiple bitmap files. The problem is that the Area 2 texture is moving from left to right where Area 1 should be being drawn.---------|--------|--------|--------|--------||--------|--------|--------|--------|--------||--------|--------|--------|--------|--------||--------|--------|--------|--------|--------|| Area 1-| Area 2-| Area 3-| Area 4-| Area 5-||--------|--------|--------|--------|--------||--------|--------|--------|--------|--------|;  you could keep the source rectangle as the entire texture and then just move the position of the sprite left. When it has completely gone off screen reset it at the other side of the screen with the next texture. Just switching between 2 sprites. 