|
Post by aurel on Jan 19, 2022 6:08:39 GMT -6
so how to do that in rcb
and why this one not work
'test array fill RCB_315 by Aurel
WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480) LoadFont (1,"FreeMono.ttf",30) Font(1) DrawText("Test string array",10,10)
'Dim t$[2] ' init string array
While Not Key(K_ESCAPE) 'update
wend
|
|
|
Post by aurel on Jan 19, 2022 6:24:36 GMT -6
Ahh crap ..i forget procedure this work ...is it ok ?
'test array fill RCB_315 by Aurel win=0 WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480, WINDOW_VISIBLE, 1) LoadFont (1,"FreeMono.ttf",30) Font(1) 'open canvas CanvasOpen(0, 640, 480, 0, 0, 640, 480, 0) 'set color red = RGB(255,0,0) SetColor(red) 'draw text DrawText("Test string array",10,10) update
'Dim t$[2] ' init string array
While WindowExists(0) <> 0 update
wend
|
|
|
Post by johnno56 on Jan 19, 2022 6:47:31 GMT -6
First. WindowOpen is missing a few bits Format: WindowOpen ( win_num, title$, x, y, w, h, mode, vsync ) Second: Even though a 'Window' has been defined, you 'must' define the 'canvas' , you are going to output the display. Format: CanvasOpen ( n, w, h, viewport_x, viewport_y, viewport_w, viewport_h, mode) Whenever you DrawText() for example, an update() needs to be used, otherwise it will not display. Oh. If you are "Drawing" text, it would be a good idea to choose a colour... Change the font as you need. I didn't have FreeMono. 'test array fill RCB_315 by Aurel WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480, 0, 1) CanvasOpen(0,640,480,0,0,640,480,1) LoadFont (1,"arial.ttf",30) Font(1) setColor(rgb(255,255,255)) do DrawText("Test string array",10,10) 'Dim t$[2] ' init string array update() loop until key(27) = 1 If you have any more questions, just ask...
|
|
|
Post by johnno56 on Jan 19, 2022 6:50:35 GMT -6
Ah. You answered before I replied... I will check out your new code...
|
|
|
Post by aurel on Jan 19, 2022 7:03:47 GMT -6
so how add timer...
'test array fill RCB_315 by Aurel win=0 i=0 WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480, WINDOW_VISIBLE, 1) LoadFont (1,"FreeMono.ttf",20) LoadFont (2,"FreeMono.ttf",16) Font(1) 'open canvas CanvasOpen(0, 640, 480, 0, 0, 640, 480, 0) 'set color orange = RGB(255,220,0) SetColor(orange) 'draw text DrawText("Fill string array by Aurel",10,10) update
'************************* ' how here add timer ? '*************************
Dim t$[1024] ' init string array
cyan = RGB(200,220,250) SetColor(cyan) 'draw text Font(2) DrawText("Init string array...",10,60)
While WindowExists(0) <> 0 update
wend
|
|
|
Post by johnno56 on Jan 19, 2022 7:05:02 GMT -6
Looks like your code works. Note: It is usually good practice to keep the windowopen and canvasopen together. The way you did it still works but keeping them together looks neater and helps eliminate mistakes...
There is also another command that is placed immediately after windowopen. SetWindowAutoClose(0, 1) format: SetWindowAutoClose ( window#, exit_on_close ) (exit_on_close: 1=yes, 0=no)
|
|
|
Post by johnno56 on Jan 19, 2022 7:08:01 GMT -6
You answered again while I was replying... lol
Your latest code works fine.
|
|
|
Post by johnno56 on Jan 19, 2022 7:09:55 GMT -6
A timer can be simply added by using: wait(milliseconds) 1000 = 1 second
|
|
|
Post by aurel on Jan 19, 2022 7:11:40 GMT -6
freemono.ttf is from folder font
|
|
|
Post by aurel on Jan 19, 2022 7:12:17 GMT -6
uoff i don't see you are online
|
|
|
Post by johnno56 on Jan 19, 2022 7:12:43 GMT -6
Wow. It's after midnight! I have to be up at 5am... I must get some sleep... lol
|
|
|
Post by aurel on Jan 19, 2022 7:35:12 GMT -6
ahh i forget time zones...heh ok see yaa...
|
|
|
Post by aurel on Jan 19, 2022 7:36:31 GMT -6
hmm something broke loop exit maybe update inside For loop
'test array fill RCB_315 by Aurel win=0 i=0 WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480, WINDOW_VISIBLE, 1) LoadFont (1,"FreeMono.ttf",20) LoadFont (2,"FreeMono.ttf",16) Font(1) 'open canvas CanvasOpen(0, 640, 480, 0, 0, 640, 480, 0) 'set color orange = RGB(255,220,0) SetColor(orange) 'draw text DrawText("Fill string array by Aurel",10,10) update
cyan = RGB(200,220,250) SetColor(cyan) 'draw text Font(2) DrawText("Init string array...",10,60)
'************************* ' how here add timer ? '*************************
Dim t$[1024] ' init string array
For i = 0 to 1024 t$[i] = str(i) DrawText( " ",10,100) update DrawText( t$[i],10,100) update Next
While WindowExists(0) <> 0 update
wend
|
|
|
Post by aurel on Jan 19, 2022 8:55:32 GMT -6
Ok i use RectFill which work properly
'test array fill RCB_315 by Aurel win=0 i=0 Dim t$[1024] ' init string array WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480, WINDOW_VISIBLE, 1) LoadFont (1,"FreeMono.ttf",20) LoadFont (2,"FreeMono.ttf",16) Font(1) 'open canvas CanvasOpen(0, 640, 480, 0, 0, 640, 480, 0) 'set color orange = RGB(255,220,0) SetColor(orange) 'draw text DrawText("Fill string array by Aurel",10,10) update
cyan = RGB(200,220,250) SetColor(cyan) 'draw text Font(2) DrawText("Init string array...",10,60)
'************************* ' how here add timer ? '************************* black = RGB(0,0,0)
For i = 1 to 1023 t$[i] = str(i) SetColor(black) RectFill( 10, 100, 100, 20) 'update SetColor(cyan) DrawText( t$[i],10,100) update Next
While WindowExists(0) <> 0 update
wend
|
|
|
Post by aurel on Jan 19, 2022 13:00:50 GMT -6
I know that is not same and use much more time number to string conversion then assign to array element but I testing similar thing with conversion to string ..then figured that i dont have str$() function in microA then quickly made it to test how work some mumbo jumbo with string expression parser and seems that work.. ok on RCB on my comp above program take cca 12 seconds on microA take 3 second ,but i dont have array yet (shame on me ) would use probably same even maybe 1 to 3 second more ..maybe uhh benchmarks are hard... mA progie: 'aka fill string array with while loop conversion var i,max str ts,nt : ts = ">" i = 0 : max = 1025 wcolor 0,0,0 :fcolor 220,180,150 : print 10,10,"FAKE FILL STRING micro(A)" swap
while i < max i=i+1 fcolor 100,150,100 : rect 8,98,20,24 print 10,100,ts
fcolor 100,150,150 : rect 38,98,100,24 nt = strs(i) print 40,100,nt
swap wend RCB progie 'test array fill RCB_315 by Aurel win=0 i=0 Dim t$[1024] ' init string array WindowOpen(0, "Fill_Array_by Aurel", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, 640, 480, WINDOW_VISIBLE, 1) LoadFont (1,"FreeMono.ttf",20) LoadFont (2,"FreeMono.ttf",16) Font(1) 'open canvas CanvasOpen(0, 640, 480, 0, 0, 640, 480, 0) 'set color orange = RGB(255,220,0) SetColor(orange) 'draw text DrawText("Fill string array by Aurel",10,10) update
cyan = RGB(200,220,250) SetColor(cyan) 'draw text Font(2) DrawText("Init string array...",10,60)
'************************* ' how here add timer ? '************************* black = RGB(0,0,0)
For i = 1 to 1023 t$[i] = str(i) SetColor(black) RectFill( 10, 100, 100, 20) 'update SetColor(cyan) DrawText( t$[i],10,100) update Next
While WindowExists(0) <> 0 update
wend
|
|