Cursor Without Refreshing the screen

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
elevationsnow
Posts: 22
Joined: Sat Sep 10, 2005 6:45 am

Cursor Without Refreshing the screen

Post by elevationsnow »

im developing a programing called crazypaint and i need a cursor so you can see where you are when your not drawing. right now i tryed making a cursor with the blit code from shines pg.h and you have to refresh the screen so the cursor doesnt duplicate its self. which causes my picture to be erased before it can even draw 2 pixels. so... is there any way arround this drawing a cursor with out refreshing maybe some form of layers etc. this would be very helpful

thanks in advance
CyberBill
Posts: 86
Joined: Tue Jul 26, 2005 3:53 pm
Location: Redmond, WA

Post by CyberBill »

Dont draw directly to the back buffer. Draw to a texture that is blit to the screen, and then the cursor is blit on top of this.
elevationsnow
Posts: 22
Joined: Sat Sep 10, 2005 6:45 am

Post by elevationsnow »

im kinda a newbie how would you do that?
cause right now im ploting pixels directly to the vram and then trying to blit a cursor over it
could you perhaps paste some sample code or atleast how to plot pixels to a texture
CyberBill
Posts: 86
Joined: Tue Jul 26, 2005 3:53 pm
Location: Redmond, WA

Post by CyberBill »

Create a temporary buffer that is 512*4*272 (the absolute biggest back buffer you can have).

Draw directly to it. (access it just like VRAM)

Every frame, copy (memcpy) this buffer to VRAM, and then blit your cursor to VRAM.

Note: This is slow and horrible, but you'll understand it all instead of using magic. :)
Post Reply