I have a "radar" kinda thing in my game which draws pixels supposidly inside the radar (or white rectangle). Thing is my brains gone totally dead and how ever hard I think the answer just wont come. I'm kinda stuck in a loop or certain think pattern or w.e its called, and I know it dont work but i cant break it 
Anyway, I think you can better see wat i mean if i show you.
http://www.allegro.cc/files/attachment/589876
http://www.allegro.cc/files/attachment/589877
Heres the code Im using to draw it:
| 1 | // DRAW RADAR |
| 2 | void GameEngine::DrawRadar() |
| 3 | { |
| 4 | rectfill(m_pBuffer, 10, 300, 110, 419, makecol( 255, 255, 255)); |
| 5 | |
| 6 | // Draw Enemies onto radar |
| 7 | m_pCurr = m_pHead; |
| 8 | while (m_pCurr->GetNext()!=0) |
| 9 | { |
| 10 | if (m_pCurr != m_pHead && m_pCurr != m_pTail) |
| 11 | { |
| 12 | int x = (m_pCurr->GetX()/4)-19; |
| 13 | int y = (m_pCurr->GetY()/4)+300; |
| 14 | int w = (m_pCurr->GetWidth()/4); |
| 15 | int h = (m_pCurr->GetHeight()/4); |
| 16 | |
| 17 | for (int j = 0; j < h; j++) |
| 18 | for (int i = 0; i < w; i++) |
| 19 | { |
| 20 | if (y < 419 && y+h > 300) |
| 21 | { |
| 22 | if (m_pCurr->GetType()==1) putpixel(m_pBuffer, (x+i),y+j, makecol(255, 128, 64)); // Scout |
| 23 | if (m_pCurr->GetType()==2) putpixel(m_pBuffer, (x+i),y+j, makecol(0, 174, 0)); // Fighter |
| 24 | if (m_pCurr->GetType()==3) putpixel(m_pBuffer, (x+i),y+j, makecol(0, 128, 192)); // Bomber |
| 25 | if (m_pCurr->GetType()==4) putpixel(m_pBuffer, (x+i),y+j, makecol(236, 236, 0)); // Cannon Carrier |
| 26 | if (m_pCurr->GetType()==5) putpixel(m_pBuffer, (x+i),y+j, makecol(200, 0, 0)); // Swarmer |
| 27 | if (m_pCurr->GetType()==6) putpixel(m_pBuffer, (x+i),y+j, makecol(191, 96, 0)); // Sentry Turret |
| 28 | if (m_pCurr->GetType()==7) putpixel(m_pBuffer, (x+i),y+j, makecol(192, 192, 192)); // Gunship |
| 29 | if (m_pCurr->GetType()==8) putpixel(m_pBuffer, (x+i),y+j, makecol(0, 255, 255)); // Heavy Gunner |
| 30 | if (m_pCurr->GetType()==9) putpixel(m_pBuffer, (x+i),y+j, makecol(255, 128, 128)); // Spread |
| 31 | if (m_pCurr->GetType()>=100) putpixel(m_pBuffer, (x+i),y+j, makecol(128, 128, 128)); // Other |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | m_pCurr = m_pCurr->GetNext(); |
| 36 | } |
| 37 | |
| 38 | // Draw player on radar |
| 39 | int x = (m_pPlayer->GetX()/4)-19; |
| 40 | int y = (m_pPlayer->GetY()/4)+300; |
| 41 | int w = (m_pPlayer->GetWidth()/4); |
| 42 | int h = (m_pPlayer->GetHeight()/4); |
| 43 | |
| 44 | for (int j = 0; j < h; j++) |
| 45 | { |
| 46 | putpixel(m_pBuffer, x,(y+j), makecol( 0,0,255)); |
| 47 | for (int i = 0; i < w; i++) |
| 48 | putpixel(m_pBuffer, (x+i),y+j, makecol( 0,0,255)); |
| 49 | } |
| 50 | |
| 51 | } |
So how do I make it only draw inside the radar area?
Please help its doin my head in 
Cheers,
To get those thumbnail thingies, use the img tag. You can read more about it by clicking the HTML Mockup Code link when you post. Also, if you use MS Paint you can save in png (which is better for screenshots than jpeg) or jpeg without using the trial version of a program. 
That aside, I don't see what your problem is...
OK thanks, and Win98 Paint says only Bmp 
And... My problem is I dont want anything drawn otuside the radar, the stuff thats outside the radar is off the screen. I want it to scroll into the radar and out of it.
>.<
Ah I forgot the only added that support in XP (or was it 2k?).
As far as your problem, you could add a check that only draws the dots that are inside the radar... something like if(x > left side && x < right side && y > top && y < bottom) draw else ignore.
what I am getting is this
crappy screen ASCII sorry
------------------------------------ | | | |<-Screen | | | ^ | | | | | | | | |-------| | | . |<-Radar | ^ | . | ------------------------------------
KEY ^ = ship
RADAR KEY . = Ship on radar 
pick the location of the ship on the screen.
Lets say for the given you are using 1024x768
now lets say you have a small radar well
SCREEN_W = 1024
SCREEN_H = 768
RADAR_W = SCREEN_W / 10 //or 102
RADAE_H = SCREEN_H / 10 //or 76
Lets say a ship is at 850x680 as showen by the ship at the very bottom or the 'screen'
well on the radar you would want a dot or what ever at 85x68
place the radar screen where ever.
just an idea
I added
if (x > 10 && x < 110 && y > 300 && y < 419)
to the respected line, but I knew that wouldnt work since i tried it before
. Sorry I didn't explain my problem more precisely.
The above code works fine for small enemies, say, 24x24 pixels. But my "starship" (atm the big grey rectangle) is 800x100 pix.
So it wont get drawn into the radar until its x,y meets the requirements stated above, even though like half of the image has already been on screen! I want the pixels to scroll onto the radar not just all appear 
I think that clears any confusion up.
Then you will have to take image width/height into account for the size of your square on the radar.
psuedo code:
radar_box_w = enemy_bitmap.width / radar_width radar_box_h = enemy_bitmap.height / radar_height // Then you have to check if it is on the screen at all if(enemy.x + enemy_bitmap.width > 0 && < screen width && same with y/height) if(enemy.x < 0) radar_box_w = enemy_bitmap.width - abs(enemy.x); // do the same with y / height /* then draw your rect with width/height of radar_box_w x radar_box_h. This may be all wrong or not what you're asking for, not sure. */
I don't understand what exactly your refering to when you say 'radar_box_w' and h.
And whats that abs do? I clicked on it and it sais it returns an absolute value. Whats that mean? no decimal?
radar_box_w and h are the width and height of the rect you draw on the radar.
abs returns the absolute value of a number. It makes negative numbers positive and keeps positive numbers positive.
Thanks BAF. I can't actually get to coding atm but I finally got round what your trying to say about the radar box thingie and am sure I can work it out when I get home. 
Cheers,