Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more


Windows 8 - Charms

Posted by Mark Alexander on 12 December 2014

Last weeks tech blog was the first in a series of blogs covering the Windows 8 target platform. We discussed the use of Live Tiles to improve user engagement, as well as the use of badges to display game information. This week we are going to continue with Windows 8 and discuss the different ways that you can use Charms from the Windows 8 UI within your projects.

The Charm Bar

The Charm Bar is a feature addition for Windows 8, and it works as a universal toolbar of sorts for the OS. This means that you can access it from anywhere no matter which application you are working on, or what game you have open.

The two ways in which you can access the Charm Bar are, firstly, by dragging your mouse pointer to the top (or bottom) right corner of the screen (since the show desktop area is also at the bottom right, you may prefer the top right corner), or you can alternatively press the Windows + C button combination on your keyboard to invoke the bar.

The above image shows the five different Charms available to the user at any time while using Windows 8, and GameMaker:Studio gives you direct access to three of these charms with some special functionality that has been built into the GameMaker Language. The following sub sections explain briefly what possibilities this opens up to you when you develop your games.


The Search charm opens what is basically the same search box that you should be used to seeing in all previous incarnations of Windows, and with it you can search files, applications and control panel settings (as you would expect), only now the results are almost instantaneous unlike the older search tools. However, one thing that is new is the ability to use search to find ''keywords'' within Windows 8 apps.

This functionality has been added to Windows 8 games made with GameMaker: Studio, and with a few lines of simple code, you can add "keywords" to your game that can then be found through the search charm. These keywords can also be used to trigger callback scripts within your game. This means that if someone searches for "inventory" (for example) and you have it as a keyword in your game, you can have a callback script that will take the player instantly to the inventory screen. 

Coding Search Keywords

To permit Windows 8 search to index your game you need to create a <tt>ds_list</tt> with all the keywords and then enable the search function. When one of the keywords is called from the search charm, it will run a callback script in your game. A typical setup code would look something like this: 

var list;
list = ds_list_create();
ds_list_add(list, "smelly fish");
ds_list_add(list, "Haggis");
ds_list_add(list, "MacSweeney");
ds_list_add(list, "the quick brown fox");
ds_list_add(list, "99 red balloons");

The above code will enable the search functions for your app and tell Windows 8 to run the callback script “<tt>scr_SearchWords</tt>” should it find a corresponding search term. Some keywords are then added into a <tt>ds_list</tt> which is used to create the search terms that the search charm will find when used.


As the name indicates, the Share charm is used to share information with people and other apps. Basically, this is the typical “cut and paste” feature that you would expect from an OS, but it has been extended so that those Windows 8 apps and games that have sharing integrated and the necessary permissions can then receive varying types of information.

What this means for those who develop Windows 8 games in GameMaker: Studio, is that you can use the special sharing functions to share the following different information types to other apps and games:


  • Files
  • Images
  • Screenshots
  • Text
  • URL's


So your game can now share text files with level information from a level editor with your friends, or screenshots of your current progress, etc... A powerful system that can make your game or app stand out and integrate with the Windows 8 environment. 

Coding Sharing

The list given above shows the things that you can share using the Share Charm from GameMaker: Studio, and each one of them has it's own function. Since they all share the same functionality and more or less the same format, the example shown here only covers one possibility, that of sharing a URL. 

win8_share_url(URL, title, description, immediate);

The above function takes a URL (string) as well as a title and a description of the URL being shared. The final argument “immediate” indicates whether it should be shared immediately (true) and shown in the slide-out share charm, or not (false), in which case the user will have to manually call on the share charm to see the content. In practice this would look something like the following:

if (keyboard_check_pressed(ord("S")))
win8_share_url("", "MacSweeney Games", "MacSweeny Games Homepage", true);


From the Settings charm you can control all the settings of your apps and even the PC or device itself. The normal direct access controls are Audio, Brightness, Network, Power, Notifications and Language, with other options available at the top depending on the app or game that is currently being used.

With the new Windows 8 functions in GameMaker:Studio you can now access this charm and add your own settings to the slide-out menu, or even create your own slide out sub-menu activated from this charm using HTML.

These settings are designed for you to provide users with a consolidated place for fast, in-context access to settings that affect their current Windows 8 app or game that they are running, and should therefore have a quick-dismiss system (which disappears when the user touches anywhere on the screen outside of the settings slide-out menu). This is because the Windows 8 idea is to have the settings UI enable users to adjust the behaviour of the app quickly and then seamlessly return to the experience they were emerged in.

An extra bonus for the developer using GameMaker: Studio is that by providing access to the settings UI at all times through the Settings charm, you do not have to sacrifice any application real estate to show buttons or options, nor do you have to build in any navigation to and from a settings page in the game or app itself. This means that you can dedicate more time and energy on making your game as immersive as possible!

For further information on the '''Settings Charm''', it is worthwhile looking over the Microsoft Library Settings Charm Good Practices

Coding Settings

As with the other Windows 8 specific functionality, GameMaker: Studio has some dedicated functions that permit you to add to and customise the Settings charm. At its most basic level, you can simply call something like this at the start of your game: 

win8_settingscharm_add_entry("Controls", scr_GameControls);

The first argument is the name of the option you are adding (as a string), and the second argument is the script from your game that you wish the new option to access (in this case a script to define the game controls) or it can be URL that you wish the charm to open. If you choose a URL then it should be a string and start with http://, for example "". Note that at the very least, you must add a setting that links to a privacy policy as this is one of the few things that Micorsoft insists you have. So your should always have something like the following at the start of your game code:

win8_settingscharm_add_entry("Privacy Policy", "");

For a more complex settings page, you can also define an HTML or XAML file that will be used instead of the default settings slide-out window. The XAML method is designed to work on the Native modules, while the HTML is for the JavaScript module, but it can also be used for Native as long as you do not use anything that accesses WinJS.UI (ie: only use simple HTML with this option for Native).

For example:

win8_settingscharm_add_html_entry("defaults", "News", working_directory + "News.html"); 

The above code will create a new option within the settings charm called "News" which when pressed, will open the exported HTML file. Note that the HTML file to be used must have been included within the GameMaker: Studio IDE as an included file. Setting up the XAML or HTML for your game requires a bit of work and know-how, but we have created some templates for you to use which can be downloaded from the following link:

You should also take a moment to look over the Microsoft documentation for these files:


Charms are an integral part of working with Windows 8, and as such you should make the most of them, especially the settings charm which is an ideal place to have all your game information and options for sound, graphics etc... So, make the most of them in your games! Next week we will be posting the final part to this series where we'll cover the App Bar on Windows 8.

Back to Top