To run this, you need to have LÖVE installed in your machine, and then run this command <code>fennel --compile love_test.fnl > main.lua; love .</code>. Since LÖVE has no compatibility with Fennel, we need to AOT-compile the file to a Lua file called <code>main.lua</code>, so then LÖVE can execute the program.
Works with: as version Raspberry Pi 3B version Buster 64 bits
<lang AArch64 Assembly>
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program disMessGraph64.s */
/* link with gcc options -lX11 -L/usr/lpp/X11/lib */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
.equ ClientMessage, 33
stp x20,lr,[sp,-16]! // save registers
mov x20,x0 // save display address
mov x2,#0
mov x3,#0
bl XCreateGC
cbz x0,99f
mov x26,x0 // save GC
mov x0,x20 // display address
mov x1,x26
ldr x2,qRed // code RGB color
bl XSetForeground
cbz x0,99f
mov x0,x26 // return GC
b 100f
99:
ldr x0,qAdrszMessErrGC
bl affichageMess
mov x0,0
100:
ldp x20,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
qAdrszMessErrGC: .quad szMessErrGC
qRed: .quad 0xFF0000
qGreen: .quad 0xFF00
qBlue: .quad 0xFF
qBlack: .quad 0x0
/******************************************************************/
/* display text on screen */
/******************************************************************/
/* x0 contains the address of text */
displayText:
stp x1,lr,[sp,-16]! // save registers
mov x5,x0 // text address
mov x6,0 // text size
1: // loop compute text size
ldrb w10,[x5,x6] // load text byte
cbz x10,2f // zero -> end
add x6,x6,1 // increment size
b 1b // and loop
2:
mov x0,x28 // display address
mov x1,x27 // ident window
mov x2,x26 // GC address
mov x3,#50 // position x
mov x4,#100 // position y
bl XDrawString
100:
ldp x1,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
<lang ada>with Gdk.Event; use Gdk.Event;
with Gtk.Label; use Gtk.Label;
with Gtk.Window; use Gtk.Window;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Handlers;
with Gtk.Main;
procedure Windowed_Goodbye_World is
Window : Gtk_Window;
Label : Gtk_Label;
package Handlers is new Gtk.Handlers.Callback (Gtk_Widget_Record);
package Return_Handlers is
new Gtk.Handlers.Return_Callback (Gtk_Widget_Record, Boolean);
function Delete_Event (Widget : access Gtk_Widget_Record'Class)
return Boolean is
begin
return False;
end Delete_Event;
procedure Destroy (Widget : access Gtk_Widget_Record'Class) is
begin
Gtk.Main.Main_Quit;
end Destroy;
This solution requires no code blocks as the text is entered directly into the Title properties TextBox of the Designer. VIEW THE DESIGNER
Three blocks solution
This solution uses three blocks to assign the text to the Title bar:
Screen1.Initialize and
set Screen1.Title to "Goodbye World!" VIEW THE BLOCKS AND ANDROID APP SCREEN
<lang Applesoft BASIC> 1 LET T$ = "GOODBYE, WORLD!"
2 LET R = 5:GX = 3:GY = 2:O = 3:XC = R + GX:YC = R * 2 + GY
3 TEXT : HOME : TEXT : HGR : HCOLOR= 7: HPLOT 0,0: CALL 62454: HCOLOR= 6
4 LET L = LEN (T$): FOR I = 1 TO L:K = ASC ( MID$ (T$,I,1)):XO = XC:YO = YC: GOSUB 5:XC = XO + 1:YC = YO: GOSUB 7: NEXT : END
5 IF K > 64 THEN K = K + LC: GOSUB 20:LC = 32: RETURN
6 LET LC = 0: ON K > = 32 GOTO 20: RETURN
7 GOSUB 20:XC = XC + R * 2 + GX: IF XC > 279 - R THEN XC = R + GX:YC = YC + GY + R * 5
8 RETURN
9 LET XC = XC - R * 2: RETURN
10 LET Y = R:D = 1 - R:X = 0
11 IF D > = 0 THEN Y = Y - 1:D = D - Y * 2
12 LET D = D + X * 2 + 3
13 IF O = 1 OR O = 3 THEN GOSUB 17
14 IF O = 2 OR O = 3 THEN GOSUB 19
15 LET X = X + 1: IF X < Y THEN 11
16 LET O = 3:E = 0: RETURN
17 HPLOT XC - X,YC + Y: HPLOT XC + X,YC + Y: HPLOT XC - Y,YC + X: IF NOT E THEN HPLOT XC + Y,YC + X
18 RETURN
19 HPLOT XC - X,YC - Y: HPLOT XC + X,YC - Y: HPLOT XC - Y,YC - X: HPLOT XC + Y,YC - X: RETURN
20 LET M = K - 31
21 ON M GOTO 32,33,34,35,36,37,38,39,40,41,42,43,44
22 LET M = M - 32
23 ON M GOTO 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87
24 LET M = M - 32
25 ON M GOTO 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,10,112,113,114,115,116,117,118,119,120,121
32 RETURN
33 HPLOT XC - R,YC - R * 2 TO XC - R,YC + R - GY: HPLOT XC - R,YC + R: GOTO 9: REM !
44 HPLOT XC - R,YC + R + R / 2 TO XC - R,YC + R: GOTO 9: REM ,
71 LET O = 2:YC = YC - R: GOSUB 10:YC = YC + R: HPLOT XC - R,YC TO XC - R,YC - R: HPLOT XC + R / 2,YC TO XC + R,YC TO XC + R,YC + R:O = 1: GOTO 10: REM G
87 HPLOT XC - R,YC - R * 2 TO XC - R,YC + R TO XC,YC TO XC + R,YC + R TO XC + R,YC - R * 2: RETURN : REM W
98 HPLOT XC - R,YC - R * 2 TO XC - R,YC + R: GOTO 10: RETURN : REM B
100 HPLOT XC + R,YC - R * 2 TO XC + R,YC + R: GOTO 10: REM D
101 HPLOT XC - R,YC TO XC + R,YC:E = 1: GOTO 10: REM E
108 HPLOT XC - R,YC - R * 2 TO XC - R,YC + R: GOTO 9: REM L
114 HPLOT XC - R,YC - R TO XC - R,YC + R:O = 2: GOTO 10: REM R
121 HPLOT XC - R,YC - R TO XC,YC + R: HPLOT XC + R,YC - R TO XC - R,YC + R * 3: RETURN : REM Y</lang>
$hGUI = GUICreate("Hello World") ; Create the main GUI
GUICtrlCreateLabel("Goodbye, World!", -1, -1) ; Create a label dispalying "Goodbye, World!"
GUISetState() ; Make the GUI visible
While 1 ; Infinite GUI loop
$nMsg = GUIGetMsg() ; Get any messages from the GUI
Switch $nMsg ; Switch for a certain event
Case $GUI_EVENT_CLOSE ; When an user closes the windows
Exit ; Exit
<lang freebasic>' Demonstrate a simple Windows application using FreeBasic
include once "windows.bi"
Declare Function WinMain(ByVal hInst As HINSTANCE, _
ByVal hPrev As HINSTANCE, _
ByVal szCmdLine as String, _
ByVal iCmdShow As Integer) As Integer
End WinMain( GetModuleHandle( null ), null, Command( ), SW_NORMAL )
Function WinMain (ByVal hInst As HINSTANCE, _
ByVal hPrev As HINSTANCE, _
ByVal szCmdLine As String, _
ByVal iCmdShow As Integer) As Integer
MessageBox(NULL, "Goodbye World", "Goodbye World", MB_ICONINFORMATION)
function = 0
End Function</lang>
<lang freebasic>' Demonstrate a simple Windows/Linux application using GTK/FreeBasic
From Window 7 and later, pure Batch File does not completely provide GUI. However, MSHTA.EXE provides command-line JavaScript/VBScript access.
<lang dos>@echo off
Output to message box [Does not work in Window 7 and later]
Beads specializes in graphical design and can use draw_str for html in the browser or alerts for popup boxes.
<lang Beads>beads 1 program 'Goodbye World'
calc main_init
alert('Goodbye, World!')
Using the graphics library included with Turbo C. The BGI driver and the font must be in the same directory as the program (EGAVGA.BGI and SANS.CHR). Compile with tcc hellobgi.c graphics.lib.
<lang c>#include <conio.h>
include <graphics.h>
int main(void) {
int Driver = DETECT, Mode;
int MaxX, MaxY, X, Y;
char Message[] = "Hello, World!";
initgraph(&Driver, &Mode, "");
MaxX = getmaxx();
MaxY = getmaxy();
settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 7);
X = (MaxX - textwidth(Message)) >> 1;
Y = (MaxY - textheight(Message)) >> 1;
outtextxy(X, Y, Message);
Where pWnd is a pointer to a CWnd object corresponding to a valid window in the application.
<lang cpp>#include "afx.h"
void ShowGoodbyeWorld(CWnd* pWnd)
{
To configure the "Graphical screen"
<lang Basic Casio>ViewWindow 1,127,1,1,63,1
AxesOff
CoordOff
GridOff
LabelOff</lang>
ViewWindow parameters depend on the calculator resolution (These are the most common).
To print text on the "Graphical screen" of the calculator:
<lang Basic Casio>Text 1,1,"Goodbye, World!"
ClrGraph</lang>
METHOD-ID Main STATIC.
PROCEDURE DIVISION.
INVOKE TYPE Application::EnableVisualStyles() *> Optional
INVOKE TYPE MessageBox::Show("Goodbye, World!")
END METHOD.
END CLASS.</lang>
environment division.
configuration section.
repository.
function new-window
function new-box
function new-label
function gtk-go
function all intrinsic.
data division.
working-storage section.
01 TOPLEVEL usage binary-long value 0.
01 HORIZONTAL usage binary-long value 0.
01 VERTICAL usage binary-long value 1.
01 width-hint usage binary-long value 160.
01 height-hint usage binary-long value 16.
01 spacing usage binary-long value 8.
01 homogeneous usage binary-long value 0.
*> Main window and top level container
move new-window("Hello", TOPLEVEL, width-hint, height-hint)
to gtk-window-data
move new-box(gtk-window, VERTICAL, spacing, homogeneous)
to gtk-container-data
*> Box, across, with simple label
move new-box(gtk-container, HORIZONTAL, spacing, homogeneous)
to gtk-box-data
move new-label(gtk-box, "Goodbye, World!") to gtk-label-data
*> GTK+ event loop now takes over
move gtk-go(gtk-window) to extraneous
There are no text drawing routines in BASIC that apply to the high resolution bitmap mode on the Commodore 64. Therefore, it is necessary to either draw letterforms from designs stored in RAM, or copy the font contained in ROM. It should be noted that using BASIC to handle high resolution graphics is a slow process, and the same tasks are much more efficiently accomplished in assembly language/machine code.
This example will iterate through the string and copy the appropriate bitmap information from the Character ROM. In line 425 a conversion must take place since strings are stored in memory as bytes of ASCII (PETSCII) codes, however, the Character ROM is stored in order of the screen codes as found in Appendix B of the Commodore 64 Programmer's Reference Guide... And even then the conversion given will work only for a limited set of the Character ROM. This could be remedied if the Character ROM (or some other font definition) was copied to RAM and indexed in ASCII/PETSCII order.
The POKE statements encapsulating the text drawing routine (lines 410-415 and 450-455) are necessary to make the Character ROM visible to BASIC without crashing the operating system. As such, keyboard scanning must be suspended during this time, preventing the routine from any user interruption until it is finished.
<lang CommodoreBASICv2>
1 rem hello world on graphics screen
2 rem commodore 64 version
10 print chr$(147): print " press c to clear bitmap area,"
15 print " any other key to continue"
20 get k$:if k$="" then 20
25 if k$<>"c" then goto 40
40 print chr$(147);
45 poke 53272,peek(53272) or 8:rem set bitmap memory at 8192 ($2000)
50 poke 53265,peek(53265) or 32:rem enter bitmap mode
55 rem write text to graphics at tx,ty
60 t$="goodbye, world!":tx=10:ty=10
65 gosub 400
70 rem draw sine wave - prove we are in hi-res mode
75 for x=0 to 319:y=int(50*sin(x/10))+100:gosub 500:next
80 rem wait for keypress
85 get k$:if k$="" then 85
90 rem back to text mode, restore colors, end program
95 poke 53265,peek(53265) and 223:poke 53272,peek(53272) and 247
100 poke 53280,14:poke 53281,6:poke 646,14
200 end
400 rem write text to graphics routine
405 tx=tx+(40*ty):m=base+(tx*8)
410 poke 56334,peek(56334) and 254 : rem turn off keyscan
415 poke 1,peek(1) and 251 : rem switch in chargen rom
420 for i=1 to len(t$)
425 l=asc(mid$(t$,i,1))-64:if l<0 then l=l+64
430 for b=0 to 7
435 poke m,peek(53248+(l*8)+b)
440 m=m+1
445 next b, i
450 poke 1,peek(1) or 4 : rem switch in io
455 poke 56334,peek(56334) or 1 : rem restart keyscan
460 return
500 rem plot a single pixel at x,y
510 mem=base+int(y/8)*320+int(x/8)*8+(y and 7)
520 px=7-(x and 7)
530 poke mem,peek(mem) or 2^px
540 return
</lang>
(let ((w (bounding-rectangle-width pane))
(h (bounding-rectangle-height pane)))
;; Blank the pane out
(draw-rectangle* pane 0 0 w h
:filled t
:ink (pane-background pane))
;; Draw greeting in center of pane
(draw-text* pane
(greeting *application-frame*)
(floor w 2) (floor h 2)
:align-x :center
:align-y :center)))
A still bare bones but much better looking example that displays a white screen with the text centered
<lang javascript>import 'package:flutter/material.dart';
To differentiate only a GUI message use the display_ verb.
<lang diego>display_me()_msg(Goodbye, World!);</lang>
However, using the _msg</code (short for 'message') action will send a string message to the callee who may decide to display the string graphically...
<lang diego>me_msg(Goodbye, World!);</lang>
Allows entry of any name into a text field (using "World" as the default entry). Then, when the "Say Goodbye" button is pressed, sets a text label to the value "Goodbye, <name>!".
<lang egl>
import org.eclipse.edt.rui.widgets.*;
import dojo.widgets.*;
handler HelloWorld type RUIhandler{initialUI =[ui]}
</lang>
To run this, you need to have LÖVE installed in your machine, and then run this command fennel --compile love_test.fnl > main.lua; love .. Since LÖVE has no compatibility with Fennel, we need to AOT-compile the file to a Lua file called main.lua, so then LÖVE can execute the program.
This brings up an infinitely-rescalable graphic window containing "Goodbye, World" drawn graphically.
All Frink graphics can be written to arbitrary coordinates; Frink will automatically scale and center any drawn graphics to be visible in the window (greatly simplifying programming,) so the exact coordinates used below are rather arbitrary. (This means that if you wrote "Hello World" instead of "Goodbye, World", you could just change that string and everything would still center perfectly.)
The graphics are infinitely-scalable and can be rendered at full quality to any resolution. This program "shows off" by rotating the text by 10 degrees, and also rendering it to a printer (which can include tiling across multiple pages) and rendering to a graphics file. (Frink can automatically render the same graphics object to many image formats, including PNG, JPG, SVG, HTML5 canvas, animated GIF, bitmapped image in memory, and more.)
<lang frink>
g = new graphics
g.font["SansSerif", 10]
g.text["Goodbye, World!", 0, 0, 10 degrees]
g.show[]
g.print[] // Optional: render to printer
g.write["GoodbyeWorld.png", 400, 300] // Optional: write to graphics file
</lang>
# -- automatically called when the dialog is created
method component_setup ()
# add 'hello world' label
label := Label("label=Hello world","pos=0,0")
add (label)
# make sure we respond to close event
connect(self, "dispose", CLOSE_BUTTON_EVENT)
end
With an alert box:
<lang HPPPL>MSGBOX("Goodbye, World!");</lang>
By drawing directly to the screen:
<lang HPPPL>RECT();
TEXTOUT_P("Goodbye, World!", GROBW_P(G0)/4, GROBH_P(G0)/4, 7);
WAIT(-1);</lang>
<lang basic>
10 REM FONT DERIVED FROM 04B-09 BY YUJI OSHIMOTO
20 GR
30 COLOR = 12
40 REM G
50 HLIN 0,5 AT 0 : HLIN 0,5 AT 1
60 VLIN 2,9 AT 0 : VLIN 2,9 AT 1
70 HLIN 2,5 AT 9 : HLIN 2,5 AT 8
80 VLIN 4,7 AT 5 : VLIN 4,7 AT 4
90 VLIN 4,5 AT 3
100 REM O
110 HLIN 7,12 AT 2 : HLIN 7,12 AT 3
120 HLIN 7,12 AT 8 : HLIN 7,12 AT 9
130 VLIN 4,7 AT 7 : VLIN 4,7 AT 8
140 VLIN 4,7 AT 11 : VLIN 4,7 AT 12
150 REM O
160 HLIN 14,19 AT 2 : HLIN 14,19 AT 3
170 HLIN 14,19 AT 8 : HLIN 14,19 AT 9
180 VLIN 4,7 AT 14 : VLIN 4,7 AT 15
190 VLIN 4,7 AT 18 : VLIN 4,7 AT 19
200 REM D
210 HLIN 21,24 AT 2 : HLIN 21,24 AT 3
220 HLIN 21,26 AT 8 : HLIN 21,26 AT 9
230 VLIN 4,7 AT 21 : VLIN 4,7 AT 22
240 VLIN 0,7 AT 25 : VLIN 0,7 AT 26
250 REM -
260 HLIN 28,33 AT 4 : HLIN 28,33 AT 5
270 REM B
280 VLIN 11,20 AT 0 : VLIN 11,20 AT 1
290 HLIN 2,5 AT 20 : HLIN 2,5 AT 19
300 VLIN 15,18 AT 5 : VLIN 15,18 AT 4
310 HLIN 2,5 AT 14 : HLIN 2,5 AT 13
320 REM Y
330 VLIN 13,20 AT 7 : VLIN 13,20 AT 8
340 VLIN 19,20 AT 9 : VLIN 19,20 AT 10
350 VLIN 13,24 AT 11 : VLIN 13,24 AT 12
360 VLIN 23,24 AT 10 : VLIN 23,24 AT 9
370 REM E
380 VLIN 13,20 AT 14 : VLIN 13,20 AT 15
390 HLIN 16,19 AT 13 : HLIN 16,19 AT 14
400 HLIN 18,19 AT 15 : HLIN 18,19 AT 16
410 HLIN 16,17 AT 17 : HLIN 16,17 AT 18
420 HLIN 16,19 AT 19 : HLIN 16,19 AT 20
430 REM ,
440 VLIN 17,22 AT 21 : VLIN 17,22 AT 22
450 REM W
460 VLIN 24,33 AT 0 : VLIN 24,33 AT 1 : VLIN 24,33 AT 3
470 VLIN 24,33 AT 4 : VLIN 24,33 AT 6 : VLIN 24,33 AT 7
480 HLIN 0,7 AT 33 : HLIN 0,7 AT 32
490 REM O
500 HLIN 9,14 AT 26 : HLIN 9,14 AT 27
510 HLIN 9,14 AT 32 : HLIN 9,14 AT 33
520 VLIN 28,31 AT 9 : VLIN 28,31 AT 10
530 VLIN 28,31 AT 13 : VLIN 28,31 AT 14
540 REM R
550 HLIN 16,21 AT 26 : HLIN 16,21 AT 27
560 VLIN 28,33 AT 16 : VLIN 28,33 AT 17
570 REM L
580 VLIN 24,33 AT 23 : VLIN 24,33 AT 24
590 REM D
600 HLIN 26,29 AT 26 : HLIN 26,29 AT 27
610 HLIN 26,29 AT 32 : HLIN 26,29 AT 33
620 VLIN 28,33 AT 26 : VLIN 28,33 AT 27
630 VLIN 24,33 AT 30 : VLIN 24,33 AT 31
640 REM !
650 VLIN 24,29 AT 33 : VLIN 24,29 AT 34
660 VLIN 32,33 AT 33 : VLIN 32,33 AT 34
670 END
</lang>
SwingUtilities.invokeLater(new Runnable(){
public void run() {
JOptionPane.showMessageDialog (null, "Goodbye, World!"); // in alert box
JFrame frame = new JFrame("Goodbye, World!"); // on title bar
JTextArea text = new JTextArea("Goodbye, World!"); // in editable area
JButton button = new JButton("Goodbye, World!"); // on button
In the following, which generates SVG in a way that can be readily viewed using a web browser, the "Goodbye, World!" text is shaded using a linear gradient.
The approach used here to generate SVG is based on these principles:
a JSON object is used to specify CSS styles
this makes it easy to combine default specifications with partial specifications, because in jq, for JSON objects, "+" is defined so that (default + partial) is the combination which gives precedence to the right-hand-side operand;
for other defaults, the jq "//" operator can be used; thus all SVG parameters can be easily given defaults.
Part 1: Generic SVG-related functions
<lang jq># Convert a JSON object to a string suitable for use as a CSS style value
e.g: "font-size: 40px; text-align: center;" (without the quotation marks)
def to_s:
reduce to_entries[] as $pair (""; . + "\($pair.key): \($pair.value); ");
"style" should be a JSON object (see for example the default ($dstyle));
the style actually used is (default + style), i.e. whatever is specified in "style" wins.
Defaults:
x: 0
y: 0
def text(x; y; style):
. as $in
| {"font-size": "40px", "text-align": "center", "text-anchor": "left", "fill": "black"} as $dstyle
| (($dstyle + style) | to_s) as $style
| "<text x='\(x//0)' y='\(y//0)' style='\($style)'>
\(.)",
"</text>";</lang>
Part 2: "Goodbye, World!"
<lang jq>def task:
svg(null;null), # use the defaults
linearGradient("gradient"; "rgb(255,255,0)"; "rgb(255,0,0)"), # define "gradient"
("Goodbye, World!" | text(10; 50; {"fill": "url(#gradient)"})), # notice how the default for "fill" is overridden
"</svg>";
/* Terminate on close */
void windDown(AG_Event *event) {
AG_Terminate(0);
}
function alert(msg:string):void { // Display a JsiAgar windowed message
/* Native C code block (in a JSI function wrapper) */
AG_Window *win;
AG_Box *box;
And a window pops up with the message and an Ok button.
First command jsish -c runs a JSI to C preprocessor, generating a .h C source file.
For the second step, gcc is called with the output of a jsish -c -cflags true query, libagar runtime is linked in with more substitution for Agar compiler commands. The query output will be something like (this is site local, details will change per machine setup):
This image is a VI Snippet, an executable image of LabVIEW code. The LabVIEW version is shown on the top-right hand corner. You can download it, then drag-and-drop it onto the LabVIEW block diagram from a file browser, and it will appear as runnable, editable code.
Works in HyperCard and other xTalk environments
<lang HyperTalk> answer "Goodbye, World!"</lang>
A dialog box can be modified as appropriate for the context by setting a "iconType", button text and title
<lang LiveCode>answer warning "Goodbye, World!" with "Goodbye, World!" titled "Goodbye, World!"</lang>
Among the turtle commands are some commands for drawing text in the graphical area. Details and capabilities differ among Logo implementations.
<lang logo>LABEL [Hello, World!]
SETLABELHEIGHT 2 * last LABELSIZE
LABEL [Goodbye, World!]</lang>
To actually run this LÖVE-program, the following code
needs to be in a file main.lua, in its own folder.
This folder usually also contains other resources for a game,
such as pictures, sound, music, other source-files, etc.
To run the program, on windows,
drag that folder onto either love.exe
or a shortcut to love.exe.
A window with a click event to open a message box, and print returned number to window form, scrolling at the lower part of form's layer.
<lang M2000 Interpreter>
Module CheckIt {
Declare Simple Form
\\ we can define form before open
Layer Simple {
\\ center Window with 12pt font, 12000 twips width and 6000 twips height
\\ ; at the end command to center the form in current screen
Window 12, 12000, 6000;
\\ make layer gray and split screen 0
Cls #333333, 0
\\ set split screen to 3rd line, like Cls ,2 without clear screen
Scroll Split 2
Cursor 0, 2
}
With Simple, "Title", "Hello Form"
Function Simple.Click {
Layer Simple {
\\ open msgbox
Print Ask("Hello World")
Refresh
}
}
\\ now open as modal
Method Simple, "Show", 1
\\ now form deleted
Declare Simple Nothing
}
CheckIt
</lang>
A simple Window only
<lang M2000 Interpreter>
Module CheckIt {
Declare Simple Form
With Simple, "Title", "Hello World"
Method Simple, "Show", 1
Declare Simple Nothing
Whether the output is graphical or text depends largely the compiler with which the /.ROFF/ source code below is compiled.
If it is compiled with an Nroff compiler, its output is comparable to that of a typewriter. Therefore, output from Nroff is typically seen on a text terminal. If it is compiled with a Troff compiler, its output is comparable to that of a typesetter. Therefore, output from Troff is typically seen on a PostScript or PDF output using a document viewer. Furthermore, output from Troff is also usually seen on paper, so that may count as graphical as well.
In conclusion, although the code is compatible with both Nroff and Troff, it should be compiled using Troff to guarantee graphical output.
Because /.ROFF/ is a document formatting language in and of itself, it is extremely likely that a user of /.ROFF/ will be typing mostly textual content in a natural language. Therefore, there are no special routines or procedures to be called to output normal text, as all text will get formatted onto paper automatically.
int rc;
rc = AG_EventLoop();
return alloc_int(rc);
}
DEFINE_PRIM(agar_eventloop, 0);</lang>
The C file above is used to create a Neko friendly Dynamic Shared Object file, nekoagar.ndll.
The DSO functions are then loaded and exposed to Neko.
The Neko program follows:
<lang ActionScript>/**
<doc>
Hello world, graphical, in Neko, via Agar label
Tectonics:
gcc -shared -fPIC -o nekoagar.ndll rosetta-nekoagar.c `agar-config --cflags --libs`
nekoc hello-graphical.neko
neko hello-graphical
</doc>
/
/* Load some libagar bindings http://www.libagar.org/mdoc.cgi?man=AG_Intro.3 */
var agar_init = $loader.loadprim("nekoagar@agar_init", 3);
var agar_window = $loader.loadprim("nekoagar@agar_window", 1);
var agar_window_show = $loader.loadprim("nekoagar@agar_window_show", 1);
var agar_box = $loader.loadprim("nekoagar@agar_box", 3);
var agar_label = $loader.loadprim("nekoagar@agar_label", 3);
var agar_eventloop = $loader.loadprim("nekoagar@agar_eventloop", 0);
/* Init with driver; NULL for best choice on current system */
try {
var rc = agar_init("nekoagar", 0, val_null);
if $not(rc) $throw("Error: agar_init non zero");
} catch e {
$throw("Error: agar_init exception");
}
/* Put up a window, with a box, and a label in the box */
var w = agar_window(0);
var box = agar_box(w, 1, 0);
var label = agar_label(box, 0, "Goodbye, World!");
agar_window_show(w);
method RCHelloWorld_GraphicalAWT_01(frame = Frame, msg = String) public
this(frame, msg, isFalse)
return
method addOKCancelPanel(canaction = boolean)
setButtonPanel(Panel())
getButtonPanel.setLayout(FlowLayout())
createOKButton()
if canaction then do
createCancelButton()
end
add(BorderLayout.SOUTH, getButtonPanel)
return
dim = getToolkit().getScreenSize
setLocation(int(dim.width / 3), int(dim.height / 3))
return
method actionPerformed(ae = ActionEvent) public
if ae.getSource == getOkButton then do
setOk(isTrue)
setCan(isFalse)
setVisible(isFalse)
end
else if ae.getSource == getCanButton then do
setCan(isTrue)
setOk(isFalse)
setVisible(isFalse)
end
return
method main(args = String[]) public constant
mainFrame = Frame()
mainFrame.setSize(200, 200)
mainFrame.setVisible(isTrue)
message = RCHelloWorld_GraphicalAWT_01(mainFrame, msgText, isTrue)
if message.isOk then
say 'OK pressed'
if message.isCan then
say 'Cancel pressed'
message.dispose
mainFrame.dispose
return
NewLISP uses a lightweight Java GUI server that it communicates with over a pipe, similar how some languages use Tcl/Tk. This takes advantage of Java's cross platform GUI capability.
let window = GWindow.window in
let _ = window#set_title "Goodbye, World" in
let _ = window#event#connect#delete ~callback:delete_event in
let _ = window#connect#destroy ~callback:destroy in
let _ = window#show () in
GMain.Main.main ()
Just output as a label in a window:
<lang ocaml>let () =
let main_widget = Tk.openTk () in
let lbl = Label.create ~text:"Goodbye, World" main_widget in
Tk.pack [lbl];
Tk.mainLoop();;</lang>
Output as text on a button that exits the current application:
<lang ocaml>let () =
let action () = exit 0 in
let main_widget = Tk.openTk () in
let bouton_press =
Button.create main_widget ~text:"Goodbye, World" ~command:action in
Tk.pack [bouton_press];
Tk.mainLoop();;</lang>
Requires a Glade GUI description file. 'ere be one I produced earlier:
<lang xml>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.24.dtd">
</glade-interface>
</lang>
And finally the Oxygene:
<lang oxygene>
// Display a Message in a GUI Window
//
// Nigel Galloway, April 18th., 2012.
//
namespace HelloWorldGUI;
interface
uses
Glade, Gtk, System;
type
Program = public static class
public
class method Main(args: array of String);
end;
MainForm = class(System.Object)
private
var
[Widget] hworld: Gtk.Window;
public
constructor(args: array of String);
method on_hworld_delete_event(aSender: Object; args: DeleteEventArgs);
end;
implementation
class method Program.Main(args: array of String);
begin
new MainForm(args);
end;
constructor MainForm(args: array of String);
begin
inherited constructor;
Application.Init();
with myG := new Glade.XML(nil, 'HelloWorldGUI.Main.glade', 'hworld', nil) do myG.Autoconnect(self);
Application.Run();
end;
method MainForm.on_hworld_delete_event(aSender: Object; args: DeleteEventArgs);
begin
You can run this online here. A few improvements are probably warranted, as in changes to pGUI.js and/or pGUI.css, but at least the language/transpiler side of things is pretty much complete.
// while loop
enquanto (verdadeiro) {
// define color to black(preto) and clear window
g.definir_cor(g.COR_PRETO)
g.limpar()
// define color to white(branco)
g.definir_cor(g.COR_BRANCO)
// set text font size
g.definir_tamanho_texto(32.0)
// draws text
g.desenhar_texto(0, HEIGHT / 3, "Hello, world!")
In the general Postscript context, the show command will render the string that is topmost on the stack at the currentpoint in the previously setfont. Thus a minimal PostScript file that will print on a PostScript printer or previewer might look like this:
<lang postscript>%!PS
% render in Helvetica, 12pt:
/Helvetica findfont 12 scalefont setfont
% somewhere in the lower left-hand corner:
50 dup moveto
% render text
(Goodbye, World!) show
% wrap up page display:
showpage</lang>
While there is no easy (intuitive) way to print a comma (or semicolon) this pd script will do.
When writing messages to the terminal window, Pd prepends the name of the print object and a colon, or "print: " if no name is specified, which can be avoided by using "-n" instead of a name. This behaviour, however, has not been adopted by Pd-extended :-(
<lang PureBasic>MessageRequester("Hello","Goodbye, World!")</lang>
Using the Windows API:
<lang PureBasic>MessageBox_(#Null,"Goodbye, World!","Hello")</lang>
L1 = label(pos=(0,-1.5,0), text='Drag with right mousebutton to rotate view', box=0)
L2 = label(pos=(0,-1.9,0), text='Drag up+down with middle mousebutton to zoom', box=0)
L3 = label(pos=(0,-2.3,0), text='Left-click to change', color=color.orange, box=0)
print "Hello World" # Console
cCount = 0
def change():
global rot, cCount
cCount=cCount+1
print "change:", cCount
rot=-rot
if T1.visible:
T1.visible=False
T2.visible=True
else:
T1.visible=True
T2.visible=False
<lang python>
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivy.uix.label import Label
and it creates two windows, the first (main) window contains the Goodbye, World! text,
the other "help" window contains a message about how to close the windows.
<lang rexx>/*REXX program shows a "hello world" window (and another to show how to close)*/
parse upper version !ver .; !pcrexx= !ver=='REXX/PERSONAL' | !ver=='REXX/PC'
if ¬!pcrexx then call ser "This isn't PC/REXX" /*this isn't PC/REXX ? */
rxWin=fcnPkg('rxwindow') /*is the function around?*/
if rxWin¬==1 then do 1; 'RXWINDOW /q'
if fcnPkg('rxwindow')==1 then leave /*the function is OK.*/
say 'error loading RXWINDOW !'; exit 13
end
def top = new MainFrame {
title = "Goodbye, World!"
contents = new FlowPanel {
contents += new Button ("Goodbye, World!")
contents += new TextArea("Goodbye, World!")
}
}
<lang ScratchScript>pos -100 70
print "Goodbye, World!"</lang>
This example waits until the mouse is clicked for the program to end. This can be useful if the program executes too fast for "Hello world!" to be visible on the screen long enough for it to be comfortable.
<lang ScratchScript>pos -100 70
print "Goodbye, World!"
delayOnClick</lang>
Seed7 does not work with an event handling function like gtk_main().
The progam stays in control and does not depend on callbacks.
The graphic library manages redraw, keyboard and mouse events.
The contents of a window are automatically restored when it is
uncovered. It is possible to copy areas from a window even when
the area is currently covered or off screen.
<lang seed7>$ include "seed7_05.s7i";
include "draw.s7i";
include "keybd.s7i";
include "bitmapfont.s7i";
include "stdfont24.s7i";
include "pixmap_file.s7i";
const proc: main is func
local
var text: screen is STD_NULL;
begin
screen(400, 100);
clear(curr_win, white);
KEYBOARD := GRAPH_KEYBOARD;
screen := openPixmapFontFile(curr_win);
color(screen, black, white);
setFont(screen, stdFont24);
setPosXY(screen, 68, 60);
write(screen, "Goodbye, World");
ignore(getc(KEYBOARD));
end func;</lang>
Ok, I know this is cheating. But it isn't completely cheating: the SSEM uses Williams tube storage, so the memory is basically a CRT device; and this is an executable program, up to a point, because the first line includes a 111 Stop instruction (disguised as a little flourish joining the tops of the d and the b).
<lang ssem>01100000000001110000000000000000
10000000000001010000000000000000
10011101110111011101010111000000
10010101010101010101010101000000
10010101010101010101010111000000
10011101110111011100110100000010
10000000000000000000010011000010
10011000000000000000100000000100
01101000000000000001000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00100100100000000010000100100000
00100100100000000010000100100000
00100100101110111010011100100000
00100100101010100010010100100000
00100100101010100010010100000000
00100100101110100011011100100000
00011011000000000000000000000000</lang>
Once you've keyed it in, the first eighteen words of storage will look a bit like this:
oo ooo
o o o
o ooo ooo ooo ooo o o ooo
o o o o o o o o o o o o o
o o o o o o o o o o o ooo
o ooo ooo ooo ooo oo o o
o o oo o
o oo o o
oo o o
o o o o o o
o o o o o o
o o o ooo ooo o ooo o
o o o o o o o o o o
o o o o o o o o o
o o o ooo o oo ooo o
oo oo
Just output as a label in a window:
<lang tcl>pack [label .l -text "Goodbye, World"]</lang>
Output as text on a button that exits the current application:
<lang tcl>pack [button .b -text "Goodbye, World" -command exit]</lang>
Note: If you name this program "button.tcl", you might get strange errors.
Don't use the name of any internal tcl/tk-command as a filename for a tcl-script.
This shows our text in a message box:
<lang tcl>tk_messageBox -message "Goodbye, World"</lang>
Using the simple dialog command xmessage, which uses the X11 Athena Widget library
<lang bash>
xmessage 'Goodbye, World!'
</lang>
Using the zenity modal dialogue command (wraps GTK library) available with many distributions of Linux
<lang bash>
zenity --info --text='Goodbye, World!'
</lang>
Using yad (a fork of zenity with many more advanced options)
<lang bash>
yad --title='Farewell' --text='Goodbye, World!'
</lang>
The following code is altered from the TheIDE example page. It displays a blank GUI with a menu. Click on about from the menu and the goodbye world prompt appears.
<lang Cpp>
include <CtrlLib/CtrlLib.h>
// submitted by Aykayayciti (Earl Lamont Montgomery)
using namespace Upp;
class GoodbyeWorld : public TopWindow {
MenuBar menu;
StatusBar status;
Displaying the message on status line. The message remains visible until the next keystroke, but macro execution continues.
<lang vedit>Statline_Message("Goodbye, World!")</lang>
Displaying a dialog box with the message and default OK button:
<lang vedit>Dialog_Input_1(1,"`Vedit example`,`Goodbye, World!`")</lang>
This example used the Windows MessageBox function to do the work for us.
Windows uses the stdcall calling convention where the caller pushes
function parameters onto the stack and the stack has been fixed up
when the callee returns.
<lang assembly>;;; hellowin.asm
initscr proto ;; WINDOW *initsrc(void);
endwin proto ;; int endwin(void);
start_color proto ;; int start_color(void);
wrefresh proto :qword ;; int wrefresh(WINDOW *w);
wgetch proto :qword ;; int wgetch(WINDOW *w)
waddnstr proto :qword, :qword, :dword ;; int waddnstr(WINDOW *w, const char *str, int n);
gtk_main proto
gtk_main_quit proto
gtk_window_get_type proto
gtk_widget_show_all proto :qword
exit proto :dword
gtk_window_new proto :dword
printf proto :dword, :vararg
g_type_check_instance_cast proto :qword, :qword
gtk_init proto :qword, :qword
gtk_window_set_title proto :qword, :qword
g_signal_connect_data proto :qword, :qword, :qword, :dword, :dword, :dword
zkl doesn't have a decent GUI ffi but, on my Linux box, the following work:
<lang zkl>System.cmd(0'|zenity --info --text="Goodbye, World!"|); // GTK+ pop up
System.cmd(0'|notify-send "Goodbye, World!"|); // desktop notification
System.cmd(0'|xmessage -buttons Ok:0,"Not sure":1,Cancel:2 -default Ok -nearmouse "Goodbye, World!" -timeout 10|); // X Windows dialog</lang>
The quote quote syntax is 0'<char>text<char> or you can use \ (eg "\"Goodbye, World!\"")