• 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.

ferceg

my own mouse cursor

7 posts in this topic

Hello ! I''d like to apologize for my bad English first (I''m from Hungary). I''m totally new to DX, so don''t laugh at me if I ask stupid questions... So.. I tried to write my very first DX program: I have a fixed background, and a transparent mouse cursor moves on it. I created the primary surface with 1 backbuffer, and I also have an offscreen buffer to store the background picture in it. (This is larger than the primary srf, because I store the mouse cursor with colorkey in this surface, too). I didn''t manage to avoid having to blt the full bgpic to the backbuffer then blt the cursor using colorkey to the current mouse position (and then I flip, of course). If I tried to do a restore-bg-save-bg-put-cursor thing, the entire screen was flashing as I moved the mouse. Could anyone explain me, how the flipping exactly works ? I started to experiment: I did: -init DDraw -load a bmp to an offscr. srf. -blt to primary -blt to back -and just flip on mousemove the result: flashing screen. (one of them contains the correct bgpic, the other''s some horrible purple colored...) why ?????????? thanks, Hajdu Ferenc
0

Share this post


Link to post
Share on other sites
i''m also new in DX, (anyone) correct me if i''m wrong.

the primary-surface is what the screen is showing.
the back-surface is what working behind the scene.
i seldom see any blt occur in primary-surf (izzit?), most are done in back-surf.
so, after all blt are done on the back-surf, do a flip.
a flip will switches the primary&back surfaces, making your back-surf becoming primary & vice versa (again, izzit?)... resulting the screen showing what u want to show.
this operation is called double-buffering. normally used in game & is one of the known methods to reduce sprites (not screen) flickering.

my suggestion is that try to blit everything to the back surface, and then do a flip. Something like:
- init DD
- load bitmap to offscreen-surf
- blit background to back-surf
- blit mouse cursor to back-surf
- flip

BTW, what u blt to the primary-srf?
0

Share this post


Link to post
Share on other sites
Well DerekSaw, you seem to be pretty much on track, but you left out when to flip. A monitor draws an image from left to right and top to down. When the beam reaches the bottom right, it has to move back up to the top left. This is called the vertical retrace. When you are performing page flipping, flip the pages during the vertical retrace so you don't see it while drawing (this may be your problem ferceg). Here's some code in DX7 that will wait until the retrace and flip.

// Flip Our Surfaces
while (FAILED(g_lpDDS7_Front->Flip(NULL, DDFLIP_WAIT)));

Also ferceg, you may try moving your mouse cursor to irs own surface. That should help simplify your code.

Edited by - I-Shaolin on 1/18/00 8:08:18 AM
0

Share this post


Link to post
Share on other sites
Thx for the answers.
I understand that I shouldn''t blt to the primary surface.
But if I blt the bgpic to the backbuffer and then the mouse cursor onto it and then I flip, I will have an empty backbuffer and I have to blt the whole bgpic again.
And this is what I''d like to avoid.
(just restore-save-putmousecursor on mousemove)

Another problem:

why doesn''t this code work ?

ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwFlags = DDSD_CAPS / DDSD_HEIGHT / DDSD_WIDTH;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwWidth=100;
ddsd.dwHeight=100;

ddrval=lpDD->CreateSurface(&ddsd,&lpDDSBG,NULL);

I always get a DDERR_INVALIDPARAMS...

thx again,

ferceg
0

Share this post


Link to post
Share on other sites
You forgot

ddsd.dwSize = sizeof (ddsd);


You could create another surface for backuping the stuff behind your mouse cursor. I've never tested it, but I think it will work.

Cya

Edited by - Melo on 1/21/00 6:22:13 AM
0

Share this post


Link to post
Share on other sites
Yes, that was it... thanx.

Another question:
I load a truecolor bmp with DDLoadBitmap (ddutil.cpp) (my primary surface is in 16 bit)
Is the offscreen surface in 32 bit and will the blt do the conversion ? (Or is it already 16-bit ?)

ferceg
0

Share this post


Link to post
Share on other sites
all your offscreen/video memory surfaces will be in the same colordepth as your primary surface. so yes, its already in 16-bit mode (DDLoadBitmap will take care of the conversion between 32 and 16-bits).

Edited by - Staffan on 1/22/00 6:22:51 PM
0

Share this post


Link to post
Share on other sites
But if you create surfaces with several pixel formats, the Blt/BltFast functions do not convert ''em.
0

Share this post


Link to post
Share on other sites