• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

CJ

Scrollbars

5 posts in this topic

Few questions:

Did you derive your view from CScrollView? (probably a dumb question but I've come to the point at which I no longer assume anything)

Have you stepped through and checked to make sure that the image size settings you passed in are correct?

How does it respond to an attempt to resize?

What method did you use to put the image into the view?

Did you do anything to your CDC (default variable name is pDC) prior to/ during the OnDraw function that might cause your viewing rect to display improperly, such as override OnPrepareDC without passing it through the CScrollView version of OnPrepareDC?

-fel

0

Share this post


Link to post
Share on other sites
1) Yes it is derived from CScrollView.

2) My OnDraw function looks like:

void CPictureShopView::OnDraw(CDC* pDC)
{
CPictureShopDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);

// TODO: add draw code for native data here
int ht;
int wh;

ht = pDoc->bmi.bmiHeader.biHeight;

wh = pDoc->bmi.bmiHeader.biWidth;
bmi = pDoc->bmi;
int bitcnt = (int)bmi.bmiHeader.biBitCount;
HDC hdc = ::GetDC(m_hWnd);

SetDIBitsToDevice(hdc,0,0,(DWORD)wh,(DWORD)ht,0,0,0, (WORD)ht,pDoc->bits,(LPBITMAPINFO)&bmi,DIB_RGB_COLORS);

}


Even when I don't pass the imageheight and imagewidth, i.e. Just pass 500 x 500....

By resizing the thing, it resizes normally...

Is there any function I have to use to have it scroll?


------------------
Dance with me......

0

Share this post


Link to post
Share on other sites
Generally, no. The point of using CScrollView is to automatically enable scrolling. The thing is, though, that you took over where the program is generally supposed to draw the change in your visible rects (the OnDraw function)

You can attempt to solve this by calling
CScrollView::OnDraw() after your drawing calls. I'm not going to guarantee this is going to work, mostly because generally I avoid using a CScrollView and do the scroll logic myself (I have some really spiffy custom scroll bars I wrote that I prefer to use anyway), so I haven't tried this. For that matter, the way you set your bits there's a really good chance it won't... you might want to attempt to grab the proper (x,y) position that the scrollbar is throwing to you and use it for your source rect settings... with (0,0) it's not surprising it's stuck. Alternatively messing with your dest rect settings might work because MFC generally does clipping for you (woohoo!) Width and Height should just be the real width and height, they have nothing to do with your view rect really. The destination logic is probably easier, try using negative dest values and see what happens first, provided the OnDraw call doesn't work.
If that call to OnDraw and the extra logic for your rects does not work, then you're going to have to override the OnVScroll and OnHScroll functions yourself (don't forget to put in the proper message handlers up top) Also note that if you're going to do overrides on those there's really no point in deriving from CScrollView, you might just want to derive from CView and get it over with.

As for any extra functions? Nope, that should work if you can resolve your CDC issues.

-fel

~(To a coworker) "I said there's nothing you can't do in MFC. I did not say it would be easy."~

0

Share this post


Link to post
Share on other sites
Sorry, ain't working *pouts*

Could you, maybe please etc etc explain how to make your own scrollbars??

------------------
Dance with me......

0

Share this post


Link to post
Share on other sites
Hi, I've got a problem with implementing scrollbars into my Multiple Document MFC program. I need the scrollbar in the child frame. That's where i get it after having changed the CView into CScrollView and using SetScrollSize int he following manner

SetScrollSizes(MM_TEXT, CSize(ImageWidth,ImageHeight));

My Draw function shows an image into the document.

I tried different ways of getting it moving, but none is working. The scrollbar keeps at the same place and only the left top of the image is shown.

If anyone of you knows how to do ths, I would appreciate it, thank you.

------------------
Dance with me......

0

Share this post


Link to post
Share on other sites
You probably don't want to make your own scrollbars. I do it because I want them to do super spiffy stuff like internal resizing of the view.

You need to override OnHScroll and OnVScroll and define your viewing rects in that way. If you want I could take a look at it when I get home, icq or e-mail me if so (icq is preferable). You could also go take a look at www.codeguru.com to find instructions on using scroll bar overrides.

-fel

0

Share this post


Link to post
Share on other sites