Noutați

How To Use Gamepad Or Joystick Controller In A C++ Builder FMX App?

C++ is one of the most powerful programming languages that we can use to create games that are playable with mouse, keyboard and gamepads or joysticks. We also use C++ in commerce, industry, in robotics, and in the control of IoT devices. Despite competition from other programming languages the games market is still very much dominated by C++. Many games seek to go beyond keyboards to control the gameplay by using specialized controllers either in addition to or instead of keypresses on the computer’s keys. Two of the most well-known controllers in these areas are joysticks or gamepads. The simplest examples of interfacing with game controllers on Windows is by using the XInput library. Even though XInput has been around for a long time it can still be used with the latest C++ Editor and compiler for Windows. In this post, we explain how you can use gamepad or joystick controller in C++ using with Xinput library. Is there a component for using a gamepad or joystick in C++ on Windows? If you are looking for a component library, there are Delphi and C++ Builder-compatible components built on the XInput library. The Controller library is a Delphi and C++ Builder component that allows applications to receive input from the Xbox Controller. The main features of this library are: Uses Windows XInput API Available for Delphi and C++ Builder from versions 6 right up to the current modern version 11. Source code included in the registered version. Royalty-free distribution. You can download the trial version of the XInput library, or you can buy a professional edition from here. How can I control a gamepad or joystick in C++ with Xinput Library? XInput library is deprecated but is still a supported library by Microsoft. They recommend moving towards the GameInput library or Windows.Game.Input for Windows applications. If we look at these kinds of libraries (i.e GamePad.h library), like MS’ own DirectXTK, we can see that the toolkit allows one to define USING_XINPUT vs. USING_GAMEINPUT vs. USING_WINDOWS_GAMING_INPUT to pick which underlying library is used. If we compare  XInput compared to GameInput: XInput library is old and easy to implement Windows applications. XInput library is limited to 4 controllers XInput library has no uniform interface to other input (like mouse/keyboard) XInput library occurs with higher latency XInput library is not friendly with other controllers. i.e. no support for Xbox One Rumble Motors. Briefly, DirectInput is better than XInput. If you still want to use XInput, you can check more about https://learn.microsoft.com/en-us/windows/win32/xinput/getting-started-with-xinput XINPUT_GAMEPAD structure (declared in ) is explained here : https://learn.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad As in there, this structure has these members: wButtons, bLeftTrigger, bRightTrigger, sThumbLX, sThumbLY, sThumbRX, sThumbRY. Here wButtons member is used as a bitmask of the device digital buttons, it can be used as below, wButtons Device digital button flags Gamepad Bitmask XINPUT_GAMEPAD_DPAD_UP 0x0001 XINPUT_GAMEPAD_DPAD_DOWN 0x0002 XINPUT_GAMEPAD_DPAD_LEFT 0x0004 XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 XINPUT_GAMEPAD_START 0x0010 XINPUT_GAMEPAD_BACK 0x0020 XINPUT_GAMEPAD_LEFT_THUMB 0x0040 XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 XINPUT_GAMEPAD_A 0x1000 XINPUT_GAMEPAD_B 0x2000 XINPUT_GAMEPAD_X 0x4000 XINPUT_GAMEPAD_Y 0x8000 How to use a gamepad or joystick in a C++ Builder FMX application? Here are the steps to use gamepad or joystick in C++ Builder FMX app, Create a new Multi-Device C++ Builder FMX application Drag a Timer (TTimer) component on to Form In Object Inspector window, set its interval to 15 and be sure it is enabled Drag a shape Circle (TCircle) component on to Form In Object […]

Read More

How To Change Background Color Of A Component In An FMX C++ App

C++ Builder is the easiest and fastest C++ IDE for building professional applications with powerful GUI components like Memo, Edit, ListBox, StringGrid and many more. Each component can be ‘skinned’ with Styles to change their visual appearance. Styles are very powerful and because of this it can sometimes take a little to get used to how they work. In this post, we explain how to change background color of a component. Here is how you can do, How can I change background color of a component using styles in an FMX app? Syles are sets of graphical details that define the look and feel of an application visually and they are one of most beautiful and useful UI features of RAD Studio. Styles make your UI elements have a professionally designed appearance with minimum effort from you. Official Styles are designed by Embarcadero’s professional graphic designers. There are also other 3rd party Styles; also, users may generate their own styles. Styles are similar to themes in Windows or skins of old-style applications like WinAmp – but brought right up to date for the modern world. In RAD Studio, Multi-Device C++ Builder FireMonkey Projects, using styles on your new projects is very easy. You design your application’s screens in normal ways with buttons, labels, edit boxes, memos, trackbars, panels, switches etc. These controls will automatically adopt whatever appearance is enabled by the chosen style. You can also add these Styles to your Old C++ Builder Projects or to Old C++ Builder Unit files. You just need a RAD Studio, C++ Builder version which supports styles. We highly recommend you use the latest RAD Studio or C++ Builder versions which have new features and improvements on Styles. Here is how you can use Styles. In addition, you can create your custom styles in RAD Studio and C++ Builder. Here are two examples about Memo (TMemo) and Edit (TEdit) components. How to change background color of an FMX component in C++ code? Here is a simple function example to change background color of a component in C++, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 void SetBackgroundColor(TStyledControl *control, TAlphaColor color) {   control->NeedStyleLookup();   control->ApplyStyleLookup();   TFmxObject *fmxobj = control->FindStyleResource(“background”);   TRectangle *rect = new TRectangle(fmxobj);   fmxobj->AddObject(rect);   rect->Align = TAlignLayout::Client;   rect->Fill->Color = color;   rect->Stroke->Color = claNull;   rect->HitTest = false;   rect->SendToBack(); } Is there a full C++ example of how to change the background color of a component in FMX and C++? In this example there are Memo, Edit, ComboBox, ListBox components and a Button component. You need to create a new C++ Builder Multi-Device application and then you should drag these components on your form. You can choose your colors from here https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Colors_in_FireMonkey If you want to know more about colors in Modern C++ here are some examples of how to use RGB or ARGB colors in C++. After that, you can modify your code as below. Here is a full C++ example of to change the background color of a component in an FMX C++ application. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #include #pragma hdrstop #include “Component_Background_Color_Unit1.h” //————————————————————————— #pragma package(smart_init) #pragma resource “*.fmx” TForm1 […]

Read More

Let Stack Overflow Know You Use RAD Studio With Delphi

Hello fellow developers. The hugely important Stack Overflow site is currently running their annual survey of developer tools. Delphi is listed among the choices. It would be really helpful if you could visit the survey and let Stack Overflow know that you’re a RAD Studio with Delphi user. Whether you use one of the paid editions or the recently announced version 11 Community Edition it all counts. Delphi is very good at working away silently and trouble-free in the background, powering all sorts of parts of commerce, apps, and vital infrastructure. The fact that Delphi apps are immensely stable and don’t keel over just because something on the computer was changed or upgraded is a huge benefit – but it’s also a curse. It can lead to the language being ‘silently successful’. To paraphrase Oscar Wilde, “there is only one thing worse than being talked about, and that is not being talked about“. The Stack Overflow survey also has a spot to indicate that you use RAD Studio, so C++ Builder also counts too. So, please, go to the following link and let everyone know that you’re a Delphi user. It’s anonymous and only takes a few minutes. The figures are aggregated so nobody will actually know – but every single vote counts. The survey closes on May 19th so the sooner you can take the survey, the better. Here’s the survey: https://meta.stackoverflow.com/questions/424565/take-the-2023-developer-survey Marco has written a blog about the survey too. I am also very grateful to Darian Miller, one of our excellent MVPs who managed to electronically poke me as soon as I took over from Jim McKeeth and reminded me about the survey. Darian has his own take on the survey here: https://www.ideasawakened.com/post/2023-stack-overflow-developer-survey-includes-delphi-place-your-vote-today If you can find the time to complete the survey you’ll be helping both your fellow Delphi developers and those people who are considering development for the first time. Free Delphi Community Edition   Free C++Builder Community Edition

Read More

5 Modern C++ Posts That Can Be Used With C++ Builder 11 CE

Hello C++ developers, C++ students, and C++ educators. We recently had another milestone for the C++ programming language with a free version of C++ Builder, C++ Builder 11 CE Community Edition released in April 2023. If you are a start-up developer, student, hobbyist or just interested in learning to code then C++ Builder Community Edition may well be just the thing for you. Read the FAQ notes on the CE license and then simply fill out the form and download C++ Builder 11 CE. Table of Contents Where can I learn to program in C++ for free? What is new in C++ Builder CE? What are the important features of C++ that can be used with C++ Builder CE? Learn C++ Builder CE with C++ examples Get in touch and tell us what you’d like to see on the blogs What might be next for C++ Builder? Where can I learn to program in C++ for free? If you don’t know anything about C++ or the C++ Builder IDE, don’t worry, we have a lot of examples on the LearnCPlusPlus.org website and they’re all completely free. Just visit this site and copy and paste any examples there into a new Console, VCL, or FMX project, depending on the post example. We keep adding more C and C++ posts with sample code. In today’s round-up of recent posts on LearnCPlusPlus.org, we have new C and C++ posts with very simple examples that can be used with the following: The free version of C++ Builder 11 CE Community Edition. or a full paid version of C++ Builder and RAD Studio. or free BCC32C C++ Compiler and BCC32X C++ Compiler. or the free Dev-C++. What is new in C++ Builder CE? C++ Builder 11 CE, the free Edition of C++ Builder, has been recently released. Embarcadero has made available a Community Edition license for the most recent 11.3 release of Delphi and C++Builder. This is a free edition of either Delphi or C++Builder for students, hobbyists, and startups (as the license is revenue-limited). There is also a new Delphi CE version 11 edition. The C++ CE version and Delphi CE version cannot exist on the same machine. The full commercial versions of RAD Studio with Delphi and C++ Builder can co-exist though, and, in fact, RAD Studio can choose between the “C++ personality” and “Delphi personality” so you can use it for both languages as your needs dictate. What are the important features of C++ that can be used with C++ Builder CE? C++ is a very capable, versatile, and powerful programming language that has a very strong compiler supported by a big community on a range of different platforms. The C++ language definitions, syntax, and functionality are organized into different standards. Those standards are usually named after the year the standard was adopted such as 1998 for C++98, 2011 for C++11, 2014 for C++14, and 2017 for C++17. One of the great features of a C++ compiler is you can choose which standards you want your code to be compiled against, before the compilation of your source code. This allows the compiler to check that your code complies with that standard. In the first post, we explain what the standards are, how you can view them, how you can check the compatibility of your C++ source code against […]

Read More

C++20 Support Comes To C++/CLI

We’re pleased to announce the availability of C++20 support for C++/CLI in Visual Studio 2022 v17.6. This update to MSVC was in response to feedback received from many customers via votes on Developer Community and otherwise. Thank you! In Visual Studio 2022 v17.6, the use of /clr /std:c++20 will no longer cause the compiler to emit a diagnostic warning that the compiler will implicitly downgrade to /std:c++17. Most C++20 features are supported with the exception of the following: Two-phase name lookup support for managed templates. This is temporarily on hold pending a bugfix. Support for module import under /clr. Both the above are expected to be fixed in a near-future release of MSVC. The remainder of this blog post will discuss the background details, limitations, and caveats of C++20 support for C++/CLI. Brief history and background of C++/CLI C++/CLI was first introduced as an extension to C++98. It was specified as a superset of C++98 but soon with the introduction of C++11, some incompatibilities appeared between C++/CLI and ISO C++, some of which exist to this day. [Aside: nullptr and enum class were originally C++/CLI inventions that were migrated to ISO C++ and standardized.] With the further introduction of C++14 and C++17 standards, it became increasingly challenging to support the newer language standards and eventually due to the effort required to implement C++20, we decided to temporarily limit standard support to C++17 in /clr mode. A prime reason for this was the pause in the evolution of the C++/CLI specification, which has not been updated since its introduction and therefore could not guide the interaction of C++/CLI features with the new features being introduced in ISO C++. The design rationale for C++/CLI is spelled out in this document. Originally envisioned as a first-class language for .NET, C++/CLI’s use has primarily fallen into the category of interop, which includes both directions from managed to native and vice versa. The demise of C++/CLI has been predicted many times, but it continues to thrive in Windows applications primarily because of its strength in interop, where it is very easy to use and hard to beat in performance. The original goals spelled out in the C++/CLI Rationale were: Enable C++/CLI as a first-class programming language on .NET. Use the fewest possible extensions. ISO C++ code “just works” and conforming extensions are added to ISO C++ to allow working with .NET types. Be as orthogonal as possible: if feature X works on ISO C++ types, it should also work on C++/CLI types. With the specialization of C++/CLI as an interop language, the ECMA specification for it was not updated to keep up with fast evolving .NET features with the result that it can no longer be called a first-class language on .NET. While it can consume most of the fundamental types in the .NET base-class library, not all features are available due to lack of support from C++/CLI. This has resulted in both /clr:safe (allow only the “safe” CLS subset of CLI, disallowing native code) and /clr:pure (compile everything to pure MSIL code) to be deprecated. The only options supported currently are /clr, which targets the .NET Framework, and /clr:netcore which targets NetCore. In both cases, compilation of native types and code, and interop are supported. Goal (2) was originally achieved nearly perfectly in C++98 […]

Read More

Visual Studio 2022 version 17.6 for C++ Developers

We are happy to announce that Visual Studio 2022 version 17.6 is now generally available! This post summarizes the new features you can find in this release for C++. You can download Visual Studio 2022 from the Visual Studio downloads page or upgrade your existing installation by following the Update Visual Studio Learn page. You’re used to debugging your C++ code with a lot of help from the IDE, but what about your build system? You can use the new CMake Debugger to debug your CMake scripts at configure time. You can set breakpoints based on filenames, line numbers, and when CMake errors are triggered, and can view call stacks of filenames and watch defined variables. Furthermore, the locals window will track CMake variables, targets, and tests. We’ve added a new Remote File Explorer feature. With this you can browse, upload, and download files to your remote machine listed in the Connection Manager, directly from Visual Studio. You can now use the Create Member Function feature to quickly add constructors and equality operators to your classes. When you have a class with member data, three dots will appear under the class name, and hovering over them will display a screwdriver icon. The drop-down from the screwdriver icon will display the new member function suggestions. With this, you can add a default constructor, constructor with all fields, equality operator, and equality operator with all fields.  You can learn more about this feature in our Create C++ Member Function in Visual Studio blog post. We made improvements to the Solution – Close scenario, which makes closing a solution containing C++ projects faster. The overall perf improvements can make closing a solution in some cases from 20% faster for small codebases, to 50% faster in some cases for large solutions (1000+ projects). We expect the wins to be more noticeable in large projects. For Chromium, the improvements are typically 50% faster, saving 20 seconds of time. The Visual Studio Installer now lets you install Incredibuild 10, which comes with a host of new features, including new build cache technology, an improved license management system, and cloud optimization. You can find out more about these features and how you can use them in our Even faster builds with Incredibuild 10 and Visual Studio 17.6 Preview 3 blog post. We have added initial support for C++20 mode in C++/CLI projects. All C++20 headers can be #included in a /clr compilation without restrictions. You can find out more details in our C++20 Support for C++/CLI blog post. We continue to work on C++23 support in our standard library, as well as improving our support for existing standards. Many of these features have been contributed by you folks in the community: thank you! You can find the full changelist on the Microsoft STL GitHub page. Here are some highlights: P1223R5 ranges::find_last, ranges::find_last_if, ranges::find_last_if_not P2321R2 views::zip_transform P2474R2 views::repeat P2505R5 Monadic Functions for expected Activated the vectorized implementations of find(), count(), ranges::find(), and ranges::count() for more scenarios involving pointer elements. Added visualizers for error_category and error_code. Improved the output of source_location::function_name(). It now includes both function parameter types and template arguments. Visual Studio 2022 version 17.6 comes with built-in support for HLSL and a new tool to view Unreal Engine logs. HLSL (High Level Shading Language) is a DirectX-specific programming language used to create shaders in game development and rendering applications. The popular HLSL Tools extension by […]

Read More

Embarcadero Welcomes Ian Barker to Developer Advocate Role

If you have watched any of Embarcadero’s online content, attended a RAD Studio webinar, or been to one of the in-person events you will most likely know the wonderful Jim McKeeth. Jim has been the Chief Developer Advocate and Engineer for Embarcadero since July 13th, 2013, just short of ten years. Today, however, the big news is that Jim is leaving Embarcadero and moving on to a new role as a developer advocate at EOS Network Foundation. Of course, we’re devastated that Jim’s particular brand of jovial code geekery will no longer be at the helm of the Developer Relations program, but we’re also thrilled for him to be moving on to new horizons and will get to stretch that burgeoning tech brain of his with the delights of such things as block-chain. Along with that news comes, of course, an announcement that Ian Barker (that’s me) will be taking over as Embarcadero Developer Advocate. I’ll be dealing with most of the things Jim did, those that are public, along with those which he did so capably behind the scenes too, of which there are many. Eli Mapstead will be expanding his role too and taking over some of the Python projects that Jim oversaw and championed. Yes, Jim can legitimately make the claim “it took two people to replace me“. Jim will become an Embarcadero MVP – once I’ve reviewed his application and decided if he’s good enough. ???? I’m going to do a more comprehensive retrospective blog post of some of the many great things Jim has been responsible for as well as highlight a few of his crazy professor moments, we have a thick stack of them – he’s a developer’s developer and irrepressible gadget freak – but, for now, we’re going to let the video do the talking. The audio echoed a little from time to time – but then it wouldn’t be the same if technology didn’t try to trip Jim or I up during recording, would it? From all of us in the Embarcadero and Idera family – thank you Jim. You’re a hard act to follow. Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy. Start Free Trial   Upgrade Today    Free Delphi Community Edition   Free C++Builder Community Edition

Read More

How To Change Background Color Of An Edit In An FMX C++ App

C++ Builder is the easiest and fastest C++ IDE for building everything from simple to professional applications using visually amazing GUI controls and forms. Each form and component can be skinned with Styles which allow your application to have its own professionally designed attractive look and feel. The Style systems of the VCL and FMX (FireMonkey) award-winning frameworks is very easy to use but there is sometimes a learning curve to climb to understand how to get the best out of them. In this post, we explain how to change background color of an Edit (TEdit) which is one of the most frequently asked questions. These methods below, can be applied to other components too. How to change the background color of an Edit control using Styles? Styles are sets of graphical details that define the look and feel of an application visually. They are one of most beautiful and useful UI features of RAD Studio, that makes your UI elements ‘skinned’ with a professionally designed graphical look and feel. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps (not wrapped in some kind of runtime interpretation layer) and the powerful FireMonkey (FMX) framework for cross-platform UIs. Both VCL and FMX apps support Styles. There are many different styles available, and they cater for almost every possible taste in aesthetics as well as providing dark and light mode versions. More details about Styles can be found here. You can also find additional Premium Styles here. If you want to learn how you can modernize your components with styles here is the post you need; Right-click on the Edit and select ‘Edit Custom Style…’ Expand Edit1Style: you’ll see the background node. Click on background to select it. Then add a TRectangle via the Palette. The IDE should expand the background node and show a new Rectangle1Style tied to the TRectangle, Via the Object Inspector change the Color of TRectangle Click on the Apply Style button in the ‘Style Designer’. Compile and run your application If you still have problems to set color, may be this docwiki can help you : https://blogs.embarcadero.com/edit-custom-style-to-change-the-background-color-of-a-fmx-tedit/ How to change background color of an Edit in C++ code? If you want to change the background color of a Edit component (TEdit) in C++ Builder, first you should set the StyleLookup property to “Editstyle” as below.   Edit1->StyleLookup = “Editstyle”;   If you look at the Custom Style of Edit, there is “background” property, so we should find this resource by using the FindStyleResource() method of Edit as given example below.   Edit1->StyleLookup = “Editstyle”; auto fmxobj = Edit1->FindStyleResource(“background”, false);   if this resource object found, we can create a rectangle (TRectangle) as a background as below.   std::unique_ptr rect(new TRectangle(fmxobj));   Here we used unique_ptr which more modern to create this rectangle. Now we can set properties of our Rectangle, including its color.   rect->Align = TAlignLayout::Client; rect->Fill->Color = color; rect->Stroke->Color = color; // = claNull; rect->HitTest = false; rect->SendToBack();   Now, at last we need to add this object by using .get() method of unique_ptr. And the final trick here is you must release this unique_ptr by using .release() otherwise it doesn’t have any effect.   fmxobj->AddObject(rect.get()); rect.release();   I asked one of Embarcadero’s engineers to explain this a little more to me and he noted that “If you insist on using unique_ptr, you must add a call to .release(); to tell the unique_ptr that you no longer want it to clean up […]

Read More

How To Use Gamepad Or Joystick Controller In A C++ Builder VCL App?

C++ is one of the most powerful programming languages that we can use to create games that are playable with mouse, keyboard and gamepads or joysticks. We use C++ not just in games but also in almost every kind of industry, in robotics, and in the control of IoT devices. Games frequently have better playability if the user can control the game with input devices other than keyboard. The most popular controllers for games are gamepads and joysticks. One of the simplest ways to use such game controller hardware on Windows is using the venerable XInput library. Despite XInput having been around for a long time it can still be used with the latest C++ IDE and compiler for Windows. In this post, we explain how you can use gamepad or joystick controller in C++ using with Xinput library. Is there a ready-made component for controlling a gamepad or joystick in C++ on Windows? If you are looking for a component library, there are Delphi and C++ Builder-compatible components built around the XInput library. The Controller library is a Delphi and C++ Builder component that allows applications to receive input from the Xbox Controller. The main features of this library are, Uses Windows XInput API. Available for Delphi/C++ Builder 6 – 11 and Lazarus 2.0.12 Source code included in the registered version. Royalty free distribution. You can download the trial version of the XInput library, or you can buy a professional edition from here. How can I control a gamepad or joystick in C++ with the Xinput Library? XInput library was developed quite some time ago and is a deprecated but still supported library by Microsoft. They recommend moving towards the GameInput library or Windows.Game.Input for Windows applications. If we look at these kinds of libraries (i.e GamePad.h library), like MS’ own DirectXTK, we can see that the toolkit allows one to define USING_XINPUT vs. USING_GAMEINPUT vs. USING_WINDOWS_GAMING_INPUT to pick which underlying library is used. If we compare  XInput compared to GameInput: XInput library is easy to implement Windows applications. XInput library is limited to 4 controllers. XInput library has no uniform interface to other input (like mouse/keyboard). XInput library occurs with higher latency. XInput library is not friendly with other controllers. i.e. no support for Xbox One Rumble Motors. In brief, DirectInput is better than XInput. If you still want to use XInput, you can check more about https://learn.microsoft.com/en-us/windows/win32/xinput/getting-started-with-xinput XINPUT_GAMEPAD structure (declared in ) is explained here: https://learn.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad In there, this structure has these members: wButtons, bLeftTrigger, bRightTrigger, sThumbLX, sThumbLY, sThumbRX, sThumbRY. Here wButtons member is used as a bitmask of the device digital buttons, it can be used as below. wButtons Device digital button flags Gamepad Bitmask XINPUT_GAMEPAD_DPAD_UP 0x0001 XINPUT_GAMEPAD_DPAD_DOWN 0x0002 XINPUT_GAMEPAD_DPAD_LEFT 0x0004 XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 XINPUT_GAMEPAD_START 0x0010 XINPUT_GAMEPAD_BACK 0x0020 XINPUT_GAMEPAD_LEFT_THUMB 0x0040 XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 XINPUT_GAMEPAD_A 0x1000 XINPUT_GAMEPAD_B 0x2000 XINPUT_GAMEPAD_X 0x4000 XINPUT_GAMEPAD_Y 0x8000 How to use a gamepad or joystick in C++ Builder VCL Application? Here are the step to use gamepad or joystick in C++ Builder VCL app, Create a new VCL Windows application in C++ Builder. Drag a Timer (TTimer) component onto the Form. In the Object Inspector window, set its interval to 15 and be sure it is enabled. Drag a Shape (TShape) component on to Form. In Object Inspector window, set its Shape property to stCircle, change Brush color something that makes you happy. Double click to […]

Read More

What’s New for Makefile Tools in VS Code Version 0.7.0 – Variable Expansion and more…

The Makefile Tools team in VS Code has shipped the latest 0.7.0 version of the extension. In this version, we have enabled variable expansion for your Makefile projects in settings, so you no longer need to write plain paths for your Makefiles in the settings.json for the extension and can instead utilize variables that the Makefile extension can detect and replace values for. This allows for easier sharing of settings.json and improved consistency. Also, this allows for parameterization, so that you can define one setting and don’t need to constantly change its value if you toggle between different configurations and/or build targets.  We have also improved the user experience for when Makefile, Make and build.log are not found and added new support for C++23. The details of all that is new with this release can be found here in this change log.  Variable Expansion The macros that are now supported to work from any setting entry-point are:  ${workspaceFolder} and  ${workspaceRoot} ${workspaceFolderBasename}  ${userHome}  ${env:ENVIRONMENT_VARIABLE}  ${config:ANY_EXTENSION_SCOPE.ANY_SETTING_ID}  ${command:ANY_EXTENSION_SCOPE.ANY_COMMAND_ID}  ${configuration} and  ${command:makefile.getConfiguration} ${buildTarget} and  ${command:makefile.getBuildTarget} You can use this syntax in your settings.json, and the Makefile extension will automatically detect and populate the relevant information for these variables. Below are a few examples of using these macros to substitute your existing plain text. Variable Example Expanded Variable Example “makefile.extensionOutputFolder”: “${userHome}/MyOutput/${workspaceFolderBasename}”  C:/Users/Public/MyOutput/MyProject  “makefile.makePath”: “${env:ProgramFiles(x86)}/GnuWin32/bin/make.exe”  C:/Program Files (x86)/GnuWin32/bin/make.exe  “makefile.extensionLog”: “extension_${configuration}_${buildTarget}.log”  extension_debug_x86.log   “makefile.configurationCachePath”: “cache_${command:makefile.getConfiguration}_${command:makefile.getBuildTarget}.log”  cache_debug_x86.log   “makefile.compileCommandsPath”: “${config:C_Cpp.default.compileCommands}”  C:/github/projects/MyProject/build/compile_commands.json  “makefile.makefilePath”: “${workspaceFolder}/Makefiles/makefile.in”  C:/github/projects/MyProject/Makefiles/makefile.in  “makefile.launchConfigurations”:{[…        “binaryPath”: “${workspaceRoot}/test.exe”,       “binaryArgs”: [\${buildTarget}, “${buildTarget}”]  …]}  test.exe ${buildTarget} x86 Improved messaging when Makefile, Make and Build.log are not found  Now, you can see the status of all critical components used in activating the extension in the left–side Makefile Tools project outline including the newly added Makefile, Make, and Build Log. Makefile, Make, and Build.log are not found, the extension has a “not found” status integrated into this side panel next to each item.   in the latest pre-release version, you can specify the path to these files so that the extension can find them and activate all capabilities fully as well as show the current status of the project. Once you select a path for each item, you can view the active path and status in the side panel.  We have also set up a pre-release pipeline, so you can get earlier access before an official release ship to any bug fixes and releases that users merge to the Makefile Tools repository. All you need to do is click the “Switch to Pre-Release version” under the Makefile Tools extension.  Some new functionality is available in the latest pre-release, including the ability to open Makefile and Build Log using new buttons in the project outline.  Future Work Next, we will be investigating some of your most highly up-support for multi-root repositories.  What do you think? Download the Makefile Tools extension for Visual Studio Code today, give the latest version a try, and let us know what you think. Check out our README documentation to learn more about activating the extension and getting started.  If you run into any issues, or have any suggestions, please report them in the Issues section of our GitHub repository.  We can be reached via the comments below or in email at VisualC@microsoft.com. You can also find our team on Twitter at  @VisualC. 

Read More