micro(A)v11
#1
I saw here post about other basic-s so i will post about my experiment
if is not problem?
anyone interested to try ..go to :
https://sourceforge.net/projects/micro-a-interpreter/

i have lexer version written in QB64 ..so maybe i can try to make microQ
Smile

Reply
#2
Hi Aurel. Thanks for this program.

But how do you get along without keystroke shortcuts in this editor? :O

Some people are very used to pressing [CTRL][O] to open a source-code file. In this editor it inserts the CHR$(15) but that should have been the "sun" in CP437...

Also for example, the find-and-replace dialog could use a "Cancel" button instead of causing the user to click the "X" on the top-right corner.

If the compiler is not ready yet then it might make better sense to disable the toolbar icon, so that somebody accidentally doesn't click on it and becomes annoyed by the dialog.

Many of the programs are good, but some people would consider it rude there is no "Press [ESC] to quit" or something else where one doesn't have to use the mouse. It's most obvious from the "dragon" example (cool graphics!) the interpreter at least needs to do like QB64 giving a prompt "Press any key to exit" and then close the graphic window. It's a bit unsettling the interpreter has to create a graphics window even to use PRINT, but it works.

The prime number example had a small problem with display on my computer. Maybe it works differently on Windows.

Will have to test this on Windows when I could get off my arse for it. So far tested it on Spiral Linux KDE (Debian clone with "Bullseye" base which is now "oldstable").

This will need some time for me to get used to, it's different enough from BASIC.


[Image: micro-A-prime-run.png]
Reply
#3
One thing that I noticed belatedly, for those of you who haven't tried the editor yet.

Make backup copies of your source code to use with this editor! It seems whether or not the file is modified, it is saved to disk when it's closed. It's not known how good the "undo" feature is of this editor. Therefore if you extensively changed one of the programs you had on disk, it doesn't work and then you decided to go back to what you had when you started... and you don't have the backup for it... then, well, that's what backups are for.

In the least, as soon as a source code file is loaded into this editor, use "save as" command giving it a different name and keep going.
Reply
#4
Hi @mnrvovrfc
Thanks for trying..and on Linux through Wine ..i guess..
Spiral Linux KDE  - never heard
so you are brave Wink 

You paid to much attention to AurelEdit(microA) version
yes may look weird but this editor is mouse centric.
And yes files are auto-saved each time you click on RUN button
undo work well so far for me .
Prime number program is same on Windows..it is a glitch with decimal numbers
with intermediate results..blame on me Rolleyes

You said ...graphic window ..yes it is only one present in micro(A)
in fact it is ordinary GUI window with double-buffering GDI graphic.
thanks !
Reply
#5
I think i smell robot
 [Image: grin.png]
this is updated example with robot and hero
but without plants just to test scanning all 360 cells.

Code: (Select All)
'gdi demo aka CrazyRobot
ptr img0,img1,img2,img3
ptr wmKeyDown
var wp,ix,iy,p,ex,ey,run
var lx,ly,bx,by,cell, tmpx,tmpy,tmpCell,robotCell
var moveLeft,moveRight,moveUp,moveDown,moveTemp
wcolor 0,0,0:swap
'LoadImage(0, strRes, imgType, imgW, imgH, cFlag)
LoadImg img0,"grid.bmp"  ,0, 770,482, 24
'green blocks
LoadImg img1,"bush.bmp"  ,0, 32,32, 24
'print 10,200,img1
LoadImg img2,"hero.bmp",0, 32,32, 24
'print 10,250,img2
LoadImg img3,"robot.bmp",0, 32,32, 24
'print 10,300,img3
'ShowImgT img3,300, 300, 40, 40
info()
bx = 128 : by = bx + 32
updateBush()
'init positions..........................
ex = 32 : ey = 0 : robotCell = 2

run = 1
'main loop
WHILE run = 1

hWparam wp
'vkLEFT -----------------------------------
if wp = 37
  if ix > 0 : ix = ix - 32 : endif
endif

'vkRIGHT ?----------------------------------
if wp = 39
  if ix < 736 : ix = ix + 32 : endif
endif

'vkUP --------------------------------------
if wp = 38
    if iy > 0 : iy = iy - 32 :endif
endif

'vkDOWN --------------------------------------
if wp = 40
    if iy < 420 : iy = iy + 32 :endif
endif

    updateBack() 
    updatePlayer()
    updatePosition()
    updateBush()
    updateRobot()
    'testCollision()
 
swap
' tiny delay for game loop
p=1 : while p < 800 : p=p+0.1 : wend

WEND


func updatePosition()
  fcolor 80,80,100    : rect 524,512,68,24 
  fcolor 100,160,220  : print 530,514,ix
  fcolor 80,80,100    : rect 610,512,68,24
  fcolor 100,160,220  : print 612,514,iy
  'calculate player cell position using sprite upper/left pixel pos
  tmpx = int((ix + 32) / 32)
  'tmpy = int((iy + 32) / 32)
  tmpy = int(iy/32) + 1
  'calc temp cell
  'tmpCell = tmpx + tmpy
  tmpCell = int(iy/32)*24 + int(ix/32) + 1
 
  fcolor 180,100,50  : rect 306,512,68,24 : print 310,514, tmpx
  fcolor 180,100,50  : rect 406,512,68,24 : print 410,514, tmpy
  'show cell number
  fcolor 50,170,100  : rect 206,512,68,24 : print 210,514, tmpCell
 
  updateBush()

endfn
'----------------------------------------
func updateBack()
ShowImgT img0,0,0,770,482
endFn
'----------------------------------------
func updatePlayer()
  ShowImgT img2,ix,iy,32,32 
endFn
'-----------------------------------------
func updateRobot()

    if robotCell = 360 : robotCell = 2 : ex = 32 : ey = 0 : endif         

    if robotCell < 361
                   
        'calc x,y position to cell
          ex = (ex + 32)
          cell = (robotCell % 24)*24
   
        if cell = robotCell :  ey = ey + 32 : ex = 0  : endif
        robotCell = robotCell + 1
        cell = 0
    endif
 
  'show robot
  ShowImgT img3, ex, ey, 32, 32
 
endfn
'----------------------------------
func updateBush()
  ShowImgT img1,bx,by,32,32
endFn

'*********************************************
'***  I N F O  ******************************
'*********************************************
func info()
'clear screen
fcolor 0,0,0 : rect 6,518,200,32 :

fcolor 200,180,100: print 10,520,"GDI_Robot by Aurel"

'swap
endfn

func LoadCells() 
    grid()
endFn

func grid()
'clear screen
fcolor 0,0,0 : rect 0,0,800,512 :

'draw shadows
ly=0
While ly < 480
      'draw by X
      lx=0
      While lx < 768     
        fcolor 60,80,60 : rect lx,ly,32,32
        cell = cell + 1 : fcolor 60,60,60: print lx,ly,cell : swap
        lx = lx + 32
      Wend
ly = ly + 32
Wend
swap
endfn
Reply
#6
Here is better prime numbers
where fraction results are stored in array:
Code: (Select All)
'prime numbers using fraction() - micro(A) by Aurel
var k,max,c,y,fr,p,n,pk,i
var fa[20]
wcolor 0,0,0 : bcolor 0,0,0:fcolor 230,230,130
print 10,5,"prime numbers micro(A) by Aurel"
print 10,25,"num       prime    fraction"
fcolor 130,220,220
n=0 : max = 20 : y=20 : c=0
fr = 0.0000

while n < max
  y=y+20 : print 10,y,n
  n=n+1
  c=0:i=0
    while i < n
    '---------------------------------
    i=i+1  :
    fr = frac(n/i) : fa[i] = fr
       'print 200,y,fr :swap : 
        if fr = 0
            c=c+1
        endif
      'swap
    wend
    '----------------------------------
   if c = 2
      p = n
      print 100,y,p
   endif
swap
wend
'call fn prime()
prime()
'-------------------
func prime()
p=1 : y=40
while p < 20
  y=y+20
  print 200,y,fa[p]

  p=p+1
wend
endfn
'--------------------
print 300,4,"Primes with fraction -> frac()..." :swap


Attached Files Image(s)
   
Reply
#7
fixing more examples ..here is one
called Guess_My_Number
still need some tweak.. Angel 

Code: (Select All)
'guess my number ? micro(A)
ptr hbox ,hImg,hb
ptr wmKeyDown, wmCommand,wmMouseMove
str sText, cStr , resText
var  wp,keyN ,tx ,ty ,turn ,newGame , randNumber , result
'LoadImage(0, strRes, imgType, imgW, imgH, cFlag)
LoadImg hImg,"crazyNumbers.bmp"  ,0, 264,236, 24
wcolor 200,190,200 : swap
cStr = "test text"
'syntax INPUTBOX handle , x,y,w,h,text
ShowImgT hImg,400,80,264,236 :swap
INPUTBOX hbox , 10, 350, 300, 23 , "enter number (1-10)"
print 10,10,"GUESS THE NUMBER ...in micro(A) v10"
print 10,40,"press key N for NEW GAME!"
GETTEXT hbox , sText
print 10,400, sText : swap
ty = 50
print 400,40,"NEW GAME":swap
fcolor 220,200,150 : rect 470,38,30,24 : print 480,40,newGame : swap

label begin

While newGame = 0

hWparam keyN
'vkN -> 78
if keyN = 78
   setfocus hbox
   if newGame = 0
      newGame = 1
      'set random number
      randNumber = RAND(10)
      'show rand number
      fcolor 120,150,120 : rect 8,428,30,24 : print 14,430,randNumber :swap
      'set turn to 1
      turn = 1
     fcolor 220,200,150 : rect 470,38,30,24 : print 480,40,newGame : swap
     goto exit
   endif
endif
swap

Wend


'events.................
WinMsg wmCOMMAND
'in this case hWparam is LoWord(wParam) -> control ID
hWparam wp

'if is -> IDOK / which is 1
If wp = 1
if newGame = 1
   tx = 10 : ty = ty + 20
   get_text()
   get_result()
   fcolor 0,0,0 : print tx,ty,result : print (tx + 40) ,ty , resText
   swap
   'show turn
    fcolor 190,190,210 : rect 10,458,20,21 : print 14,460,turn :swap
   'check if turn > 3 then reset game
   if turn = 4
      newGame = 0
      SETTEXT hbox,"END"
      setfocus 0
     ' goto begin
   endif
endif
endif

'ESC key 'IDCANCEL
if wp = 2
   newGame = 0 : SETTEXT hbox,"Press key N for new game"
   setfocus 0 : setfocus hbox: goto begin
endif

EndWm

WinMsg wmMouseMove
   if newGame = 0 : swap: endif
EndWM
'......................
func get_text()
    GETTEXT hbox, sText 
endfn
'......................
func get_result()
     result = VAL(sText)
     'test typed number
     print 50,430, result
     '1.
     if result > randNumber
        resText = "result is larger than number!" 
     endif
     '2.
     if result < randNumber
        resText = "result is lower than number!" 
     endif
     '3.
     if result = randNumber
        resText = "BINGO..you guess the number!" 
     endif
     turn = turn + 1
endfn
'-------------------------------------------
label exit
Reply
#8
just tiny observation on @mnrvovrfc complain about key-short

for example like this one:
Some keybindings are:
----------------------------------------------------------------------------------
Ctrl+C/Ctrl+Ins: copy.
Ctrl+V/Shift+Ins: paste.
Ctrl+X/Shift+Del: cut.
Ctrl+Z, Ctrl+Y: undo/redo.
Tab, Shift+Tab: indent/unindent.
Ctrl+E: toggle comment.
Ctrl+A: select all.
Shift+Arrow: extend selection.
Ctrl+F: find.
Ctrl+R: replace.
Ctrl+G: go to line.
Ctrl+Back/Alt+Back, Ctrl+Del: erase one word left/right.
Ctrl+Left/Alt+Left, Ctrl+Right/Alt+Right: move one word left/right.
Ctrl+Shift+Up/Alt+Shift+Up, Ctrl+Shift+Down/Alt+Shift+Down: move selected lines up/down.
Ctrl+N: create new document.
Ctrl+O: "open file" dialog.
Ctrl+S: save document.
Ctrl+W: close focused document.
F6, Shift+F6: next/previous document (in MRU order).
Ctrl+Q/Alt+X: exit the application.
--------------------------------------------------------------------------------

MY ANSWER to this things is :
Really ..who have time and energy to learn and remeber all this things.
Logically it is easier to use toolbar buttons and menu for task .
Reply
#9
You are correct. But remember there are other programmers that hate to use the mouse if there's a keystroke shortcut available. The QB64 IDE is very much keyboard oriented. Only the help system and the ASCII table require doing a lot with the mouse. It could be convenient, but not while trying to type in hundreds of lines of source code.

Another thing is somebody finding it hard to tell one icon from another, especially those for file save, file load and stuff like that. Or wants to know why there is build, make, run and thinks to himself/herself, "Gee whiz, why can't they just give me a big rounded run button?" Press [F5] in QBasic was the easiest thing to remember, before icons appeared on the same screen as menus, of what used to be a text-mode application.

We're both far removed from the masters of "Vim". They could call themselves "golfers" but I digress, the only great golfer I have ever seen was Ricky Fowler, and otherwise one of the Korean ladies that won LGPA a few years ago. Those guys don't want to see clickable icons anywhere near their Linux terminals. Wink
Reply
#10
well i must say that i never do any programming in QBasic
yes ..i never use DOS , my first OS was win98 heh
also i never use Vim ..ouch
Reply




Users browsing this thread: 9 Guest(s)