🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11989

Re: Lots of data

#11989
From: Ed Mulroy [TeamB]
Date: Fri, 02 Jan 2004 23:18
118 lines
5687 bytes
You should BitBlt the individual element bitmap to the memory bitmap using
the upper left corner coordinates where you want to locate it on the screen.
If you write each to 0,0 then each one will overwrite where the other was
located.

Something which bothers me is your use of anisotropic mode.  I have been
coding for Windows since the 80's and maybe 10 times coworkers have used
anisotropic and EVERY TIME they had trouble.  All that mapping mode does is
tell Windows what kind of scaling and translation you want to use.  The same
kind of stuff you would do is what Windows quietly does when you write to
the screen but you can debug it if you are doing it and can't easily debug
it when Windows does it.

This is what I told every one of them (and all of them did what I said and
got it working):

You are debugging several things at once.  Therefore the symptoms are mixed
and it is difficult to separate out which thing causes what problem.

Cut back the number of variables
  Get rid of anisotropic and stay in MM_TEXT (the default).
  Get rid of most of the things you are showing on the screen
     cutting back to maybe three items.

Only when you get that working consider adding more things.

Only after you have added the additional things (sprites, bitmaps, whatever)
consider anisotropic.

If you then decide you want anisotropic, cut back to two or three things so
that debugging is easier as you get the mapping mode going.  You can then
add them back when it works.

.  Ed

> M. Finch wrote in message
> news:3ff5e797$1@newsgroups.borland.com...
>
> ok, without getting into where its put just yet (right now I have it in my
> paint code)....AND....sorry to belabor this in case I'm boring anyone...
>
> Problem:
>     I get one of the aircraft bitmap on the screen at 0,0.....  I assume
> that all 160 of them are being displayed at 0,0 on-top of each other.
>
> What I'm doing:
>     I have a screen DC
>     Create a background DC - make it the same size as screen DC
>     Create an airplane DC - make it the same size as the airplane bitmap
>     160+ times
>              Blit the airplane onto the background
>     Blit the background onto the screen.
>
> I perform the following
>         hbm = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1));
>
> //create an off screen memory area for the main screen
>         hdcMem = CreateCompatibleDC(hDC);
> //create a compatible bitmap the size of the screen HDC
>         hbmMem = CreateCompatibleBitmap(hdcMem, width, height);
> //create a memory for the aircraft bitmap
>         hdcbm = CreateCompatibleDC(NULL);
> //setup a buffer area for the plane bitmap so we can find its size
>         GetObject(hbm,sizeof(bm),&bm);
> //size the DC to the size of the plane bitmap
>         hbmPlane = CreateCompatibleBitmap(hdcbm,bm.bmWidth,bm.bmHeight);
> //Select the compatible Bitmap into background memory
>         hbmT = SelectObject(hdcMem,hbmMem);
> //Select the airplane Bitmap into airplane memory
>         hbmB = SelectObject(hdcbm,hbm);
>
>
> That being done, now I go through my list...
>  now = head
>  while now != NULL
>
> BitBlt(hdcMem,tempLonLat.x,tempLonLat.y,bm.bmWidth,
>          bm.bmHeight,hdcbm,0,0,SRCCOPY);
>                  // VERY confused here.  see below
>  now = next
>
> Now blit it onto screen
>
>
BitBlt(hDC,0,0,rect.right-rect.left,rect.bottom-rect.top,hdcMem,0,0,SRCCOPY)
>
> end pseudocode
>
>
> QUESTION...
>   I'm REALLY confused about where the destination of the blit is to be on
> the screen back-buffer.  I have my map mode set as follows:
>           SetMapMode(hDC,MM_ANISOTROPIC);
>           SetWindowExtEx(hDC, xwin,ywin,NULL);
> //xwin is 360000    ywin is 180000
>           SetViewportExtEx(hDC,width,-height,NULL);
> //width and height are the client window size
>
> So in my blit to the back buffer above, I've taken the lon/lat of the
> aircraft and convert to device coords, using LPtoDP...THEN use that as the
> destination of the blit.
> I originally used the Logical coordinates (actual lon/lat [*1000]) and
that
> didn't seem to work either.
>
> So I have made the CreateCompatibleDC for the screen in device
coordinates.
> I tried making it logical coordinates and get an error creating the
> CreateCompatibleBitmap.
>
> OR...
> should I create the compatibleDC for the off screen, then set the map mode
> and
> SetWindowExtEx and SetViewportEx for the off screen DC also?
>
> Whew!!!  I think I've gone off the deep end with this....
>
> Any further help would sure be appreciated....
Technical Details
Message-ID: <3ff5fc53@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3ff41d43$1@newsgroups.borland.com> <3ff421ca$1@newsgroups.borland.com> <3ff44fe4$1@newsgroups.borland.com> <3ff458ce@newsgroups.borland.com> <3ff5e797$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,894ad098f15950e6
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-02 15:39:42 PST
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ff41d43$1@newsgroups.borland.com> <3ff421ca$1@newsgroups.borland.com> <3ff44fe4$1@newsgroups.borland.com> <3ff458ce@newsgroups.borland.com> <3ff5e797$1@newsgroups.borland.com>
Subject: Re: Lots of data
Date: Fri, 2 Jan 2004 18:18:37 -0500
Lines: 120
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 24.74.175.102
Message-ID: <3ff5fc53@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1073085523 24.74.175.102 (2 Jan 2004 15:18:43 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail