Author Topic: Star Backgound  (Read 1754 times)

Re: Star Backgound
« Reply #90 on: July 01, 2018, 01:33:32 PM »
You know after I posted my question, I might have found an answer to the confusion.

It is about saving the exe with the source code, that way it has the same access to additional files as the source without having to fully path the filenames for loading files. You know that little thing you had to tick off in the Run Menu of IDE.

Maybe I should say, tick on, "Save EXE in the source folder". I remember that little thing ticked me off when I was trying out a new download of QB64, code was working but files weren't loading.
B = B + ...
QB64 x 64 v1.2 2018 0228/86 git b30af92
QB64 v1.2 20180228/86 git 6fde149
QB64 v1.2 [dev build]_d84bb00

Offline johnno56

  • Live long and prosper.
Re: Star Backgound
« Reply #91 on: July 01, 2018, 05:43:18 PM »
There ya go. I'm glad at least one of us remembered my typo... lol (by the way... I just checked... it's still ticked... lol)

J
Logic is the beginning of wisdom.

Re: Star Backgound
« Reply #92 on: October 31, 2018, 04:18:09 PM »
Vastly improved Sphere Sim:
Code: [Select]
_TITLE "Fake sphere mapping by Paul Dunn, trans from SpecBas to QB64 2018-10-31 B+"
'10  Fake sphere mapping
'20 GRAPHIC NEW t LOAD "demos:3d/lava_strip.png":gw=gfxw t,gh=gfxh t:
'   palette copy t,0,256 to 0:
'   paper rgbn(0):
'   screen lock
'30 r=scrh/2.1,xc=SCRw/2,yc=SCRh/2,xo=0:
'   do:
'      for y=-r+1 to r-1:
'         x1=sqr(r*r-y*y),
'         tv=(asn(y/r)+1.5)/3:
'         for x=-x1 to x1:
'            tu=(asn(x/x1)+1.5)/6:
'            plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc:
'         next x:
'      next y:
'      xo+=1,xo%=gw:
'      wait screen:
'      cls:
'   loop

SCREEN _NEWIMAGE(800, 600, 32)
surface& = _LOADIMAGE("martian.png")
'surface& = _LOADIMAGE("mars.png") 'this image has a color change where ends meet
'surface& = _LOADIMAGE("mars0.jpeg") 'better

gw = _WIDTH(surface&)
gh = _HEIGHT(surface&)
map& = _NEWIMAGE(gw, gh, 32)
_DEST map&
_PUTIMAGE , surface&, map&
_DEST 0

stars& = _LOADIMAGE("stars.png")
_SOURCE stars&
_DEST 0
_PUTIMAGE

r = _HEIGHT / 3
xc = _WIDTH / 2
yc = _HEIGHT / 2
xo = 0
DO
    FOR y = -r TO r
        x1 = SQR(r * r - y * y)
        tv = (_ASIN(y / r) + 1.5) / 3
        FOR x = -x1 + 1 TO x1
            tu = (_ASIN(x / x1) + 1.5) / 6
            _SOURCE map&
            pc~& = POINT((xo + tu * gw) MOD gw, tv * gh)
            _DEST 0
            PSET (x + xc, y + yc), pc~&
            'plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc
        NEXT x
    NEXT y
    xo = xo + 1
    xo = xo MOD gw
    _DISPLAY
    _LIMIT 60
    ' wait screen
    'CLS
LOOP

« Last Edit: October 31, 2018, 04:23:52 PM by bplus »
B = B + ...
QB64 x 64 v1.2 2018 0228/86 git b30af92
QB64 v1.2 20180228/86 git 6fde149
QB64 v1.2 [dev build]_d84bb00