-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwhatisnew.html
814 lines (665 loc) · 59.6 KB
/
whatisnew.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>What is new in Ring 1.1? — Ring 1.14 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="What is new in Ring 1.2?" href="whatisnew2.html" />
<link rel="prev" title="Language Design" href="languagedesign.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html">
<img src="_static/ringdoclogo.jpg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="ringapps.html">Applications developed in a few hours</a></li>
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringnotepad.html">Using Ring Notepad</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started - First Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting_started2.html">Getting Started - Second Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting_started3.html">Getting Started - Third Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="variables.html">Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="operators.html">Operators</a></li>
<li class="toctree-l1"><a class="reference internal" href="controlstructures.html">Control Structures - First Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="controlstructures2.html">Control Structures - Second Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="controlstructures3.html">Control Structures - Third Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="getinput.html">Getting Input</a></li>
<li class="toctree-l1"><a class="reference internal" href="functions.html">Functions - First Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="functions2.html">Functions - Second Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="functions3.html">Functions - Third Style</a></li>
<li class="toctree-l1"><a class="reference internal" href="programstructure.html">Program Structure</a></li>
<li class="toctree-l1"><a class="reference internal" href="lists.html">Lists</a></li>
<li class="toctree-l1"><a class="reference internal" href="strings.html">Strings</a></li>
<li class="toctree-l1"><a class="reference internal" href="dateandtime.html">Date and Time</a></li>
<li class="toctree-l1"><a class="reference internal" href="checkandconvert.html">Check Data Type and Conversion</a></li>
<li class="toctree-l1"><a class="reference internal" href="mathfunc.html">Mathematical Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="files.html">Files</a></li>
<li class="toctree-l1"><a class="reference internal" href="systemfunc.html">System Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="evaldebug.html">Eval() and Debugging</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo.html">Demo Programs</a></li>
<li class="toctree-l1"><a class="reference internal" href="odbc.html">ODBC Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="mysql.html">MySQL Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="sqlite.html">SQLite Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="postgresql.html">PostgreSQL Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="secfunc.html">Security and Internet Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="oop.html">Object Oriented Programming (OOP)</a></li>
<li class="toctree-l1"><a class="reference internal" href="fp.html">Functional Programming (FP)</a></li>
<li class="toctree-l1"><a class="reference internal" href="metaprog.html">Reflection and Meta-programming</a></li>
<li class="toctree-l1"><a class="reference internal" href="declarative.html">Declarative Programming using Nested Structures</a></li>
<li class="toctree-l1"><a class="reference internal" href="natural.html">Natural language programming</a></li>
<li class="toctree-l1"><a class="reference internal" href="naturallibrary.html">Using the Natural Library</a></li>
<li class="toctree-l1"><a class="reference internal" href="scope.html">Scope Rules for Variables and Attributes</a></li>
<li class="toctree-l1"><a class="reference internal" href="scope2.html">Scope Rules for Functions and Methods</a></li>
<li class="toctree-l1"><a class="reference internal" href="syntaxflexibility.html">Syntax Flexibility</a></li>
<li class="toctree-l1"><a class="reference internal" href="typehints.html">The Type Hints Library</a></li>
<li class="toctree-l1"><a class="reference internal" href="debug.html">The Trace Library and the Interactive Debugger</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringemb.html">Embedding Ring Language in Ring Programs</a></li>
<li class="toctree-l1"><a class="reference internal" href="stdlib.html">Stdlib Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="stdlibclasses.html">Stdlib Classes</a></li>
<li class="toctree-l1"><a class="reference internal" href="qt.html">Desktop, WebAssembly and Mobile development using RingQt</a></li>
<li class="toctree-l1"><a class="reference internal" href="formdesigner.html">Using the Form Designer</a></li>
<li class="toctree-l1"><a class="reference internal" href="qt3d.html">Graphics Programming using RingQt3D</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringqtobjects.html">Objects Library for RingQt Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="multilanguage.html">Multi-language Applications</a></li>
<li class="toctree-l1"><a class="reference internal" href="qtmobile.html">Building RingQt Applications for Mobile</a></li>
<li class="toctree-l1"><a class="reference internal" href="qtwebassembly.html">Building RingQt Applications for WebAssembly</a></li>
<li class="toctree-l1"><a class="reference internal" href="web.html">Web Development (CGI Library)</a></li>
<li class="toctree-l1"><a class="reference internal" href="deployincloud.html">Deploying Web Applications in the Cloud</a></li>
<li class="toctree-l1"><a class="reference internal" href="allegro.html">Graphics and 2D Games programming using RingAllegro</a></li>
<li class="toctree-l1"><a class="reference internal" href="gameengine.html">Demo Project - Game Engine for 2D Games</a></li>
<li class="toctree-l1"><a class="reference internal" href="gameengineandorid.html">Building Games For Android</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringraylib.html">Developing Games using RingRayLib</a></li>
<li class="toctree-l1"><a class="reference internal" href="usingopengl.html">Using RingOpenGL and RingFreeGLUT for 3D Graphics</a></li>
<li class="toctree-l1"><a class="reference internal" href="usingopengl2.html">Using RingOpenGL and RingAllegro for 3D Graphics</a></li>
<li class="toctree-l1"><a class="reference internal" href="goldmagic800.html">Demo Project - The Gold Magic 800 Game</a></li>
<li class="toctree-l1"><a class="reference internal" href="tilengine.html">Using RingTilengine</a></li>
<li class="toctree-l1"><a class="reference internal" href="performancetips.html">Performance Tips</a></li>
<li class="toctree-l1"><a class="reference internal" href="compiler.html">Command Line Options</a></li>
<li class="toctree-l1"><a class="reference internal" href="distribute.html">Distributing Ring Applications (Manual)</a></li>
<li class="toctree-l1"><a class="reference internal" href="distribute_ring2exe.html">Distributing Ring Applications using Ring2EXE</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringpm.html">The Ring Package Manager (RingPM)</a></li>
<li class="toctree-l1"><a class="reference internal" href="zerolib.html">ZeroLib Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="foxringfuncsdoc.html">FoxRing Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="bignumber.html">BigNumber Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="libcurl.html">Using RingLibCurl</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringlibcurlfuncsdoc.html">RingLibCurl Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="socket.html">Using RingSockets</a></li>
<li class="toctree-l1"><a class="reference internal" href="threads.html">Using RingThreads</a></li>
<li class="toctree-l1"><a class="reference internal" href="libui.html">Using RingLibui</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringzip.html">Using RingZip</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringlibzipfuncsdoc.html">RingLibZip Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringmurmurhashfuncsdoc.html">RingMurmurHash Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringconsolecolorsfuncsdoc.html">RingConsoleColors Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringallegrofuncsdoc.html">RingAllegro Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="libsdl.html">Using RingLibSDL</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringlibsdlfuncsdoc.html">RingLibSDL Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="libuv.html">Using Ringlibuv</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringlibuvfuncsdoc.html">RingLibuv Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringfreeglutfuncsdoc.html">RingFreeGLUT Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringstbimage.html">RingStbImage Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringopengl32funcsdoc.html">RingOpenGL (OpenGL 3.2) Functions Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="qtclassesdoc.html">RingQt Classes and Methods Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="lowlevel.html">Low Level Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="extension_tutorial.html">Tutorial: Ring Extensions in C/C++</a></li>
<li class="toctree-l1"><a class="reference internal" href="extension.html">Extension using the C/C++ languages</a></li>
<li class="toctree-l1"><a class="reference internal" href="embedding.html">Embedding Ring Language in C/C++ Programs</a></li>
<li class="toctree-l1"><a class="reference internal" href="codegenerator.html">Code Generator for wrapping C/C++ Libraries</a></li>
<li class="toctree-l1"><a class="reference internal" href="ringbeep.html">Create your first extension using the Code Generator</a></li>
<li class="toctree-l1"><a class="reference internal" href="languagedesign.html">Release Notes: Version 1.0</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Release Notes: Version 1.1</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#list-of-changes-and-new-features">List of changes and new features</a></li>
<li class="toctree-l2"><a class="reference internal" href="#better-natural-language-programming-support">Better Natural Language Programming Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="#generate-execute-ring-object-files-ringo">Generate/Execute Ring Object Files (*.ringo)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#syntax-flexibility-and-different-styles-for-i-o-and-control-structures">Syntax Flexibility and different styles for I/O and Control Structures</a></li>
<li class="toctree-l2"><a class="reference internal" href="#new-functions-and-changes">New Functions and Changes</a></li>
<li class="toctree-l2"><a class="reference internal" href="#stdlib-functions-and-classes-written-in-ring">StdLib functions and classes written in Ring</a></li>
<li class="toctree-l2"><a class="reference internal" href="#ringlibsdl">RingLibSDL</a></li>
<li class="toctree-l2"><a class="reference internal" href="#demo-project-game-engine-for-2d-games">Demo Project - Game Engine for 2D Games</a></li>
<li class="toctree-l2"><a class="reference internal" href="#ringsqlite">RingSQLite</a></li>
<li class="toctree-l2"><a class="reference internal" href="#better-code-generator-for-extensions">Better Code Generator for Extensions</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-self-attribute-in-the-class-region-to-define-new-attributes">Using Self.Attribute in the Class Region to define new attributes</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-this-attribute-in-nested-braces-inside-the-class-methods">Using This.Attribute in nested Braces inside the Class Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="#better-documentation">Better Documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew2.html">Release Notes: Version 1.2</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew3.html">Release Notes: Version 1.3</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew4.html">Release Notes: Version 1.4</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew5.html">Release Notes: Version 1.5</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew6.html">Release Notes: Version 1.6</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew7.html">Release Notes: Version 1.7</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew8.html">Release Notes: Version 1.8</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew9.html">Release Notes: Version 1.9</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew10.html">Release Notes: Version 1.10</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew11.html">Release Notes: Version 1.11</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew12.html">Release Notes: Version 1.12</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew13.html">Release Notes: Version 1.13</a></li>
<li class="toctree-l1"><a class="reference internal" href="whatisnew14.html">Release Notes: Version 1.14</a></li>
<li class="toctree-l1"><a class="reference internal" href="codeeditors.html">Using Other Code Editors</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">Frequently Asked Questions (FAQ)</a></li>
<li class="toctree-l1"><a class="reference internal" href="sourcecode.html">How to Compile Ring From Source Code?</a></li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">How to contribute?</a></li>
<li class="toctree-l1"><a class="reference internal" href="reference.html">Language Specification</a></li>
<li class="toctree-l1"><a class="reference internal" href="resources.html">Resources</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Ring</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> »</li>
<li>What is new in Ring 1.1?</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="what-is-new-in-ring-1-1">
<span id="index-0"></span><h1>What is new in Ring 1.1?<a class="headerlink" href="#what-is-new-in-ring-1-1" title="Permalink to this headline">¶</a></h1>
<p>In this chapter we will learn about the changes and new features in Ring 1.1 release.</p>
<div class="section" id="list-of-changes-and-new-features">
<span id="index-1"></span><h2>List of changes and new features<a class="headerlink" href="#list-of-changes-and-new-features" title="Permalink to this headline">¶</a></h2>
<p>Ring 1.1 comes with many new features</p>
<ul class="simple">
<li><p>Better Natural Language Programming Support</p></li>
<li><p>Generate/Execute Ring Object Files (<a href="#id1"><span class="problematic" id="id2">*</span></a>.ringo)</p></li>
<li><p>Syntax Flexibility and different styles for I/O and Control Structures</p></li>
<li><p>New Functions and Changes</p></li>
<li><p>StdLib functions and classes written in Ring</p></li>
<li><p>RingLibSDL</p></li>
<li><p>Demo Project - Game Engine for 2D Games</p></li>
<li><p>RingSQLite</p></li>
<li><p>Better Code Generator for Extensions</p></li>
<li><p>Using Self.Attribute in the Class Region to define new attributes</p></li>
<li><p>Using This.Attribute in nested Braces inside the Class Methods</p></li>
<li><p>Better Documentation</p></li>
</ul>
</div>
<div class="section" id="better-natural-language-programming-support">
<span id="index-2"></span><h2>Better Natural Language Programming Support<a class="headerlink" href="#better-natural-language-programming-support" title="Permalink to this headline">¶</a></h2>
<p>Ring is an innovative language because of it’s compact syntax, smart implementation (small, transparent & visual)
and it’s ability to create declarative and natural domain specific languages in a fraction of time.</p>
<p>This release add support for calling methods when an expression is evaluated</p>
<p>check this example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="c"># Natural Code</span>
<span class="k">new</span> <span class="n">program</span> <span class="p">{</span>
<span class="n">Accept</span> <span class="mi">2</span> <span class="n">numbers</span> <span class="n">then</span> <span class="n">print</span> <span class="n">the</span> <span class="n">sum</span>
<span class="p">}</span>
<span class="c"># Natural Code Implementation</span>
<span class="k">class</span> <span class="n">program</span>
<span class="c"># Keywords</span>
<span class="n">Accept</span><span class="o">=</span><span class="mi">0</span> <span class="n">numbers</span><span class="o">=</span><span class="mi">0</span> <span class="n">then</span><span class="o">=</span><span class="mi">0</span> <span class="n">print</span><span class="o">=</span><span class="mi">0</span> <span class="n">the</span><span class="o">=</span><span class="mi">0</span> <span class="n">sum</span><span class="o">=</span><span class="mi">0</span>
<span class="c"># Execution</span>
<span class="k">func</span> <span class="n">braceexpreval</span> <span class="n">x</span>
<span class="n">value</span> <span class="o">=</span> <span class="n">x</span>
<span class="k">func</span> <span class="n">getnumbers</span>
<span class="k">for</span> <span class="n">x</span><span class="o">=</span><span class="mi">1</span> <span class="k">to</span> <span class="n">value</span>
<span class="k">see</span> <span class="s">"Enter Number ("</span><span class="o">+</span><span class="n">x</span><span class="o">+</span><span class="s">") :"</span> <span class="k">give</span> <span class="n">nNumber</span>
<span class="n">aNumbers</span> <span class="o">+</span> <span class="n">nNumber</span>
<span class="k">next</span>
<span class="k">func</span> <span class="n">getsum</span>
<span class="n">nSUm</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">x</span> <span class="k">in</span> <span class="n">aNumbers</span> <span class="n">nSum</span><span class="o">+=</span> <span class="n">x</span> <span class="k">next</span>
<span class="k">see</span> <span class="s">"The Sum : "</span> <span class="o">+</span> <span class="n">nSum</span>
<span class="n">private</span>
<span class="n">value</span><span class="o">=</span><span class="mi">0</span> <span class="n">aNumbers</span><span class="o">=[]</span>
</pre></div>
</div>
<p>Output:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="n">Enter</span> <span class="n">Number</span> <span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">:</span><span class="mi">3</span>
<span class="n">Enter</span> <span class="n">Number</span> <span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="p">:</span><span class="mi">4</span>
<span class="n">The</span> <span class="n">Sum</span> <span class="p">:</span> <span class="mi">7</span>
</pre></div>
</div>
<p>for more information see the “Natural Language Programming” chapter.</p>
</div>
<div class="section" id="generate-execute-ring-object-files-ringo">
<span id="index-3"></span><h2>Generate/Execute Ring Object Files (<a href="#id3"><span class="problematic" id="id4">*</span></a>.ringo)<a class="headerlink" href="#generate-execute-ring-object-files-ringo" title="Permalink to this headline">¶</a></h2>
<p>This feature enable you to distribute your applications without distributing
the source code. Also it makes application distribution a simple process where
you get one Ring object file for the complete project (many source code files).
Also using Ring object file remove the loading time required for compiling the application.</p>
<p>Check the “command line options” chapter to know more about this feature.</p>
</div>
<div class="section" id="syntax-flexibility-and-different-styles-for-i-o-and-control-structures">
<span id="index-4"></span><h2>Syntax Flexibility and different styles for I/O and Control Structures<a class="headerlink" href="#syntax-flexibility-and-different-styles-for-i-o-and-control-structures" title="Permalink to this headline">¶</a></h2>
<p>Programmers are sensitive to the programming language syntax. Great programmers know how to work
using many different styles but each programmer may have his/her favorite style.</p>
<p>Each programming language comes with a style that you may like or not. Ring is just one of these
languages, but as a response to many programmers asking for a better syntax we decided to provide
more options.</p>
<p>Also some of these features are very necessary for Natural Language Programming.</p>
<p>Example :</p>
<p>We have two commands to change language keywords and operators.</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">ChangeRingOperator</span> <span class="o">+</span> <span class="n">plus</span>
<span class="k">ChangeRingKeyword</span> <span class="k">see</span> <span class="n">print</span>
<span class="n">Print</span> <span class="mi">5</span> <span class="n">plus</span> <span class="mi">5</span>
<span class="k">ChangeRingOperator</span> <span class="n">plus</span> <span class="o">+</span>
<span class="k">ChangeRingKeyword</span> <span class="n">print</span> <span class="k">see</span>
</pre></div>
</div>
<p>We have new styles (Optional) for Input/Output.</p>
<p>Example :</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Put</span> <span class="s">"What is your name? "</span>
<span class="k">Get</span> <span class="n">cName</span>
<span class="k">Put</span> <span class="s">"Hello "</span> <span class="o">+</span> <span class="n">cName</span>
</pre></div>
</div>
<p>Example :</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">Print</span><span class="p">(</span><span class="s">"What is your name? "</span><span class="p">)</span> <span class="c"># print message on screen</span>
<span class="n">cName</span><span class="o">=</span><span class="n">GetString</span><span class="p">()</span> <span class="c"># get input from the user</span>
<span class="n">print</span><span class="p">(</span><span class="s">"Hello #{cName}"</span><span class="p">)</span> <span class="c"># say hello!</span>
</pre></div>
</div>
<p>We have new styles (optional) for control structures.</p>
<p>Example :</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">While</span> <span class="kp">True</span>
<span class="k">Put</span> <span class="s">"</span>
<span class="n">Main</span> <span class="n">Menu</span>
<span class="o">---------</span>
<span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="n">Say</span> <span class="n">Hello</span>
<span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="n">About</span>
<span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="k">Exit</span>
<span class="s">" Get nOption</span>
<span class="k">Switch</span> <span class="n">nOption</span>
<span class="k">Case</span> <span class="mi">1</span>
<span class="k">Put</span> <span class="s">"Enter your name : "</span>
<span class="k">Get</span> <span class="n">name</span>
<span class="k">Put</span> <span class="s">"Hello "</span> <span class="o">+</span> <span class="n">name</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">Case</span> <span class="mi">2</span>
<span class="k">Put</span> <span class="s">"Sample : using while loop"</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">Case</span> <span class="mi">3</span>
<span class="k">Bye</span>
<span class="k">Else</span>
<span class="k">Put</span> <span class="s">"bad option..."</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">End</span>
<span class="k">End</span>
</pre></div>
</div>
<p>Example :</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="k">While</span> <span class="kp">True</span> <span class="p">{</span>
<span class="n">print</span><span class="p">(</span><span class="s">"</span>
<span class="n">Main</span> <span class="n">Menu</span>
<span class="o">---------</span>
<span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="n">Say</span> <span class="n">Hello</span>
<span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="n">About</span>
<span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="k">Exit</span>
<span class="s">")</span>
<span class="n">nOption</span> <span class="o">=</span> <span class="n">GetString</span><span class="p">()</span>
<span class="k">switch</span> <span class="n">nOption</span> <span class="p">{</span>
<span class="k">case</span> <span class="mi">1</span>
<span class="n">print</span><span class="p">(</span><span class="s">"Enter your name : "</span><span class="p">)</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">getstring</span><span class="p">()</span>
<span class="n">print</span><span class="p">(</span><span class="s">"Hello #{name}</span><span class="se">\n</span><span class="s">"</span><span class="p">)</span>
<span class="k">case</span> <span class="mi">2</span>
<span class="n">print</span><span class="p">(</span><span class="s">"Sample : using switch statement</span><span class="se">\n</span><span class="s">"</span><span class="p">)</span>
<span class="k">case</span> <span class="mi">3</span>
<span class="k">Bye</span>
<span class="k">else</span>
<span class="n">print</span><span class="p">(</span><span class="s">"bad option...</span><span class="se">\n</span><span class="s">"</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Check the next chapters:-</p>
<ul class="simple">
<li><p>Getting Started - Second Style</p></li>
<li><p>Getting Started - Third Style</p></li>
<li><p>Control Structures - Second Style - May looks like Lua and Ruby</p></li>
<li><p>Control Structures - Third Style - May looks like C (uses braces)</p></li>
<li><p>Syntax Flexibility</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>All of these styles are provided automatically by the compiler at the same time, It’s better to select one style for the same project (you can create your style as a mix from these styles) for example you can use Put/Get and Braces.</p>
</div>
</div>
<div class="section" id="new-functions-and-changes">
<span id="index-5"></span><h2>New Functions and Changes<a class="headerlink" href="#new-functions-and-changes" title="Permalink to this headline">¶</a></h2>
<p>Changed:</p>
<ul class="simple">
<li><p>get() function : changed to sysget()</p></li>
<li><p>sort() function : can now work on list of objects</p></li>
<li><p>find() function : can now work on list of objects</p></li>
</ul>
<p>Added:</p>
<ul class="simple">
<li><p>clockspersecond()</p></li>
<li><p>CurrentDir()</p></li>
<li><p>ExeFileName()</p></li>
<li><p>ChDir()</p></li>
<li><p>ExeFolder()</p></li>
<li><p>varptr()</p></li>
<li><p>space()</p></li>
<li><p>nullpointer()</p></li>
<li><p>object2pointer()</p></li>
<li><p>pointer2object()</p></li>
</ul>
<p>Check the next chapters</p>
<ul class="simple">
<li><p>System Functions</p></li>
<li><p>Object Oriented Programming (OOP)</p></li>
<li><p>Low Level Functions</p></li>
</ul>
</div>
<div class="section" id="stdlib-functions-and-classes-written-in-ring">
<span id="index-6"></span><h2>StdLib functions and classes written in Ring<a class="headerlink" href="#stdlib-functions-and-classes-written-in-ring" title="Permalink to this headline">¶</a></h2>
<p>Ring 1.1 comes with a library called StdLib, it’s written in Ring by the help of Ring Team</p>
<p>The library provide a useful group of new functions and classes</p>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">Puts</span><span class="p">(</span><span class="s">"Test Times()"</span><span class="p">)</span>
<span class="n">Times</span> <span class="p">(</span> <span class="mi">3</span> <span class="p">,</span> <span class="k">func</span> <span class="p">{</span> <span class="k">see</span> <span class="s">"Hello, World!"</span> <span class="o">+</span> <span class="n">nl</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">Puts</span><span class="p">(</span><span class="s">"Test Map()"</span><span class="p">)</span>
<span class="k">See</span> <span class="n">Map</span><span class="p">(</span> <span class="mi">1</span><span class="p">:</span><span class="mi">10</span><span class="p">,</span> <span class="k">func</span> <span class="n">x</span> <span class="p">{</span> <span class="k">return</span> <span class="n">x</span><span class="o">*</span><span class="n">x</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">Puts</span><span class="p">(</span><span class="s">"Test Filter()"</span><span class="p">)</span>
<span class="k">See</span> <span class="n">Filter</span><span class="p">(</span> <span class="mi">1</span><span class="p">:</span><span class="mi">10</span> <span class="p">,</span> <span class="k">func</span> <span class="n">x</span> <span class="p">{</span> <span class="k">if</span> <span class="n">x</span> <span class="o"><=</span> <span class="mi">5</span> <span class="k">return</span> <span class="kp">true</span> <span class="k">else</span> <span class="k">return</span> <span class="kp">false</span> <span class="k">ok</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="k">See</span> <span class="s">"Testing the String Class"</span> <span class="o">+</span> <span class="n">nl</span>
<span class="n">oString</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">string</span><span class="p">(</span><span class="s">"Hello, World!"</span><span class="p">)</span>
<span class="n">oString</span><span class="p">.</span><span class="n">println</span><span class="p">()</span>
<span class="n">oString</span><span class="p">.</span><span class="n">upper</span><span class="p">().</span><span class="n">println</span><span class="p">()</span>
<span class="n">oString</span><span class="p">.</span><span class="n">lower</span><span class="p">().</span><span class="n">println</span><span class="p">()</span>
<span class="n">oString</span><span class="p">.</span><span class="n">left</span><span class="p">(</span><span class="mi">5</span><span class="p">).</span><span class="n">println</span><span class="p">()</span>
<span class="n">oString</span><span class="p">.</span><span class="n">right</span><span class="p">(</span><span class="mi">6</span><span class="p">).</span><span class="n">println</span><span class="p">()</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">oList</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">list</span> <span class="p">(</span> <span class="o">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="o">]</span> <span class="p">)</span>
<span class="n">oList</span><span class="p">.</span><span class="n">Add</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span>
<span class="n">oList</span><span class="p">.</span><span class="n">print</span><span class="p">()</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">oStack</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">Stack</span>
<span class="n">oStack</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">oStack</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="n">oStack</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="k">see</span> <span class="n">oStack</span><span class="p">.</span><span class="n">pop</span><span class="p">()</span> <span class="o">+</span> <span class="n">nl</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">oQueue</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">Queue</span>
<span class="n">oQueue</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">oQueue</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="n">oQueue</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
<span class="k">see</span> <span class="n">oQueue</span><span class="p">.</span><span class="n">remove</span><span class="p">()</span> <span class="o">+</span> <span class="n">nl</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">ohashtable</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">hashtable</span>
<span class="k">See</span> <span class="s">"Test the hashtable Class Methods"</span> <span class="o">+</span> <span class="n">nl</span>
<span class="n">ohashtable</span> <span class="p">{</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"Egypt"</span><span class="p">,</span><span class="s">"Cairo"</span><span class="p">)</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"KSA"</span><span class="p">,</span><span class="s">"Riyadh"</span><span class="p">)</span>
<span class="k">see</span> <span class="n">self</span><span class="o">[</span><span class="s">"Egypt"</span><span class="o">]</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">see</span> <span class="n">self</span><span class="o">[</span><span class="s">"KSA"</span><span class="o">]</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">see</span> <span class="n">contains</span><span class="p">(</span><span class="s">"Egypt"</span><span class="p">)</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">see</span> <span class="n">contains</span><span class="p">(</span><span class="s">"USA"</span><span class="p">)</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">see</span> <span class="n">index</span><span class="p">(</span><span class="s">"KSA"</span><span class="p">)</span> <span class="o">+</span> <span class="n">NL</span>
<span class="n">print</span><span class="p">()</span>
<span class="n">delete</span><span class="p">(</span><span class="n">index</span><span class="p">(</span><span class="s">"KSA"</span><span class="p">))</span>
<span class="k">see</span> <span class="n">copy</span><span class="p">(</span><span class="s">"*"</span><span class="p">,</span><span class="mi">60</span><span class="p">)</span> <span class="o">+</span> <span class="n">nl</span>
<span class="n">print</span><span class="p">()</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"stdlib.ring"</span>
<span class="n">otree</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">tree</span>
<span class="k">See</span> <span class="s">"Test the tree Class Methods"</span> <span class="o">+</span> <span class="n">nl</span>
<span class="n">otree</span> <span class="p">{</span>
<span class="n">set</span><span class="p">(</span><span class="s">"The first step"</span><span class="p">)</span> <span class="c"># set the root node value</span>
<span class="k">see</span> <span class="n">value</span><span class="p">()</span> <span class="o">+</span> <span class="n">nl</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"one"</span><span class="p">)</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"two"</span><span class="p">)</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"three"</span><span class="p">)</span> <span class="p">{</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"3.1"</span><span class="p">)</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"3.2"</span><span class="p">)</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"3.3"</span><span class="p">)</span>
<span class="k">see</span> <span class="n">children</span>
<span class="p">}</span>
<span class="k">see</span> <span class="n">children</span>
<span class="n">oTree</span><span class="p">.</span><span class="n">children</span><span class="o">[</span><span class="mi">2</span><span class="o">]</span> <span class="p">{</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"2.1"</span><span class="p">)</span> <span class="n">Add</span><span class="p">(</span><span class="s">"2.2"</span><span class="p">)</span> <span class="n">Add</span><span class="p">(</span><span class="s">"2.3"</span><span class="p">)</span> <span class="p">{</span>
<span class="n">Add</span><span class="p">(</span><span class="s">"2.3.1"</span><span class="p">)</span> <span class="n">Add</span><span class="p">(</span><span class="s">"2.3.2"</span><span class="p">)</span> <span class="n">Add</span><span class="p">(</span><span class="s">"test"</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="n">oTree</span><span class="p">.</span><span class="n">children</span><span class="o">[</span><span class="mi">2</span><span class="o">]</span><span class="p">.</span><span class="n">children</span><span class="o">[</span><span class="mi">3</span><span class="o">]</span><span class="p">.</span><span class="n">children</span><span class="o">[</span><span class="mi">3</span><span class="o">]</span><span class="p">.</span><span class="n">set</span><span class="p">(</span><span class="s">"2.3.3"</span><span class="p">)</span>
<span class="p">}</span>
<span class="k">see</span> <span class="n">copy</span><span class="p">(</span><span class="s">"*"</span><span class="p">,</span><span class="mi">60</span><span class="p">)</span> <span class="o">+</span> <span class="n">nl</span>
<span class="n">oTree</span><span class="p">.</span><span class="n">print</span><span class="p">()</span>
</pre></div>
</div>
<p>Check the next chapters:</p>
<ul class="simple">
<li><p>StdLib Functions</p></li>
<li><p>StdLib Classes</p></li>
</ul>
</div>
<div class="section" id="ringlibsdl">
<span id="index-7"></span><h2>RingLibSDL<a class="headerlink" href="#ringlibsdl" title="Permalink to this headline">¶</a></h2>
<p>Ring 1.0 provided RingAllegro to be able to create games using the Allegro game programming library</p>
<p>Now Ring 1.1 provide RingLibSDL also so we can have the choice between Allegro or LibSDL</p>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"libsdl.ring"</span>
<span class="n">SDL_Init</span><span class="p">(</span><span class="n">SDL_INIT_EVERYTHING</span><span class="p">)</span>
<span class="n">win</span> <span class="o">=</span> <span class="n">SDL_CreateWindow</span><span class="p">(</span><span class="s">"Hello World!"</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">640</span><span class="p">,</span> <span class="mi">480</span><span class="p">,</span> <span class="n">SDL_WINDOW_SHOWN</span><span class="p">)</span>
<span class="n">SDL_Delay</span><span class="p">(</span><span class="mi">2000</span><span class="p">)</span>
<span class="n">SDL_DestroyWindow</span><span class="p">(</span><span class="n">win</span><span class="p">)</span>
<span class="n">SDL_Quit</span><span class="p">()</span>
</pre></div>
</div>
<p>See the RingLibSDL Chapter.</p>
</div>
<div class="section" id="demo-project-game-engine-for-2d-games">
<span id="index-8"></span><h2>Demo Project - Game Engine for 2D Games<a class="headerlink" href="#demo-project-game-engine-for-2d-games" title="Permalink to this headline">¶</a></h2>
<p>In practice we would create a game engine in a language like C/C++ to get the best performance
then provide Ring classes to use the engine.</p>
<p>But many 2D Games are simple and creating a game engine in Ring will be fast enough in many cases</p>
<p>Also this would be a good demo project to learn about the language concepts where we build things
using Object Oriented Programming (OOP) then access the power that we have using declarative programming
using nested structures or using natural programming.</p>
<p>In this project we selected the first way (declarative programming using nested structures)</p>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">Load</span> <span class="s">"gameengine.ring"</span> <span class="c"># Give Control to the Game Engine</span>
<span class="k">func</span> <span class="n">main</span> <span class="c"># Called by the Game Engine</span>
<span class="n">oGame</span> <span class="o">=</span> <span class="k">New</span> <span class="n">Game</span> <span class="c"># Create the Game Object</span>
<span class="p">{</span>
<span class="n">title</span> <span class="o">=</span> <span class="s">"My First Game"</span>
<span class="n">text</span> <span class="p">{</span>
<span class="n">x</span> <span class="o">=</span> <span class="mi">10</span> <span class="n">y</span><span class="o">=</span><span class="mi">50</span>
<span class="n">animate</span> <span class="o">=</span> <span class="kp">false</span>
<span class="n">size</span> <span class="o">=</span> <span class="mi">20</span>
<span class="n">file</span> <span class="o">=</span> <span class="s">"fonts/pirulen.ttf"</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">"game development using ring is very fun!"</span>
<span class="n">color</span> <span class="o">=</span> <span class="n">rgb</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span> <span class="c"># Color = black</span>
<span class="p">}</span>
<span class="n">text</span> <span class="p">{</span>
<span class="n">x</span> <span class="o">=</span> <span class="mi">10</span> <span class="n">y</span><span class="o">=</span><span class="mi">150</span>
<span class="c"># Animation Part ======================================</span>
<span class="n">animate</span> <span class="o">=</span> <span class="kp">true</span> <span class="c"># Use Animation</span>
<span class="n">direction</span> <span class="o">=</span> <span class="n">GE_DIRECTION_INCVERTICAL</span> <span class="c"># Increase y</span>
<span class="n">point</span> <span class="o">=</span> <span class="mi">400</span> <span class="c"># Continue until y=400</span>
<span class="n">nStep</span> <span class="o">=</span> <span class="mi">3</span> <span class="c"># Each time y+= 3</span>
<span class="c">#======================================================</span>
<span class="n">size</span> <span class="o">=</span> <span class="mi">20</span>
<span class="n">file</span> <span class="o">=</span> <span class="s">"fonts/pirulen.ttf"</span>
<span class="n">text</span> <span class="o">=</span> <span class="s">"welcome to the real world!"</span>
<span class="n">color</span> <span class="o">=</span> <span class="n">rgb</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">)</span> <span class="c"># Color = Blue</span>
<span class="p">}</span>
<span class="n">Sound</span> <span class="p">{</span> <span class="c"># Play Sound</span>
<span class="n">file</span> <span class="o">=</span> <span class="s">"sound/music1.wav"</span> <span class="c"># Sound File Name</span>
<span class="p">}</span>
<span class="p">}</span> <span class="c"># Start the Events Loop</span>
</pre></div>
</div>
<p>See the “Demo Project - Game Engine for 2D Games” chapter.</p>
</div>
<div class="section" id="ringsqlite">
<span id="index-9"></span><h2>RingSQLite<a class="headerlink" href="#ringsqlite" title="Permalink to this headline">¶</a></h2>
<p>Ring 1.0 provided support for ODBC to use any database and provided native support for MySQL.</p>
<p>Now Ring 1.1 provide native support for SQLite database too.</p>
<p>Example:</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="n">oSQLite</span> <span class="o">=</span> <span class="n">sqlite_init</span><span class="p">()</span>
<span class="n">sqlite_open</span><span class="p">(</span><span class="n">oSQLite</span><span class="p">,</span><span class="s">"mytest.db"</span><span class="p">)</span>
<span class="n">sql</span> <span class="o">=</span> <span class="s">"CREATE TABLE COMPANY("</span> <span class="o">+</span>
<span class="s">"ID INT PRIMARY KEY NOT NULL,"</span> <span class="o">+</span>
<span class="s">"NAME TEXT NOT NULL,"</span> <span class="o">+</span>
<span class="s">"AGE INT NOT NULL,"</span> <span class="o">+</span>
<span class="s">"ADDRESS CHAR(50),"</span> <span class="o">+</span>
<span class="s">"SALARY REAL );"</span>
<span class="n">sqlite_execute</span><span class="p">(</span><span class="n">oSQLite</span><span class="p">,</span><span class="n">sql</span><span class="p">)</span>
<span class="n">sql</span> <span class="o">=</span> <span class="s">"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) "</span> <span class="o">+</span>
<span class="s">"VALUES (1, 'Mahmoud', 29, 'Jeddah', 20000.00 ); "</span> <span class="o">+</span>
<span class="s">"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) "</span> <span class="o">+</span>
<span class="s">"VALUES (2, 'Ahmed', 27, 'Jeddah', 15000.00 ); "</span> <span class="o">+</span>
<span class="s">"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)"</span> <span class="o">+</span>
<span class="s">"VALUES (3, 'Mohammed', 31, 'Egypt', 20000.00 );"</span> <span class="o">+</span>
<span class="s">"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)"</span> <span class="o">+</span>
<span class="s">"VALUES (4, 'Ibrahim', 24, 'Egypt ', 65000.00 );"</span>
<span class="n">sqlite_execute</span><span class="p">(</span><span class="n">oSQLite</span><span class="p">,</span><span class="n">sql</span><span class="p">)</span>
<span class="n">aResult</span> <span class="o">=</span> <span class="n">sqlite_execute</span><span class="p">(</span><span class="n">oSQLite</span><span class="p">,</span><span class="s">"select * from COMPANY"</span><span class="p">)</span>
<span class="k">for</span> <span class="n">x</span> <span class="k">in</span> <span class="n">aResult</span>
<span class="k">for</span> <span class="n">t</span> <span class="k">in</span> <span class="n">x</span>
<span class="k">see</span> <span class="n">t</span><span class="o">[</span><span class="mi">2</span><span class="o">]</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">next</span>
<span class="k">next</span>
<span class="k">see</span> <span class="n">copy</span><span class="p">(</span><span class="s">"*"</span><span class="p">,</span><span class="mi">50</span><span class="p">)</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">for</span> <span class="n">x</span> <span class="k">in</span> <span class="n">aResult</span>
<span class="k">see</span> <span class="n">x</span><span class="o">[</span><span class="s">"name"</span><span class="o">]</span> <span class="o">+</span> <span class="n">nl</span>
<span class="k">next</span>
<span class="n">sqlite_close</span><span class="p">(</span><span class="n">oSQLite</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="better-code-generator-for-extensions">
<span id="index-10"></span><h2>Better Code Generator for Extensions<a class="headerlink" href="#better-code-generator-for-extensions" title="Permalink to this headline">¶</a></h2>
<p>We are using the code generator (written in Ring) every day to add new libraries to Ring.</p>
<p>The generator is used to create RingQt and RingAllegro</p>
<p>Also in Ring 1.1 it’s used to create RingLibSDL.</p>
<p>more features are added like</p>
<ul class="simple">
<li><p>Set/Get structure members (numbers & pointers)</p></li>
<li><p>Using constants</p></li>
<li><p>Better Generated Code</p></li>
</ul>
<p>See the Code Generator chapter.</p>
</div>
<div class="section" id="using-self-attribute-in-the-class-region-to-define-new-attributes">
<span id="index-11"></span><h2>Using Self.Attribute in the Class Region to define new attributes<a class="headerlink" href="#using-self-attribute-in-the-class-region-to-define-new-attributes" title="Permalink to this headline">¶</a></h2>
<p>We can use Self.Attribute in the Class Region (after the class name and before any methods)
to define new attributes.</p>
<div class="highlight-ring notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="n">Person</span>
<span class="n">name</span> <span class="c"># Define name as attribute if it's not a global variable</span>
<span class="n">address</span>
<span class="n">phone</span>
<span class="k">class</span> <span class="n">person2</span>
<span class="n">self</span><span class="p">.</span><span class="n">name</span> <span class="c"># Must Define the attribute</span>
<span class="n">self</span><span class="p">.</span><span class="n">address</span>
<span class="n">self</span><span class="p">.</span><span class="n">phone</span>
</pre></div>
</div>
</div>
<div class="section" id="using-this-attribute-in-nested-braces-inside-the-class-methods">
<span id="index-12"></span><h2>Using This.Attribute in nested Braces inside the Class Methods<a class="headerlink" href="#using-this-attribute-in-nested-braces-inside-the-class-methods" title="Permalink to this headline">¶</a></h2>
<p>We can use nested braces {} while we are inside methods to access another objects, In this case
the current object scope will be changed while we are inside the brace and Self will point to the object
that we access using braces {}. In this case we can use This.Attribute and This.Method() to access the object
that will be created from the current class.</p>
<p>Check the Object Oriented Programming chapter for more information.</p>
<p>Also Check the Weight History Application in GUI Development using RingQt chapter.</p>
</div>
<div class="section" id="better-documentation">
<span id="index-13"></span><h2>Better Documentation<a class="headerlink" href="#better-documentation" title="Permalink to this headline">¶</a></h2>
<p>Ring 1.1 documentation (800 pages) is better than Ring 1.0 documentation (340 pages)</p>
<p>Many chapters are added for providing better information about the language like:</p>
<ul class="simple">
<li><p>Language Reference</p></li>
<li><p>Scope Rules</p></li>
<li><p>FAQ</p></li>
</ul>
<p>And more!</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="whatisnew2.html" class="btn btn-neutral float-right" title="What is new in Ring 1.2?" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="languagedesign.html" class="btn btn-neutral float-left" title="Language Design" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2016-2021, Ring Team
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>