Update samples/General/SmallExamples/NumberTripletsGame/NumberTripletsGame.ring - Better Format
@@ -8,6 +8,7 @@ load "guilib.ring"
C_GAMETITLE = 'Number Triplets Game'
C_WINDOWBACKGROUND = "background-color: gray;"
+
if isMobile()
C_LABELFONTSIZE = "font-size:120px;"
C_BUTTONFONTSIZE = "font-size:160px;"
@@ -36,6 +37,7 @@ x2 = 0
y1 = 0
y2 = 0
nScore = 0
+
button = newlist(sizex,sizey)
buttonsave = newlist(sizex,sizey)
LayoutButtonRow = list(sizey+1)
@@ -70,7 +72,7 @@ app = new qApp {
myfilter3 = new qAllEvents(win) {
setMouseButtonPressEvent("keyPress()")}
installeventfilter(myfilter3)
- myfilter2 = new qAllEvents(win) //{
+ myfilter2 = new qAllEvents(win)
installeventfilter(myfilter2)
winwidth = win.width()
winheight = win.height()
@@ -118,7 +120,7 @@ app = new qApp {
exec()
}
-func pbegin()
+func pbegin
flag = 0
for n = 1 to sizex
for m = 1 to sizey
@@ -153,7 +155,7 @@ func pbegin()
numRand = list(4)
pRandom()
-func pRandom()
+func pRandom
for n = 1 to sizex
for m = 1 to sizey
button[n][m].settext("")
@@ -187,7 +189,7 @@ func pRandom()
ok
end
-func keyPress(x,y)
+func keyPress x,y
flag++
if flag = 1
x1 = x
@@ -200,7 +202,7 @@ func keyPress(x,y)
pMove(x1,y1,x2,y2)
ok
-func pMove(col1,row1,col2,row2)
+func pMove col1,row1,col2,row2
if col1!=0 and col2!=0 and row1!=0 and row2!=0
if col1=col2 and row2=row1+1 and col1%2=0
temp = button[col1][row1].text()
@@ -269,13 +271,12 @@ func pMove(col1,row1,col2,row2)
button[col1][row1].settext("")
ok
ok
-
ok
-func msgBox(text) {
+func msgBox text
m = new qMessageBox(win) {
setWindowTitle('2048 Game')
setText(text)
show()
}
- }
+
