Question for Mark
#1
I hooked up my Android tablet to my PC with one of those USB OMG switches, or whatever they're called. I decided to download your foliage code to try it out, but me always doing things the hard way, I pasted the download into the SD card. (I made a "SmallBasic" folder for it in the card.) When I open Small Basic and search around with the the file hierarchy, I can't seem to access it. If I click "root" it bounces me right off the screen... ouch! So I hope I don't have to root the device to get to the card but I can't recall since the last time I fooled with this stuff was nearly three years ago. That's two lifetimes in old fart years. Any suggestions, other than that colloquial 4-letter acronym that starts with G and ends with S, would be appreciated. 

Pete Smile
Reply
#2
Hi Pete, 

Android pickier than Windows about where you can put files and I know less about Android than I do Windows.


With Windows File Explorer I paste into

Quote:Files in /mnt/sdcard/My Files/

as read from my SmallBASIC 1st screen that I call the navigator screen.

But when pasting in from Windows I goto "My Files" Folder which appears to be directly under root (if Android has a root.)

When running, the three vertical dots in bottom right corner are supposed to give you access to IDE, SmallBASIC editor, the equivalent to a right mouse button click, they don't respond in my NOOK. Not that I mind as writing a program with crazy keyboard would be frustrating. I will say, Chris installed font that you can size up so I can read it better than most things in Chrome (but that too is adjusted with right mouse clicks.)

BTW, Chris has replied giving directions about using port, you were asking about. I don't know, 10 steps is about 5 too many for me but I am not hot to do anything on Android for same reasons I decided not to play with the Raspberry Pi. Using a laptop is far too comfortable for a person of my age and eyesight.

Ha! foliage looks funny in NOOK the pixels are much smaller so the little squares for leaves are too small for the Lincoln Log branches. You wont need a rake, but a microscope might do!
B += x
Reply
#3
Woohoo! Got it. Mine has an extSdCard in the storage folder, which is where my device stores the sdcard files. There were a ton of other sdcard subfolders that contained nothing but this extsdcard is the one I was hunting for. Thanks for showing me how you accessed you card. Although mine is different, I tried the one that works on yours but it was empty, it gave me confidence to keep hunting for it in storage instead of trying to root the device. A "Question Mark" is a good thing!

Pete Big Grin
Reply
#4
Great! Now the million dollar question: Can you toggle back and forth from Editor and Run / Output Screen with the 3 vertical dots that appear in lower right corner on screen for  me on my device?
B += x
Reply
#5
I don't get the 3 bars either when I run the app. Here's what did work for me. I ran your fall foliage app. It displayed the image above the keyboard, no bars in sight. I tapped the right corner of the screen image, which was just above the "P" key on the keyboard display, and the menu that is associated with the 3-bar symbol opened.

Pete
Reply
#6
They aren't bars they are very tiny circles and might be specially hard to see in Fall Foliage, but if you got the pop-up window then you should be in business to edit SmallBASIC programs in Android!
B += x
Reply
#7
Sorry, I failed geometry twice. I forgot so much of it the first time that I stupidly signed up for it next semester, not remembering it was the course I just failed. Angry

Yes, three small circles, dots, whatever... let's just call them bars from now on so I can be free of those horrible geometry memories!

Pete Big Grin

PS: I'm going to try loading up the hockey one, next.
Reply
#8
Ha! SdlBasic calls solid filled rectangles bars.

So that's why there are so many bars, people needing to drown their geometric sorrows.
B += x
Reply
#9
Circles are just God's way of saying, "Look, you're back where you started!"

Hey I just tried the air hockey game. For not being in ascii, it sure is a pain in one. Too much happens too fast and on too small a screen. For starters, my family ran out of the house, because they thought that the sounds it was making was our alarm going off. I had to torch one of my wife's best hats just so I wouldn't look like an idiot when everyone came back inside. Secondly, yes, it's hard to move the paddle on the touch screen, compared to your QB64 PC version, which rocks. Because the difference in the paddle to goal ratio, the Android version can be beat simply by blocking the goal. Your QB64 one requires skill. I tried the block the goal method and lost. 

So is there a way to at least get it to run full screen or a way to tilt it horizontally? It's still pretty cool but since I played the PC QB64 version, I guess I'm just spoiled.

Pete Big Grin
Reply
#10
Interesting choice, to burn the wife's best hat.

Sure the changes can be done, this is BASIC. It would be a good exercise with SmallBASIC editor.

The only question is how quickly?

Well, probably quicker than you getting out of the dog house about the hat.

But unless you have some super fast Android device, I doubt the mouse response will match the QB64 version on a laptop.

On my device the goal seems bigger than on laptop.

Ah! I am reminded of a trick I did with Tanks game, I may try it with Bonkers. (But the feedback for Tanks was Tanks-less, oh well...)
B += x
Reply
#11
Funny thing about dog houses, they actually can get you out of marital problems. Early in our marriage, I screwed something up. I can't remember what, A) because there have been so many and B) because I'm a guy so I don't really care but anyway, she was just about to go off on me when I snapped both arms over my head in a triangular fashion. She hesitated for a minute and then exclaimed, "Oh my God, you put yourself in the dog house!" That bit has gotten me out of more problems than I can count and has worked 35 years and counting!

Pete  /\
       Big Grin

And no, Aurel, that's not a damn dunce cap!!
Reply
#12
Code:
'Bonkers too Air Hockey.bas for SmallBASIC 0.12.9 2017-04-22 (started) from
' modified for Android demo 2017-10-22
' dedicated to Pete's wife's best hat

const pr = 16                'puck radius
const pr2 = 2 * pr           'puck diameter = bumper width = radius of strikers
const tl = xmax              'table length
const tw = tl / 2            'table width
const tw13 = .3333 * tw \ 1  'goal end point
const tw23 = .6667 * tw \ 1  'goal end point
const speed = 60
const midc = (tl - 2 * pr2) \ 4    'mid point x of computer's field

computer = 0   'score
player = 0     'score
initball
'pen on
while player < 21 and computer < 21
  cls
  updateScore
  drawTable
  drawComputerStriker
  drawPlayerStriker
  drawPuck
  showpage
wend
'pen off
if computer > player then
  s = "Game Won by Hacks"
else
  s = "Game Won by Pucks"
end if
color rgb(200, 240, 140)
text (tl - txtw(s))/2, tw + 30, 26, s
showpage
delay 3000

sub initball
  px = tl/2 : py = tw/2 : pa = pi + rnd * pi/10
  rnddir = (rnd*2)\1 : if rnddir then pa = pi-pa
end

sub updateScore
  color rgb(40, 200, 255)
  s = "Hacks: " + str(computer) + space(50) +"Pucks: " + str(player)
  text (tl - txtw(s))/2, tw + 30, 26, s
end

sub drawTable
  for i = 0 to pr2 step 4
    shade = 64 + i/pr2 * 100
    color rgb(shade, shade, shade)
    rect i, i, tl-i, tw-i filled
  next                                
  rect pr2, pr2, tl - pr2, tw - pr2, rgb(190, 230, 255) filled 'field
  rect pr, tw13, pr2, tw23, rgb(60, 60, 60) filled                           'player goal
  rect tl - pr2, tw13, tl-pr, tw23, rgb(60, 60, 60) filled                   'computer goal
  rect tl \ 2 - 1, pr2, tl \ 2 + 1, tw- pr2, 8 filled          'center line
end

sub drawPlayerStriker
  c2 += pi/80

  psx = tl - midc - pr2 - (midc - pr2) * sin(c2)
  if px < psx then psy =  py + pr2 * 1.25 * sin(c2)
  if psy - pr2 < pr2 then psy =  2 * pr2
  if psy + pr2 > tw - pr2 then psy = tw - 2 * pr2
  striker psx, psy
end

sub drawComputerStriker
  c1 += pi/80
  csx = midc + pr2 + (midc-pr2) * sin(c1)
  if px > csx then csy = py + pr2 * 1.25 * sin(c1)
  if csy - pr2 < pr2 then csy = 2 * pr2
  if csy + pr2 > tw - pr2 then csy = tw - 2 * pr2
  striker csx, csy
end

sub drawPuck
  'update ball x, y and see if hit anything
  px = px + speed * cos(pa)
  py = py + speed * sin(pa)
  
  if px - pr < pr2 then
    if tw13 < py - pr and py + pr < tw23 then
      player += 1
      cls
      updateScore
      drawTable
      striker csx, csy
      striker psx, psy
      puck pr, py
      for i = 0 to pr step 4
        shade = 64 + i/pr2 * 100
        color rgb(shade, shade, shade)
        rect i, t13, pr, tw23 filled
      next  
      sound 1200, 200
      sound 2200, 300
      showpage
      initball
      delay 500
      exit sub
    else
      sound 2600, 8
      pa = pi - pa
      px = pr2 + pr
    fi
  fi
      
  if px + pr > tl - pr2 then
    if tw13 < py - pr and py + pr < tw23 then
      computer += 1
      cls
      updateScore
      drawTable
      striker csx, csy
      striker psx, psy
      puck tl-pr, py
      for i = 0 to pr step 4
        shade = 64 + i/pr2 * 100
        color rgb(shade, shade, shade)
        rect tl-pr, t13, tl-i, tw23 filled
      next
      sound 2200, 300
      sound 1200, 200
      showpage
      initball
      delay 500
      exit sub
    else
      sound 2600, 5
      pa = pi - pa
      px = tl - pr2 - pr
    fi
  fi
  
  if py - pr < pr2 then
    sound 2600, 8
    pa = -pa
    py = pr2 + pr
  fi

  if py + pr > tw - pr2 then
    sound 2600, 8
    pa = - pa
    py = tw - pr2 - pr
  end if
  
  if sqr((px-psx)^2 + (py-psy)^2) < (pr + pr2) then
    pa = atan2(py-psy, px-psx)
    sound 2200, 4
  fi
  if sqr((px-csx)^2 + (py-csy)^2) < (pr + pr2) then
    pa = atan2(py-csy, px-csx)
    sound 2200, 4
  fi        
  puck px, py
end

sub puck(x, y)
  color rgb(90, 90, 90)
  circle x, y, pr filled
  color rgb(190, 100, 0)
  circle x, y, pr - 4 filled
end

sub striker(x, y)
  local i
  for i = pr2 to pr step -1
    shade = 164 - 90 * sin((i)*2*pi/pr)
    color rgb(shade, shade, shade)
    circle x, y, i filled
  next
  for i = pr to 0 step -1
    shade = 185 + 70*(pr - i)/pr
    color rgb(shade, shade, shade)
    circle x, y, i filled
  next
end

sub text(x, y, size, s) ' a sub to make translating to SmallBASIC from SdlBasic easier
  'when this sub is used text size is altered for the rest of the run
  local l
  l.w = window() : l.w.setfont(size, "pt", 0, 0)
  at x, y : ? s
end
B += x
Reply
#13
Did I forget to mention I'm in charge of all the comedy around here? Even after my 12th cup of espresso I couldn't keep up with that.

Pete Big Grin

PS: Hey what's the create desktop icon thingy for? Will SB actually make a desktop icon to run one of these  .bas programs without starting up SB?
Reply
#14
I sped it up for Android so it wouldn't put you to sleep while watching (not meant to be watched in Windows).

Ha, I forgot to mention that, plus the fact that you just have to watch like a tennis match.


Desktop Icons? see screen shot, these?

You can rig Windows to run SB every time you click a .BAS, actually kind of handy for peeking into other .BAS files as long as you don't try and run, though wouldn't cause much harm and might even run! other .bas files.


Attached Files Thumbnail(s)

B += x
Reply
#15
All your desktop icons look alike! Oops, I guess I just might be a raciest after all.

Anyway, I'll have to mess with that after I get home from hat shopping with the wife. 

Pete Big Grin
Reply
#16
OK, Happy New Year!
B += x
Reply