Thread: Scrolling bitmaps and some other things

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    36

    Post Scrolling bitmaps and some other things

    hi there.

    I'm a massive newbie to win32 programming in general but I do see some of the basic concepts of it and how I could apply them to a program I plan to make.

    the program will involve displaying a bitmap of great size (1024x1024 pixels) and applying various things to it. because of its size, I'm definitely going to need scroll bars to view all of the bitmap!

    I want to ask for a possible concept on how I would scroll the bitmap, give it a resizeable viewing area (the amount of the bitmap image veiwable at a time depending on the size of the window itself) and if it would be possible to get the co-ordinates that the mouse cursor will be over with relevance to the top left of the image?

    I also ask if I would be able to say...allocate part of the window to be used for a general 'tools' area (to select various tools and graphics to work with the bitmap) with the bitmap viewing/scrolling area being below it? or would I have to seperate the windows for this?

    I've tried searching but I don't get the answer I'm looking for. There was a topic on how the MSDN reference to scrolling bitmaps was wrong but there was no reply stating a real way to scroll them. Theres also a few unaswered topics on the issue.

    I'm using C by the way.

    Thanks for your time!
    -gerread

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    I've made a few 2D games that scroll, and I usually just achieve scrolling by drawing part of the background.

    At the beginning of the game, the "camera" is at the top-left corner (0,0), so the top-left corner of the bitmap is drawn. If I scroll right by 10px, I draw the bitmap -10px to the left. (Note the minus sign.)

Popular pages Recent additions subscribe to a feed