You are on page 1of 10

Ring Documentation, Release 1.

16.2 Creating and running your first Console Application

At first we will type the source code


See "Hello, World!"

As in the next image

Then we will click on the “Save” button from the toolbar (or press CTRL+S)

Determine the source code file name and location.


For example type : hello
This will create a new source code file called : hello.ring

16.2. Creating and running your first Console Application 162


Ring Documentation, Release 1.7

To run the program click on “Debug (Run then wait!)” button from the toolbar

The next screen shot present the application during the runtime
Press Enter to continue and return to the Ring Notepad.

16.2. Creating and running your first Console Application 163


Ring Documentation, Release 1.7

16.3 Creating and running your first GUI/Mobile Application

To learn how to create GUI applications using Ring check the “Desktop and Mobile development using RingQt”
chapter.
Source Code:
Load "guilib.ring"

New qApp {
new qWidget() {
resize(400,400)
setWindowTitle("Hello, World!")
show()
}
exec()
}

In Ring notepad we have a special button to run GUI applications without displaying the console window.

16.3. Creating and running your first GUI/Mobile Application 164


Ring Documentation, Release 1.7

The next screen shot present the application during the runtime

16.4 Creating and running your first Web Application

To learn how support Ring in your web server and how to create web applications using Ring check the “Web Devel-
opment (CGI Library)” chapter.

Note: You need to support the Ring language in your web server to be able to run the next example.

Source Code:

16.4. Creating and running your first Web Application 165


Ring Documentation, Release 1.7

#!b:\ring\bin\ring.exe -cgi

load "weblib.ring"

Import System.Web

new page {

text("Hello, World!")

We can run the application in any web browser or in the browser that are embedded in Ring Notepad.

For Windows users, Ring 1.6 comes with Apache Web server!
We can run any web application from any folder directly without doing any configuration.

16.4. Creating and running your first Web Application 166


Ring Documentation, Release 1.7

16.5 Creating and running your first Desktop/Mobile Game

To learn about creating 2D Games using Ring check the “Demo Project - Game Engine for 2D Games” chapter.
Source Code:
Load "gameengine.ring"

func main

oGame = New Game


{
title = "My First Game"
sprite
{
type = GE_TYPE_PLAYER
x=400 y=400 width=100 height=100
file = "images/player.png"
transparent = true
Animate=false
Move=true
Scaled=true
}
}

We can run the application as any GUI application.

16.5. Creating and running your first Desktop/Mobile Game 167


Ring Documentation, Release 1.7

16.6 The Main File in the Project

The idea of the Main File ToolBar is to determine the main file in the project When the project contains many source
code files
Using this feature we can run the project (Main File) at any time while opening other files in the project without the
need to switch to the Main File to run the project.
To quickly use this feature
(Open the project main file)
Press Ctrl+Shift+M to set the current source code file as the main file
Open and modify other source code files in the project
To run the project (Main File) at any time press Ctrl+Shift+F5 (GUI) or Ctrl+Shift+D (Console)
Screen Shots:

16.6. The Main File in the Project 168


Ring Documentation, Release 1.7

16.7 The File Menu

From this menu we can create, open and save the source code files.
Another feature in this menu is “Print to PDF”

16.8 The Edit Menu

From the Edit menu we can Cut, Copy and Paste text.
Also we can change the font and the colors.
We can Go to a specific line or use the Find and Replace window to find and replace text.
Also We can set the Tab Width (Number of Spaces)

16.7. The File Menu 169


Ring Documentation, Release 1.7

16.9 The View Menu

From this menu we can show/hide the dockable windows


Also we can change the Style of the Ring Notepad
Common Styles are (Fusion White and Modern Black)

16.9. The View Menu 170


Ring Documentation, Release 1.7

Also we can quickly show/hide group of dockable windows based on the context

16.9. The View Menu 171

You might also like