![]() |
|
|||||||
| Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc. |
![]() |
|
|
Thread Tools |
|
|
#16 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
So in clbkLoadVC I call
SURFHANDLE tex_p1Display = oapiGetTextureHandle (mh_cockpit, 4); to get the texture handle for my panel redraw map. The slot is already marked as dynamic in the .msh so from here all I have to do is call oapiCreateSurface (LOADBMP (p1displays)); and the bitmap will be printed to the display correct? from there I can just paint on it using sketchpad yes? ...No because it didn't work. can somebody please help me understand GDI? |
|
|
|
|
|
#17 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
So I'm stealin the "paint individual vessel markings" code from the stock delta glider as it seem to have the functionality I need. (printing a string to a mesh)
I have every thing set up but I'm confused about this line here... Code:
insignia_tex = oapiCreateTextureSurface (256, 256); SURFHANDLE hTex = oapiGetTextureHandle (VCMFDSPEC , 5); if (hTex) oapiBlt (insignia_tex, hTex, 0, 0, 0, 0, 256, 256); Not only does it make no sense but my compiler marks it as an illegal operation. It compiles in the Dg SDK sample but not my own code, what gives? |
|
|
|
|
|
#18 |
|
Orbinaut
![]() |
In my SDK example, it's:
// **************** vessel-specific insignia **************** insignia_tex = oapiCreateTextureSurface (256, 256); SURFHANDLE hTex = oapiGetTextureHandle (exmesh_tpl, 5); if (hTex) oapiBlt (insignia_tex, hTex, 0, 0, 0, 0, 256, 256); |
|
|
|
| Thanked by: |
|
|
#19 |
|
shoemaker without legs
![]() |
Quote:
Code:
void IMS_MFC::MFCprint(SURFHANDLE surf, char* text, int _length, int _x, int _y, MFC_TEXT_POS tpos) Quote:
Code:
for (int i = 0; i < _length; ++i)
{
int srcx = (text[i] - 32) * fWidth;
int tgtx;
switch (tpos)
For your bitmap, this will be a bit more complicated... you can look the values up on an ASCII table and assign them manually, you can make a more practical bitmap, or you can figure out some logic to let the computer calculate the position in your current bitmap (you should put the bitmap into your panel texture, by the way, if that wasn't clear so far). Code:
{
case T_LEFT:
tgtx = _x + i * fWidth;
break;
case T_RIGHT:
tgtx = _x - textwidth + i * fWidth;
break;
case T_CENTER:
tgtx = _x - textwidth / 2 + i * fWidth;
}
oapiBlt(surf, Src, tgtx, _y, srcx, 0, fWidth, fHeight);
}
}
|
|
|
|
| Thanked by: |
|
|
#20 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
Ok I generated a new bitmap that is in proper ASCII order, and much closer to the effect that I eventually want.
That said is it really better to make it a single row? I need the full alphabet and I'm worried that having a texture that is 64x1024 (or similar) might be a bit much. I'm working on adapting what you have so here goes nothing... Code:
void Spider::LCDPrint(SURFHANDLE surf, char* text, int _length, int _x, int _y, MFC_TEXT_POS tpos)
{
int cHeight = 40; // Character height [pixles]
int cWidth = 24; // Character width [pixels]
int cRow, cCol; // Character's position in bitmap [row / column]
int textwidth = cWidth * _length;
for (int i = 0; i < _length; ++i)
{
cRow = (text[i] - 32) / 10;
cCol = (text[i] - 32) % 10;
int srcx = cCol * cWidth;
int srcy = cRow * cHeight;
int tgtx, tgty;
...
Anyway, where do I go from here. don't I need four x/y coordinates to define an area not just two? once I have my coordinates what do I do with them? |
|
|
|
|
|
#21 |
|
shoemaker without legs
![]() |
Quote:
But of course you don't have to do it, it's just important that you have a means of finding the correct corner points for a given ASCII code. Quote:
Quote:
Quote:
Code:
oapiBlt(surf, Src, tgtx, _y, srcx, 0, fWidth, fHeight);
|
|
|
|
| Thanked by: |
|
|
#22 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
Quote:
as for the rest... Ok so you're saing that all of my displays, (or at least the LCD ones) should be a single texture? Something like this for instance? |
|
|
|
|
|
#23 |
|
shoemaker without legs
![]() |
Quote:
Quote:
|
|
|
|
| Thanked by: |
|
|
#25 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
Quote:
In the end though this should work yes? Code:
void Spider::LCDPrint(SURFHANDLE (displaysurface), char* text, int _length)
{
int cHeight = 40; // Character height [pixles]
int cWidth = 24; // Character width [pixels]
int cRow, cCol; // Character's position in bitmap [row / column]
int textwidth = cWidth * _length;
for (int i = 0; i < _length; ++i)
{
cRow = (text[i] - 32) / 10;
cCol = (text[i] - 32) % 10;
int srcX = cCol * cWidth;
int srcY = cRow * cHeight;
int tgtX = i * cWidth;
int tgtY = 0; // for single line display only, multi-linedisplays would need adiditional function here
oapiBlt( (displaysurface), (mybitmap), tgtX, tgtY, srcX, srcY, cWidth, cHeight);
}
LCDPrint( (displaysurface), "(string)", (string length) ); Last edited by Hlynkacg; 07-03-2012 at 09:24 PM. |
|
|
|
|
|
#26 |
|
shoemaker without legs
![]() |
Quote:
Quote:
|
|
|
|
| Thanked by: |
|
|
#27 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
Ok but I'm still unclear about how exactly I go about including bitmaps in a C++ project.
Do I have need to have a "Panels.dds" in my orbiter/textures folder which I blit things onto? How does this play into more complicated panel elements such as an ADI or other gauge? Basically, once I've generated this texture what steps do I need to take to apply it to the mesh? ---------- Post added 07-04-12 at 01:15 AM ---------- Previous post was 07-03-12 at 09:20 PM ---------- I have my bitmap sitting as a resource in my VC2010 project how do I actually call it for use in a function? also, what is this g.param.hDll that I see getting called in pretty much all the SDK samples? It seems to have something to do with this. ---------- Post added at 05:34 AM ---------- Previous post was at 01:15 AM ---------- ok I've marked LCDfont.bmp as a resource and copy/pasted all instances of g_Param and hDll from the DG sample into my code. the code compiles but I'm getting the following error on the .bmp itself. Code:
1>Bitmaps\LCDfont.bmp : fatal error LNK1136: invalid or corrupt file Last edited by Hlynkacg; 07-03-2012 at 09:25 PM. |
|
|
|
|
|
#28 |
|
Orbinaut
![]() |
Generally, you import a .bmp into Visual Studios as a resource, and assign it an ID, usually something like IDB_BITMAP. Then you can load it and get a handle with somethinglike:
LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP)) Not sure on the first parameter that I put a NULL in for... More here: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx |
|
|
|
|
|
#29 |
|
Aspiring rocket scientist
![]() ![]() ![]() |
Quote:
Is this seperate from simply going into the file menu and clicking "add existing file to project"? Last edited by Hlynkacg; 07-04-2012 at 06:23 AM. |
|
|
|
|
|
#30 |
|
shoemaker without legs
![]() |
Quote:
Just make your textures a dds, drop it in the textures folder and load it as shown in the tutorial I posted. |
|
|
|
| Thanked by: |
![]() |
|
| Thread Tools | |
|
|
|||||
| Quick Links | Need Help? |