x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

H/PC Pro animation and graphics in basic

carld Page Icon Posted 2006-09-04 12:43 PM
#
Avatar image of carld
Factorite (Senior)

Posts:
81
Status:
I posted this at the NSBasic forum without a lot of replies. I was wondering if more experienced programmers here had any thoughts.


I've been experimenting recently with graphics under NSbasic 6.5.3b on my older model H/PC (a MobilePro 780) and was wondering if anyone had any suggestions for improvement or some other technique I haven't seen yet. I can't use AspriteCE and my system dosent support GAPI.

Background: I'm working on a small Single-player RPG similar to the old Ultima series. I have a rough but working map editor and some basic animation done, and will be working on a sprite editor soon. Something like the link below is what I'm eventually aiming for.

http://www.consoleclassix.com/gameinfo_ultimaexodus_nes.html

I originally intended to use the BitBlt API function for all graphics, it's fast and does exactly what I need and I even worked out a method of triple buffering to reduce flicker on redraws. Everything works fine until you tap on the screen. This pulls the picturebox.picture to the front which, since I'm going through the Picture Box's hDC instead of .picture property, results in a grey box in place of the graphics. Even trapping everything I can think of and re-bliting the image results in an annoying flicker, just what I'm trying to avoid. Also you can't save a bitblt'd image to a file as SaveImageToFile saves out an empty .bmp.

Under VB (not eVB that I know of) you can avoid these problems with Bitblt by using the picturebox.picture=picturebox.image command but neither the NSBasic picturebox nor MS's picturebox support the image property. I also tried Bitblting directly to the Output window bypassing pictureboxes entirely but it behaves the same.

So I decided to use the normal picturebox functions. This works well enough but is slow.

At the moment I have a background picturebox off-screen that gets copied through the hbitmap property to a compositing picturebox where I perform any updates to sprite locations, then the whole thing gets copied to the user's display. It works in effect like the triple-buffered system I was using for Bitblit but is several times slower.

A wrapper of some sort around Bitblt that ties it into the regular system of controls and properties would be ideal. I realize that's not a trivial task.

So if anyone has any suggestions on speeding things up, or getting BitBlt to work or even how to completely trap screen tap events, I'd appreciate hearing them. I may try resaving all the graphics as 256 color bitmaps and see if that's a worthwile tradeoff.

I attached a current screenshot of the map editor, still needs lots of work.

Thanks, Carl.

 Top of the page
ShadowMaster Page Icon Posted 2006-09-06 12:52 PM
#
Avatar image of ShadowMaster
H/PC Philosopher

Posts:
297
Location:
Chile
Status:
have you tried drawing with bitblt directly onto the window's hdc instead of a picturebox? It should work..
WINAPI function GetDC() is what you need to retrieve the hdc of the window (assuming that nsbasic have that function or can import dll functions)
 Top of the page
torch Page Icon Posted 2006-09-06 8:57 PM
#
Avatar image of torch
Subscribers
H/PC Guru

Posts:
5,762
Location:
United StatesĀ 
Status:
Hey, I like your idea .. I for one would play the game when it's finished.. Also, if this is too hard to ask, but possibly Windows CE 2.00 support for the game?
 Top of the page
carld Page Icon Posted 2006-09-07 9:06 AM
#
Avatar image of carld
Factorite (Senior)

Posts:
81
Status:
Quote
ShadowMaster - 2006-09-06 12:52 PM

have you tried drawing with bitblt directly onto the window's hdc instead of a picturebox? It should work..
WINAPI function GetDC() is what you need to retrieve the hdc of the window (assuming that nsbasic have that function or can import dll functions)



Yes, tried that. drawing directly to the output window through it's hDC via GetDC(), just as you say. Ufortunately, the same thing happens when you tap on the screen, the image gets replaced by a grey box. It's too bad really, for what I'm doing Bitblt is so much faster.
 Top of the page
carld Page Icon Posted 2006-09-07 9:08 AM
#
Avatar image of carld
Factorite (Senior)

Posts:
81
Status:
Quote
tenjeangosi - 2006-09-06 8:57 PM

Hey, I like your idea .. I for one would play the game when it's finished.. Also, if this is too hard to ask, but possibly Windows CE 2.00 support for the game?


I'm at the mercy of NS Basic corp, what ever runtime they put out is what I can work with. Is CE 2.00 an H/PC or an H/PC pro? I think this requires the H/PC Pro runtime to work, sorry.
 Top of the page
ShadowMaster Page Icon Posted 2006-09-07 11:42 AM
#
Avatar image of ShadowMaster
H/PC Philosopher

Posts:
297
Location:
Chile
Status:
can't u redefine the message handler procedure for WM_PAINT? (I don't know how far do NSBasic capabilities go)
 Top of the page
torch Page Icon Posted 2006-09-07 4:43 PM
#
Avatar image of torch
Subscribers
H/PC Guru

Posts:
5,762
Location:
United StatesĀ 
Status:
Quote
carld - 2006-09-07 7:08 AM
I'm at the mercy of NS Basic corp, what ever runtime they put out is what I can work with. Is CE 2.00 an H/PC or an H/PC pro? I think this requires the H/PC Pro runtime to work, sorry.

CE 2.00 is HPC 2.0, CE 2.11 is HPC 3.0 Pro, etc... And I plan to get an HPC2000 device soon, so CE 2.00 support is not a priority for me ....
 Top of the page
carld Page Icon Posted 2006-09-07 8:17 PM
#
Avatar image of carld
Factorite (Senior)

Posts:
81
Status:
Quote
ShadowMaster - 2006-09-07 11:42 AM

can't u redefine the message handler procedure for WM_PAINT? (I don't know how far do NSBasic capabilities go)


Possibly, but while I understand what you mean I have no idea how to implement that in NSBasic, it's probably over my head.
 Top of the page
Jump to forum:
Seconds to generate: 0.158 - Cached queries : 64 - Executed queries : 10