Programming Question What compiler to choose?

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
Hi there!

It's my first real post in this forum.
Basically, I want to write an up-to-date tutorial in this forum about how to make 2d panels (basic things about buttons, surfaces, and intruments, that I wanted to know at the time), but I lost my c++ scripts and VS, since I changed my computer.

Also I do not really want to reinstall VS, because it is very heavy for what I want to do (compile in c++) and I'm not used to it, unlike MinGW.

So I have two questions:
— first, is it possible to compile with MinGW?
— second, if it is not possible, what options should I choice in the VS installer to minimize the disk space?

Sorry for my bad english, and for maybe reasking a question that was already answered.
Orbifan.
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,053
Reaction score
637
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Hi there!

It's my first real post in this forum.
Basically, I want to write an up-to-date tutorial in this forum about how to make 2d panels (basic things about buttons, surfaces, and intruments, that I wanted to know at the time), but I lost my c++ scripts and VS, since I changed my computer.

Also I do not really want to reinstall VS, because it is very heavy for what I want to do (compile in c++) and I'm not used to it, unlike MinGW.

So I have two questions:
— first, is it possible to compile with MinGW?
— second, if it is not possible, what options should I choice in the VS installer to minimize the disk space?

Sorry for my bad english, and for maybe reasking a question that was already answered.
Orbifan.
I don't know much about the subject because I'm just starting out in this world of programming. But unfortunately no alternative to Visual Studio C++ has worked for me.
I have had to download the IDE and the VS Build Tools which are (for me) extremely slow.

Not so on Linux where I compile only with a small script that selects the source code file and links it with the Orbiter and OrbiterSDK libraries, etc.
 

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
OK, I installed VS, and after passing all the day to relearn, by modifing the source code of shuttlePB, I made this thing!
This is basically shuttlePB, put with a very rudimentary 2d panel: only a small button in the upperleft corner, that control the rcs forward thrusters.

I don't have the time nor the desire today to make mesh instruments or GDI weird things.

I think that the source code will be helpful (sorry if I underestimated you).

See you all next time.

Orbifan.
 

Attachments

  • Basicmodule.zip
    26.9 KB · Views: 1
Last edited:

Boxx

Mars Addict
Addon Developer
Donator
Joined
Nov 15, 2009
Messages
180
Reaction score
123
Points
58
Location
Paris Area
It's my first real post in this forum.
Basically, I want to write an up-to-date tutorial in this forum about how to make 2d panels (basic things about buttons, surfaces, and intruments, that I wanted to know at the time), but I lost my c++ scripts and VS, since I changed my computer.

Also I do not really want to reinstall VS, because it is very heavy for what I want to do (compile in c++) and I'm not used to it, unlike MinGW.

Not a reply but a need confirmation : a tutorial about how to setup the compiler for Orbiter 2016, resp. MFDs, resp. Open Orbiter, would be greatly welcome (before 2D panels, IMHO), in particular to promote taking-over some past Add-ons by new comers in Orbiter community!! I did also spend a crazy load of time to setup VS for my C++ addons (with still some issues with the runtime and .NET 4 compatibilities). As I am not an expert in make/cmake/VS etc... I can't tell if I succeeded accidentally only. But I could share my .sln, .csproj, .vcxproj with anybody wanting to write such a tuto.

I am aslo interested to get free from VS.
 

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
Not a reply but a need confirmation : a tutorial about how to setup the compiler for Orbiter 2016, resp. MFDs, resp. Open Orbiter, would be greatly welcome (before 2D panels, IMHO), in particular to promote taking-over some past Add-ons by new comers in Orbiter community!! I did also spend a crazy load of time to setup VS for my C++ addons (with still some issues with the runtime and .NET 4 compatibilities).
Yes, there's too much tutorials that are outdated. For example, OrbiterWiki says that we should somehow "get the windows sdk" independently.
I'll go straightforward: it is not necessary if you installed VS (default desktop c++), it will just fill your disk space with garbage!
In the other hand, what OrbiterWiki says about the config of VS is mostly true: please just include lib and include folder, and you'll be fine.
The part about resource is just a big joke: I didn't write a rc file, I just added a resource in the project by the visual interface, and after many failed attempts, it works.

P.S. — There is something in my code that I do not understand: oapiRegisterPanelArea didn't work, but RegisterPanelArea do.
 

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
GDI is obsolete anyway, you should migrate to Sketchpad if possible.
How do I refresh in sketchthing? oapiBlt doesn't work (and I called it after releasing sketchpad, font, etc.)
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,606
Reaction score
2,328
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Depends. You can still use oapiBlt with getDC. Or use the newer OpenOrbiter version, where the full (and more) oapiBlt functionality got implemented. Or use different textures and texture coordinates in Panel2D to create the same result, but much faster.
 

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
Depends. You can still use oapiBlt with getDC. Or use the newer OpenOrbiter version, where the full (and more) oapiBlt functionality got implemented. Or use different textures and texture coordinates in Panel2D to create the same result, but much faster.
I should be more precise in my question.:oops:
So, I created an anemometer with sketchpad: it's just text.
Obviously I want it to update without hiding a part of the background, like Rectangle does.
Therefore, my question is: how can I update a text without using Rectangle function?

There's the code:
C++:
case AID_TEST:
    oapi::Font* font = oapiCreateFont(24, true, "Sans", FONT_BOLD);
    oapi::Sketchpad* skp = oapiGetSketchpad(surf);
    sprintf(buffer, "KEAS: %f", 1.94384*sqrt(2 * GetDynPressure() / d));
    if (skp) {
        skp->SetFont(font);
        skp->SetTextColor(0);
        skp->Text(400, 200 + off, buffer, strlen(buffer));
        oapiReleaseSketchpad(skp);
    }
    oapiReleaseFont(font);
    return true;

Happy new year 2024! :cheers:
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,606
Reaction score
2,328
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Did you consider calling

Code:
skp->SetBackgroundMode(BK_TRANSPARENT);

first?
 

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
No, why?

EDIT: OK, I did this, and nothing happened.
 
Last edited:

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,606
Reaction score
2,328
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
It exists. Is defined together with Sketchpad in DrawAPI.h since 2016.
 

Orbifan

Member
Joined
Aug 2, 2023
Messages
13
Reaction score
21
Points
18
Location
?
The compiler accept if I write:
Code:
skp->BK_TRANSPARENT
instead of BK_TRANSPARENT
But nothing happened, the text do not refresh.

The new code:
Code:
case AID_TEST:
    oapi::Font* font = oapiCreateFont(24, true, "Sans", FONT_BOLD);
    oapi::Brush* brush = oapiCreateBrush(0xFFFFFF);
    oapi::Sketchpad* skp = oapiGetSketchpad(surf);
    sprintf(buffer, "KEAS: %.0f", 1.94384*sqrt(2 * GetDynPressure() / d));
    if (skp) {
        skp->SetBackgroundMode(skp->BK_TRANSPARENT);
        skp->SetBrush(brush);
        skp->SetFont(font);
        skp->SetTextColor(0);
        skp->Text(400, 200 + off, buffer, strlen(buffer));
        
        oapiReleaseSketchpad(skp);
    }
    oapiReleaseFont(font);
    oapiReleaseBrush(brush);
    return true;
 
Top