well then... i figured i had it all set properly, but something fails silently...
i loaded my resource bitmap like this:
vcRsc_reht_tape = oapiCreateSurface(LOADBMP(BMP_RHTTAPE));
the 24-bit bmp i intend to use as an engines-reheat-level gauge tape is loaded as resource and properly assigned the BMP_RHTTAPE identifier...
then, with a little copy-paste job from the delta-glider LOADBMP macro, which i duely modified to suit my code i placed the above line in the clbkLoadVC method... as is the case on the DG samples :hmm:
it compiled just fine, so i figure it's alright to move on to the next step...
so i proceed to call oapiBlt upon clbkVCRedrawEvent... i took care to do so AFTER releasing the sketchpad, as to avoid troubles mentioned in the docs related to this....
this following stretch of code seems adequate... but it just so happens, it ain't...
do notice, the tape-gauge is supposed to be drawn bottom-up as the reheater fires up - the tape reveals itself upwards in proportion to afterburner power
with the first few lines, prior to sketchpad release, i ran a little test-of-logic by drawng a white line where the bitmap tapes should be.... then i reuse the same values to try and blit the things to the target surface
i do it twice for there are two engines in question here... although at the time, the logic driving both is forcibly symmetric, so there's no need to calculate stuff separately for each of the two...
well, the lines appear, as expected, and are properly positioned too...
the bitmaps however, do no such thing...
so i'm led to the obvious conclusion that something is unnacounted for here, and what it could be continues to baffle me...
could i have loaded the bitmap resources "wrong"? what gives?
any help is appreciated... i thank you in advance
---------- Post added 06-14-11 at 10:39 AM ---------- Previous post was 06-13-11 at 12:25 PM ----------
well, new developments ensued...
i have discovered that oapiBlt IS in fact working... well, not they way i wanted it to, but working nonetheless...
i was set about investigating whether i could have it blit from the same surface being redrawn (which luckily has some spare pixel-estate on the bottom) and guess what? - it works
ok, so that narrows it down somewhat... my problem is with the loaded resource bitmap then...
but it remains being a problem, as i had other plans to those extra pixels (i got more screens to draw in that VC)
plus, i don't feel i fixed it unless i learn what i should have done to avoid it altogether (über-geek syndrome :lol
then let us review some code, shall we?
the G42 class contains a SURFHANDLE for the soon-to-be-loaded resource bitmap...
now, M$VC is indeed a piece of evil, so i have yet to ensure i "resourced it" right... :facepalm:
problem could very well be there, i figure... not too sure on how can i tell if that's the case, tho...
let's see, i have:
- drawn a pretty gauge using Flash (which i like to use for drawing, specially GUI stuff)
- converted that into .bmp with Photoshop... maybe if i used Paint.NET... worth checking...
- added that as a "resource" into MSVC... new resource -> import -> choose file -> ok
- altered the resource ID from IDB_BITMAP1 to a more self-explaining BMP_RHTTAPE
- compiled... (i had checked "show progress" in the resource tool options - it output something about a bitmap with 2k-something bytes of size, i was convinced...)
- added "vcRsc_reht_tape = oapiCreateSurface(LOADBMP(BMP_RHTTAPE));" to my clbkLoadVC method (vcRsc_reht_tape is the SURFHANDLE member var i mentioned)
- added the previously-mentioned oapiBlt code to the clbkVCRedrawEvent method AFTER having the sketchpad released
- compile... no velociraptor attack, good...
- tested it in orbiter... hmm, fail....
- investigated possibility of it working by blitting from the same surface... yep! that checks out :hmm:...
- wrote this post in search of a "real" answer to my problem....
- hit "Post Quick Reply"... now we wait...
i loaded my resource bitmap like this:
vcRsc_reht_tape = oapiCreateSurface(LOADBMP(BMP_RHTTAPE));
the 24-bit bmp i intend to use as an engines-reheat-level gauge tape is loaded as resource and properly assigned the BMP_RHTTAPE identifier...
then, with a little copy-paste job from the delta-glider LOADBMP macro, which i duely modified to suit my code i placed the above line in the clbkLoadVC method... as is the case on the DG samples :hmm:
it compiled just fine, so i figure it's alright to move on to the next step...
so i proceed to call oapiBlt upon clbkVCRedrawEvent... i took care to do so AFTER releasing the sketchpad, as to avoid troubles mentioned in the docs related to this....
this following stretch of code seems adequate... but it just so happens, it ain't...
Code:
// (...)
int rhtLvl = GetThrusterLevel(RT66_burner_thgr[0])*86;
sp->SetPen(G422DrawRes.spSet[PEN_WHITE]);
sp->MoveTo(12, 495); sp->LineTo(10, 495-rhtLvl);
sp->MoveTo(88, 495); sp->LineTo(86, 495-rhtLvl);
//
//
oapiReleaseSketchpad(sp);
oapiBlt(surf, vcRsc_reht_tape, 12, 495-rhtLvl, 0, 86-rhtLvl, 10, rhtLvl);
oapiBlt(surf, vcRsc_reht_tape, 88, 495-rhtLvl, 0, 86-rhtLvl, 10, rhtLvl);
do notice, the tape-gauge is supposed to be drawn bottom-up as the reheater fires up - the tape reveals itself upwards in proportion to afterburner power
with the first few lines, prior to sketchpad release, i ran a little test-of-logic by drawng a white line where the bitmap tapes should be.... then i reuse the same values to try and blit the things to the target surface
i do it twice for there are two engines in question here... although at the time, the logic driving both is forcibly symmetric, so there's no need to calculate stuff separately for each of the two...
well, the lines appear, as expected, and are properly positioned too...
the bitmaps however, do no such thing...
so i'm led to the obvious conclusion that something is unnacounted for here, and what it could be continues to baffle me...
could i have loaded the bitmap resources "wrong"? what gives?
any help is appreciated... i thank you in advance
---------- Post added 06-14-11 at 10:39 AM ---------- Previous post was 06-13-11 at 12:25 PM ----------
well, new developments ensued...
i have discovered that oapiBlt IS in fact working... well, not they way i wanted it to, but working nonetheless...
i was set about investigating whether i could have it blit from the same surface being redrawn (which luckily has some spare pixel-estate on the bottom) and guess what? - it works
ok, so that narrows it down somewhat... my problem is with the loaded resource bitmap then...
but it remains being a problem, as i had other plans to those extra pixels (i got more screens to draw in that VC)
plus, i don't feel i fixed it unless i learn what i should have done to avoid it altogether (über-geek syndrome :lol
then let us review some code, shall we?
the G42 class contains a SURFHANDLE for the soon-to-be-loaded resource bitmap...
now, M$VC is indeed a piece of evil, so i have yet to ensure i "resourced it" right... :facepalm:
problem could very well be there, i figure... not too sure on how can i tell if that's the case, tho...
let's see, i have:
- drawn a pretty gauge using Flash (which i like to use for drawing, specially GUI stuff)
- converted that into .bmp with Photoshop... maybe if i used Paint.NET... worth checking...
- added that as a "resource" into MSVC... new resource -> import -> choose file -> ok
- altered the resource ID from IDB_BITMAP1 to a more self-explaining BMP_RHTTAPE
- compiled... (i had checked "show progress" in the resource tool options - it output something about a bitmap with 2k-something bytes of size, i was convinced...)
- added "vcRsc_reht_tape = oapiCreateSurface(LOADBMP(BMP_RHTTAPE));" to my clbkLoadVC method (vcRsc_reht_tape is the SURFHANDLE member var i mentioned)
- added the previously-mentioned oapiBlt code to the clbkVCRedrawEvent method AFTER having the sketchpad released
- compile... no velociraptor attack, good...
- tested it in orbiter... hmm, fail....
- investigated possibility of it working by blitting from the same surface... yep! that checks out :hmm:...
- wrote this post in search of a "real" answer to my problem....
- hit "Post Quick Reply"... now we wait...