QBasic 3-D Graphics Forum
 


Here is ,qb64 animation

by (Login GarryRicketson)
R

Hope thats ok, it isn't qbasic, it is for qb64,? the drawings are kind of sketcy or crude, which is something I admire about the graphic The Bob dose, he takes the time to finish them real nice,...hopefully one day like when I retire (just 5 years away)I can take the time to do them better,..
any here is the code
------------ code below --------
REM Much thanks to Unseen, and his "useing a sprite sheet" tutorial, so it code I used to do this.

SCREEN _NEWIMAGE(600, 400, 32)
WINDOW SCREEN(200, 100)-(420, 250)
volume = 1 '
gamestart = False '
intromusic = _SNDOPEN("Walking_1.wav", "VOL") '
_SNDVOL intromusic, volume '
_SNDLOOP intromusic '
PRINT " Music, Garry"
_DELAY 1
PRINT " MY DRAWINGS "
_DELAY 1

TYPE Rectangle
X AS INTEGER
Y AS INTEGER
Width AS INTEGER
Height AS INTEGER
END TYPE

Sprite& = _LOADIMAGE("Dibujo.png")
'// GARY SAYS The sprite we are using has 49 frames, it has 10 frames on the X axis and 5 on the Y axis.
'// As we are dealing with an equally spaced sprite sheet we can load all the x/y points in a set of for loops.
DIM SpriteImageRect(50) AS Rectangle
FOR j% = 0 TO _HEIGHT(Sprite&) - (_HEIGHT(Sprite&) / 6) STEP (_HEIGHT(Sprite&) / 6)
FOR i% = 0 TO _WIDTH(Sprite&) - (_WIDTH(Sprite&) / 2) STEP (_WIDTH(Sprite&) / 2)
SpriteImageRect(rectcnt%).X = i%
SpriteImageRect(rectcnt%).Y = j%
SpriteImageRect(rectcnt%).Width = _WIDTH(Sprite&) / 2
SpriteImageRect(rectcnt%).Height = _HEIGHT(Sprite&) / 6
rectcnt% = rectcnt% + 1
NEXT
NEXT
DO
'// Draw the images in turn.skip the last image as it is blank.
FOR i% = 0 TO 11
_PUTIMAGE (200, 100)-(420, 250), Sprite&, , (SpriteImageRect(i%).X, SpriteImageRect(i%).Y)-(SpriteImageRect(i%).X + SpriteImageRect(i%).Width, SpriteImageRect(i%).Y + SpriteImageRect(i%).Height)
_DISPLAY
_DELAY .2 '////this is the _delay, can be changed to fit the music
kb$ = INKEY$
IF kb$ = CHR$(27) THEN SYSTEM
NEXT
LOOP
---------------- end code ------------
This is the "sprite sheet",
[linked image]
You can either substitute any music you like, or if you want the sound/music I used:
DropBox:https://dl.dropboxusercontent.com/u/15387474/QB64_DanceingBoy.zip

Edited: Note, I just checked this, and the "sprite sheet"image, as it is from photo bucket,is not to good,all though it dose work, it is kind of blurry, the one in the zipped file at drop box should be better.





From Garry
http://creativeminds.webege.com/SMF/index.php



    
This message has been edited by GarryRicketson on Jun 14, 2013 6:32 PM
This message has been edited by GarryRicketson on Jun 14, 2013 6:27 PM

Posted on Jun 14, 2013, 6:00 PM

Respond to this message   

Return to Index


Love it! I got the one from Dropbox - music great, drawings fun. More! More!

by (Login qb432l)
Graphics-Forum

*

Posted on Jun 14, 2013, 7:17 PM

Respond to this message   

Return to Index


My Smiley

by (Login GarryRicketson)
R

This is a smiley I made,
[linked image]
don't know if it will work here though.
Looks like it did !
From Garry
http://creativeminds.webege.com/SMF/index.php



    
This message has been edited by GarryRicketson on Jun 14, 2013 1:55 PM

Posted on Jun 14, 2013, 1:55 PM

Respond to this message   

Return to Index


Amazing! Did you use some "Smiley creating software", or what?

by (Login qb432l)
Graphics-Forum

*

Posted on Jun 14, 2013, 3:00 PM

Respond to this message   

Return to Index


How I made the smiley

by (Login GarryRicketson)
R

No, not a software for smileys, but a software program for animations, called ARTOONIX
http://www.artoonix.com/
It is capable of doing complete animations,or cartoons, I enjoy it,if there is a limit to frames, I have not found it,you can go up to 1,000 +,..when finished, it has a option to compile as a .gif or SWF video, and you can include sound recordings, however with .gif no sound.
The smiley, is only actually 4 or 5 frame, I don't remember maybe six. It could be done also with animax, or qb64 too, how ever, to put on a web site, or as I did post it here, it pretty much needs to be a .gif
I have a graphics tablet, which helps a lot on doing the drawings,..but I think ideally a scanner, would be best, and then one could do the drawings on paper, scan the sheets,then compile the pages into a .gif . That is what I like the artoonix program for the most, I really don't like the drawing or paint program it has, but it is great to compile images, as you can import the frame, they can be .bmp, png jpg etc,..If I remember correctly, I used a program called Pencil,
http://www.pencil-animation.org/
to do the drawings. or I may have used a DOS paint program I have.Pencil is free, open source, Artoonix has a pretty good demo for free (share whare), but to get all the features it is $35.

Just a few days ago, I did do a goose, flying, with animax, the drawings are not to good, but the movement works good, wings flapping etc, I am still working on that,it is working on qb64,
Thanks for the compliment happy.gif
I will get back later,..

From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 14, 2013, 4:53 PM

Respond to this message   

Return to Index


*Thanks for the software info -- I'll try them out.

by (Login qb432l)
Graphics-Forum

*

Posted on Jun 14, 2013, 7:18 PM

Respond to this message   

Return to Index


Your Welcome

by (Login GarryRicketson)
R

I have often wondered, the " Artoonix " software, is really pretty simple, basic,..but good especially for someone just learning.
Now my coding ability, with qb64 and qbasic is pretty limited, but it seems to me like a similar program could be done with qb64,like a clone,
Animax, is pretty neat, excellent for sprites, I like it too, for it's simplicity,..
However, for some of the things I would want to do, I need to be able to do more then 16 frames,
Anyway, it seems like I never get enough time to do all the things I would like to do,...kind of just rambling now, so anyway thanks, hope maybe they (the software) gives you some ideas,..

From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 21, 2013, 6:19 PM

Respond to this message   

Return to Index


*You're

by grammer not-z (no login)

Posted on Dec 21, 2013, 5:05 PM

Respond to this message   

Return to Index


* grammar

by (no login)

http://www.network54.com/Realm/TheBob_files/smiles/newspaper.gif
http://www.network54.com/Realm/TheBob_files/smiles/soapbox.gif

Posted on Dec 25, 2013, 10:09 AM

Respond to this message   

Return to Index


Animax

by (Login GarryRicketson)
R

I tried compileing Animax,with qb64 for Linux, but am having trouble the the mouse subs,
---------- code below -----------
SUB HideMOUSE

LB = 2
MouseDRIVER LB, 0, 0, 0 '///This is the line that it says is the error,can not compile.

END SUB

FUNCTION InitMOUSE

LB = 0
MouseDRIVER LB, 0, 0, 0
InitMOUSE = LB

END FUNCTION
-------------------- end code --------
I tried some things, but keep getting the
"cat got the mouse",... so I need to get the "cat" out of my sytem,.!
Thanks,
from Garry
edited,..I don't know if it matters, but my mouse is a USB mouse. Also it seems like a long time ago, I had the same problem, and you had a solution, that turned out to be quite simple, but I don't remember, and searched old posts,but didn't find it,anyway thanks again.
2nd edit: Animax dose run fine with dosbox,from my qbasics dir, so at least I do have it, and can run it from there.


From Garry
http://creativeminds.webege.com/SMF/index.php



    
This message has been edited by GarryRicketson on Jun 6, 2013 9:32 PM
This message has been edited by GarryRicketson on Jun 6, 2013 7:01 PM
This message has been edited by GarryRicketson on Jun 6, 2013 6:57 PM

Posted on Jun 6, 2013, 6:48 PM

Respond to this message   

Return to Index


Yeah, sorry about that, Garry...

by (Login qb432l)
Graphics-Forum

Animax was written in QB45 using CALL ABSOLUTE mouse routines. It used to run alright in earlier versions of QB64 but not in the latest version.

Here's a copy of the .EXE that I created when it still ran in QB64:

https://www.dropbox.com/s/ghti1npf6vnqjif/animax.exe

Before running it however, run the following program (axgfx.bas) in QB64 -- it's a utility that creates the graphics for Animax (make sure they're both in the same directory).

https://www.dropbox.com/s/854e3ui5eixdf6i/axgfx.bas

Let me know how it works out,

-Bob [linked image]

Posted on Jun 7, 2013, 1:29 AM

Respond to this message   

Return to Index


Ok thanks

by (Login GarryRicketson)
R

But I think that would be for windows,however, it may run with "wine",...if not no big deal,like I said I can run it with dos box

From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 7, 2013, 8:21 AM

Respond to this message   

Return to Index


No, it will run in Windows...

by (Login qb432l)
Graphics-Forum

Like I say, it was compiled in QB64, but in an earlier version that still accepted CALL ABSOLUTE mouse routines, hence it will run in Windows. The version I'm linking to is on my desktop as I speak.

Speaking of which, here's a link to the Animax desktop icon in case you want to impress your friends.

https://www.dropbox.com/s/cow61tvkicquc36/ANIMAX.ICO

There's also a QBG icon in the QBG.ZIP file if you want to use it.

These icons won't be used automatically by Windows, so they must be installed manually. You probably already know how to do that, but for those who don't: right click the current desktop icon/click Properties/click Change Icon/Click Browse and then navigate to the directory where the icon is stored. Select it, then click OK/Apply/OK.

-Bob [linked image]

Posted on Jun 7, 2013, 12:12 PM

Respond to this message   

Return to Index


I am using Linux, but

by (Login GarryRicketson)
R

But I am wondering, which older qb64 version you used ?, If there was also a Linux version at that time, that might work for me, to compile it with that.
On the Icon, thanks, and there is a way to attach Icons with Linux, I don't remember very well, but I saw something about that in a linux tutorial,
Ok well for now that is about it,....this was just my lunch break,...
I am anxious to try doing some animations, though, since Animax works fine with DosBox, I can still use it to do them, and then I can still used the finished animation, in QB64,..so it is no big deal. I will get back later when I have something to show.

From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 7, 2013, 2:03 PM

Respond to this message   

Return to Index


Yeah, too bad - I forgot about Linux...

by (Login qb432l)
Graphics-Forum

The version I used to compile it doesn't show its version number, but I installed it in 2010, if that helps.

Good luck - hope there was a Linux compiler back then. Well, at least you have DOSBox, like you say.

-Bob [linked image]



    
This message has been edited by qb432l on Jun 7, 2013 6:53 PM

Posted on Jun 7, 2013, 6:46 PM

Respond to this message   

Return to Index


Thanks

by (Login GarryRicketson)
R

2010, ok, I will take a look,that is right about the same time I started using Linux, too, so I may be in luck on that.

From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 7, 2013, 8:41 PM

Respond to this message   

Return to Index


QBG2 ICON

by (Login GarryRicketson)
R

Here is the (QBGRAPHICS tutorial) qbg2 folder with the icon , on Linux,
[linked image]

From Garry
http://creativeminds.webege.com/SMF/index.php

Posted on Jun 7, 2013, 10:44 PM

Respond to this message   

Return to Index


*Wow! Looks great - thanks for posting it :-)

by (Login qb432l)
Graphics-Forum

*

Posted on Jun 8, 2013, 1:26 AM

Respond to this message   

Return to Index


Could this be done without the spritesheet

by (Login GarryRicketson)
R

I am not sure if I should post the code here, with the sprite sheet, so for now I am going to just post a link, to where I had posted it on the qb64.net forum.
What I am wondering is if it would be possible/practical, to do this without the sprite sheet. Or any better way to do it.
The letters used would not necessarily have to look exactly the same, but, they should be big.

http://www.qb64.net/forum/index.php?topic=7086.msg80554#msg80554
At the bottom of the post is a link to the sprite sheet, basicly, I am just wondering if anyone has any better ideas as to how to do the graphics part of this.

Thanks from Garry

Posted on Dec 27, 2012, 7:20 PM

Respond to this message   

Return to Index


instead of a sprite sheet, you could put them in an array

by mn64 (no login)

you could even locate 1,1, print the letter you wanted, use FOR Y=0 to 15 : FOR X=0 to 8: p = point(x, y): NEXT: NEXT to get the pixels you wanted to draw a letter, and then post them as squares using LINE (newerx, newery) - STEP (5, 5), p, bf for the larger version.

it just depends what you want to achieve (self contained program in one file?) and what sacrifices you're willing to make.

Posted on Dec 27, 2012, 7:39 PM

Respond to this message   

Return to Index


Ok , selfcontained, is my goal

by (Login GarryRicketson)
R

Self contained would be nice, saying "you could", well, if I knew how I could, I am really tired at the moment, I will see what I can figure out, I am thinking (if I remember right) there are some examples, in TheBobs tutorial, also, but I need to down load it again, I used to have it but can not find it.
Thanks, from Garry

Posted on Dec 27, 2012, 8:55 PM

Respond to this message   

Return to Index


Not sure what you're looking for Garry...

by (Login qb432l)
Graphics-Forum

'Did you mean a self-contained keyboard graphic?

SCREEN 12
_FULLSCREEN

PALETTE 4, 63

FOR A = 167 TO 455 STEP 24
LINE (A, 100)-(A + 24, 166), 7, B
PAINT (A + 10, 110), 15, 7
NEXT A
FOR A = 166 TO 478 STEP 24
LINE (A, 166)-(A + 1, 165), 0
LINE (A + 1, 165)-(A + 2, 166), 0
PSET (A + 1, 166), 0
NEXT A
LINE (167, 95)-(479, 97), 4, BF
FOR A = 186 TO 450 STEP 24
IF A = 234 THEN A = 258
IF A = 306 THEN A = 330
IF A = 402 THEN A = 426
LINE (A, 100)-(A + 10, 150), 0, BF
LINE (A + 2, 100)-(A + 2, 142), 7
LINE (A + 2, 141)-(A + 8, 142), 15, BF
NEXT A

'-Bob [linked image]

Posted on Dec 27, 2012, 10:52 PM

Respond to this message   

Return to Index


letters would help, here are a few

by mn64 (no login)

screen 12
'license: creative commons cc0 1.0 (public domain)
'author: mennonite
do
locate 1, 1
letterwidth = 7 ' 7 times the usual width
letterheight = 10 ' 10 times the usual height
letterwidth = int(rnd * 10)
letterheight = int(rnd * letterwidth * .7 + .7)
lettercolor = int(rnd * 15 + 1)
randomize timer ' make rnd work better... below
print mid$("abcdefghijklmnopqrstuvxyz", int(rnd*26+1), 1)
'you could use chr$(int(rnd*26+65)) but this is easier to edit
newplaceforletterx = int(rnd * int((640 - letterwidth) / letterwidth))
newplaceforlettery = int(rnd * int((480 - letterheight) / letterheight))
for getly = 0 to 15
for getlx = 0 to 8
p = point(getlx, getly)

if p <> 0 then
pset(newplaceforletterx * letterwidth + getlx * letterwidth, newplaceforlettery * letterheight + getly * letterheight), p
'line -step(letterwidth, letterheight), p, bf
line -step(letterwidth, letterheight), lettercolor, bf
end if

next
next
sleep 2
loop until inkey$ = chr$(27)

Posted on Dec 27, 2012, 11:02 PM

Respond to this message   

Return to Index


Neat Key Board

by (Login GarryRicketson)
R

------------
Thanks Bob,
That it pretty neat , I like it.
Actually though, what I am looking for is a way to do the letters, or the graphics for them, as self contained graphics.
What I have is a "little program", I did for my grandaughter, she is 2 years old(almost),
In that program, when she presses the "a" key, on the computer key board, it loads a "A", that is hand drawn, at this point the "program", has
A thru K, on a sprite sheet, When and if she hits A, t it displays the A, and also uses SOUND to play a tone, (not really is exactly the note A,musicly, just a tone sound),
Ok at this point the 10 letters are on a sprite sheet. I am attaching the sprite sheet.
What I would like to do is figure out how to do this without the sprite sheet, the images "self contained", instead of always having to include the sprite sheet.

[linked image]

Posted on Dec 28, 2012, 8:56 PM

Respond to this message   

Return to Index


This is the progran

by (Login GarryRicketson)
R

Hope it is ok , here is the .bas for it,
------ code below -----
REM
DEFINT A-Z

CONST TRUE = -1, FALSE = 0

SCREEN 12

GOSUB LoadPic
_PUTIMAGE , Sprites&, 0
Done = FALSE

DO
_LIMIT 30

GetKey$ = UCASE$(RIGHT$(INKEY$, 1))
IF LEN(GetKey$) = 0 THEN
' skip as is blank
ELSE
GetKey% = ASC(GetKey$)
PRINT GetKey%
GOSUB ShowLetter
END IF
_DISPLAY
LOOP UNTIL Done
SLEEP
SYSTEM

LoadPic:
Sprites& = _LOADIMAGE("LTRsprtsht.bmp")
IF Sprites& = -1 THEN
PRINT "Picture NOT found"
dummy$ = INPUT$(1)
SYSTEM
ELSE
PicWidth& = _WIDTH(Sprites&)
PicHeight& = _HEIGHT(Sprites&)
SingleLetterWidth& = PicWidth& \ 5
SingleLetterHeight& = PicHeight& \ 2
'PRINT PicWidth&, PicHeight&
'PRINT SingleLetterWidth&, SingleLetterHeight&
END IF
RETURN

ShowLetter:
SELECT CASE GetKey%
CASE 27 'Escape
Done = TRUE
CASE 65 'A or a
_PUTIMAGE , Sprites&, 0, (0, 0)-(SingleLetterWidth& - 1, SingleLetterHeight& - 1)
SOUND 300, 4
CASE 66 'B or b
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 1, 0)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 1, SingleLetterHeight& - 1)
SOUND 400, 4
CASE 67 'C or c
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 2, 0)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 2, SingleLetterHeight& - 1)
SOUND 500, 4
CASE 68 'D or d
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 3, 0)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 3, SingleLetterHeight& - 1)
SOUND 600, 4
CASE 69 'E or e
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 4, 0)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 4, SingleLetterHeight& - 1)
SOUND 700, 4
CASE 70 'F or f
_PUTIMAGE , Sprites&, 0, (0, SingleLetterHeight&)-(SingleLetterWidth& - 1, (SingleLetterHeight& - 1) + SingleLetterHeight& * 1)
SOUND 800, 4
CASE 71 'G or g
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 1, SingleLetterHeight&)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 1, (SingleLetterHeight& - 1) + SingleLetterHeight& * 1)
SOUND 900, 4
CASE 72 'H or h
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 2, SingleLetterHeight&)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 2, (SingleLetterHeight& - 1) + SingleLetterHeight& * 1)
SOUND 1000, 4
CASE 73 'I or i
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 3, SingleLetterHeight&)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 3, (SingleLetterHeight& - 1) + SingleLetterHeight& * 1)
SOUND 1130, 4

CASE 74 'J or j
_PUTIMAGE , Sprites&, 0, (SingleLetterWidth& * 4, SingleLetterHeight&)-((SingleLetterWidth& - 1) + SingleLetterWidth& * 4, (SingleLetterHeight& - 1) + SingleLetterHeight& * 1)
SOUND 1200, 4
CASE ELSE
CLS
END SELECT
RETURN

----------- End Code ---------
So anyway, that is the idea of the "program", the only graphics are the letters,
The letter graphics, don't have to be like the ones I drew, but , big, and colorful, or "bright",
I can not seem to get it to "paste", correctly.The long lines keep getting "wrapped", ???
Thanks though ,
from Garry

Posted on Dec 28, 2012, 9:16 PM

Respond to this message   

Return to Index


Works pretty well, Garry...

by (Login qb432l)
Graphics-Forum

In QB, I would have captured each character using graphics GET, and then stored each image at a different index in an array, then BSAVE'd the array. When the program ran, it would load the array using BLOAD, and each image would be PUT at the appropriate location using its corresponding index.

To be honest, I've never use QB64's _PUTIMAGE capability. If you want to learn more about my method, grab another copy of my tutorial and check out Lesson 8 on GET, PUT, BSAVE and BLOAD.

As for "self-contained", you can always draw the characters from DATA. In other words, in a utility program with the image on the screen, simply scan the image using an x/y loop and write the attribute numbers to a sequential file. Then open the file in QB64, copy it, and paste it into your final program as DATA.

When your program runs, it will then READ and PSET the images using an x/y loop with the original values, then GET the characters individually to an array. Do all of this with all attributes set to zero to hide the activity. Then erase the image and set the palette values (or simply use PALETTE if you're not using custom colors). Your main program then begins (this first part should happen almost instantaneously in QB64).

-Bob [linked image]



    
This message has been edited by qb432l on Dec 29, 2012 12:20 AM
This message has been edited by qb432l on Dec 28, 2012 10:29 PM
This message has been edited by qb432l on Dec 28, 2012 10:27 PM

Posted on Dec 28, 2012, 10:19 PM

Respond to this message   

Return to Index


grab another copy of my tutorial

by (Login GarryRicketson)
R

Ok, thanks,
I did download the tuturial, and see, what I can do." in a utility program with the image on the screen, simply scan the image using an x/y loop and write the attribute " Do you know where I can get the "utility" ? to do that.
from Garry

Posted on Dec 29, 2012, 6:36 AM

Respond to this message   

Return to Index


I should have specified ...

by (Login qb432l)
Graphics-Forum

I meant for YOU to write the utility. Just place the image, establish its dimensions, then write an x/y loop such as:

OPEN "Image.BAS" FOR OUTPUT AS #1
FOR x% = x1 TO x2 'use integers for speed
FOR y% = y1 TO y2
n = n + 1
IF n (less-than symbol) 30 THEN
WRITE #1, POINT(x, y),
'Note that there's a comma following the WRITE line
ELSE
WRITE #1, POINT(x, y)
'Note that there is NO comma after the WRITE line
n = 0
END IF
'The above IF block makes rows of 30 DATA per row
NEXT y%
NEXT x%
CLOSE #1

Then, when you open "Image.BAS" in QB64 (or QB), you will see something like this:

0,0,1,0,15,0,2,2,3,3,15,3 ...etc.

Now highlight and copy the numbers and paste them into your program and create rows with the word DATA in front, such as:

ImageDATA:
DATA 0,0,1,0,15,2,2,3,3,15,3 ...etc.

Make certain that the last number of each row DOESN'T have a comma behind it!

Then, at the top of your program, put in an x/y loop using the same values as the original:

RESTORE ImageDATA
FOR x% = x1 TO x2
FOR y% = y1 TO y2
READ Value
PSET (x, y), Value
NEXT y%
NEXT x%

That will reproduce the original image on the screen in your finished program. From there it's just a matter of GET'ting each number to a seperate index in the array. Then just CLS and start your program. Like I say, the PSET/GET stuff should finish in an instant.

How to size the array as well as the individual image sections is all in the tutorial.

-Bob [linked image]



    
This message has been edited by qb432l on Dec 29, 2012 9:39 AM

Posted on Dec 29, 2012, 9:35 AM

Respond to this message   

Return to Index


How to Write my own utility

by (Login GarryRicketson)
R

Ok, that is interesting, I didn't think it was that simple, I will try this, see how it goes,
If I understand correctly, then:

---------
IF n (less-than symbol) 30 THEN
WRITE #1, POINT(x, y),
'Note that there's a comma following the WRITE line
ELSE
WRITE #1, POINT(x, y)
-------
Where it says POINT(x, y) The x and y, would be values , that determine or " establish its dimensions" Sit might be something like,

WRITE #1, POINT(25, 25), If it is a 25 x 25 image,
Once I try this, I will probabley understand better,..thanks a bunch,

Posted on Dec 29, 2012, 12:53 PM

Respond to this message   

Return to Index


Just to clarify...

by (Login qb432l)
Graphics-Forum

Copy and paste this, then run it:

SCREEN 12
FOR x = 20 TO 99
FOR y = 20 TO 99
PSET(x, y), 12
NEXT y
NEXT x

The idea is that the x and y at some point represent the coordinates of every pixel in that 80x80 square. In the first x/y loop of your utility, you're checking the attribute number of every pixel in your image (using POINT) and writing it to the file, then the same loop PSET's every pixel in the original color.

Experiment with it a little, you'll get the idea. For example, try changing the PSET line in the above loop to this:

IF x MOD 5 = 0 THEN PSET(x, y), 12

-Bob [linked image]

Posted on Dec 29, 2012, 4:43 PM

Respond to this message   

Return to Index


*thanks, that helps!

by (Login GarryRicketson)
R

Posted on Dec 29, 2012, 6:40 PM

Respond to this message   

Return to Index


new version of (simple) old program from 1990-something

by mn64 (no login)

i learned circle and pset in screen 12 around 1990-ish. it didn't lead to any ground-breaking programs, and this isn't one, either.

it's a simple randomized DRAW program. i didn't dig up the code for the "original" version (didn't need to) but i post it here because i'm tickled how qb64 handles the rgb function when you're using DRAW. it's beyond me why you see VARPTR$ for stuff like this.

no matter how many times i read about VARPTR$ i can't figure out the point of using it. i've never had a situation where replacing it with STR$ didn't work. i'm not saying there isn't a reason to use it, only that i don't know what reason it is. this version is better in several ways than the first. i especially like how it reminds me of the dragon spiral much of the time.

'license: creative commons cc0 1.0 (public domain)

screen _newimage(500, 500, 32)
randomize timer

do while inkey$ <> chr$(27)
cls

for p = 1 to int(100 * (rnd * 100 + 1))

if int(rnd * 50) = 0 or x = 0 then
r = int(rnd * 256)
g = int(rnd * 256)
b = int(rnd * 256)
x = 1
end if
dir$ = mid$("udrl", int(rnd * 4 + 1), 1)
draw "c" + str$(_rgb(r, g, b)) + dir$ + "5"

next

sleep 2
loop

Posted on Dec 17, 2012, 12:17 AM

Respond to this message   

Return to Index


you can have so much fun tweaking stuff like this-- here's the "oils" version

by mn64 (no login)

'randraw64
'2012 mennonite
'license: creative commons cc0 1.0 (public domain)

screen _newimage(500, 500, 32)
randomize timer

do while inkey$ <> chr$(27)
r = int(rnd * 256)
g = int(rnd * 256)
b = int(rnd * 256)
cls

for p = 1 to int(140 * (rnd * 100 + 1))

if int(rnd * 50) = 0 or x = 0 then
x = 1
end if
dir$ = mid$("udrl", int(rnd * 4 + 1), 1)

for z = 1 to 4
r = (r + int(rnd * 7 - 3)) mod 256
g = (g + int(rnd * 7 - 3)) mod 256
b = (b + int(rnd * 7 - 3)) mod 256
draw "c" + str$(_rgb(r, g, b)) + "b" + dir$ + "1"
circle step(0,0),5 ,_rgba(r,g,b,128)
next

next

sleep 2
loop

Posted on Dec 17, 2012, 1:03 AM

Respond to this message   

Return to Index


and finally... the "elbow" version

by mn64 (no login)

'randaround64
'2012 mennonite
'license: creative commons cc0 1.0 (public domain)

screen _newimage(500, 500, 32)
randomize timer

do
r = int(rnd * 256)
g = int(rnd * 256)
b = int(rnd * 256)
cls

for p = 1 to int(70 * (rnd * 40 + 1))

if int(rnd * 50) = 0 or x = 0 then
x = 1
end if
dir$ = mid$("udrl", int(rnd * 4 + 1), 1)

for z = 1 to 16
r = (r + int(rnd * 9 - 4)) mod 256
g = (g + int(rnd * 9 - 4)) mod 256
b = (b + int(rnd * 9 - 4)) mod 256
t=t+8
if t>360 then t = 1
draw "ta" + str$(t) + "c" + str$(_rgb(r, g, b)) + "b" + dir$ + "4"
circle step(0,0), 5, _rgba(r, g, b, 128)
circle step(1, 1), 5, _rgba(r, g, b, 128)
circle step(-1, 0), 5, _rgba(r, g, b, 128)
circle step(0, -1), 5, _rgba(r, g, b, 128)
next

next

sleep 2
loop until inkey$ = chr$(27)

Posted on Dec 17, 2012, 1:43 AM

Respond to this message   

Return to Index


Great stuff...

by (Login qb432l)
Graphics-Forum

I must admit I love the oil version -- it's amazing how much it looks like oil paint. A few years ago the (then) forum owner Mac and I worked on a random oil-painting program that was fascinating to watch, but it didn't have the three-dimensional color quality that yours have (SCREEN 13/256 colors).

-Bob [linked image]

Posted on Dec 17, 2012, 4:50 AM

Respond to this message   

Return to Index


favor to ask of thebob

by mn64 (no login)

this has nothing to do with graphics, and i invite you to delete the topic when you've read it. this isn't because i'm so concerned about topic-ness (a reasonable amount of it goes a long way) but because it will truly serve no purpose afterwards.

i've thought about this, because i haven't been part of the community for a long time, and i wasn't sure how it would go. so you know, you'd be an accomplice (heh...) but i think the worst case scenario (i'm not being a pessimist here) is that if things didn't work out fine anyway, you'd occasionally get ribbed by pete (which is an empty threat, since it occasionally happens to everyone already.)

short version: galleon only checks email, and no one can join the qb64 forum until he does. i don't use email. if you could send him one: "galleondragon aaaaaht gmail dott com" is the only one i know, there's an @qb64.net address too.

tell him "fixinupthebuggy" isn't spam and have him approve the account, he assumes they're spam unless he gets an email. (it hasn't been rejected yet.) if you want to keep a clear conscience, you can warn him it's me :) and may god have mercy on your soul... ;)

Posted on Dec 13, 2012, 7:56 AM

Respond to this message   

Return to Index


*Done :-).

by (Login qb432l)
Graphics-Forum

*

Posted on Dec 13, 2012, 12:34 PM

Respond to this message   

Return to Index


But TheBOB is already ribbed...

by Dom, Con (no login)



for her pleasure!

Dom [linked image]

Posted on Dec 17, 2012, 6:50 PM

Respond to this message   

Return to Index


*LOL - not sure how you knew that, but yeah - the surgery's no fun, though.

by (Login qb432l)
Graphics-Forum

*



    
This message has been edited by qb432l on Dec 18, 2012 2:28 AM

Posted on Dec 17, 2012, 10:36 PM

Respond to this message   

Return to Index


"A little birdie told me."

by Pete (no login)


It's amazing what they will mistake for a perch!

Pete [linked image]

Posted on Dec 18, 2012, 10:15 AM

Respond to this message   

Return to Index


any public domain rgb->hsv routines out there?

by mn64 (no login)

math is a funny thing. computer programs could have been like recipes (equally difficult to copyright) but the government (industry) decided to treat them more like books or music.

sure, math is free, but once you take an equation and name the variables (blame higher-level-lan... no, blame lower-level-lawyers) it becomes subject to copyright AND patent law. (the latter is especially absurd, and it wasn't like that until 1990/91.)

even if some idiot patented rgb->hsv, patent would have expired by now, but i'm curious if there's an easy equation handy. in the time it took to type this, i probably could have found one on my own, but that's only a guess. i'm curious anyway.

Posted on Dec 13, 2012, 7:13 AM

Respond to this message   

Return to Index


textmode-flavor graphics routines (plus free example code)

by mn64 (no login)

' textmode-flavor graphics routines (plus free example code)
' including gprint, glocate, gcolor, gbackcolor, gscale
' 2012 mennonite
' license: creative commons cc0 1.0 universal
' (public domain) http://creativecommons.org/publicdomain/zero/1.0/

' q. why license your code?
'' 1. the whole "without a copyright notice it's public domain" thing
'' '' hasn't been true since the 1970's
'' 2. in some countries, people can't use your "public domain" code
'' hence, cc0. it's the formal version of wikipedia's pd dedication

' q. what about other free software licenses?
'' those are fine, too. if you use those, you better ensure
'' that your code is free for everyone to use now, and years later
' q. but i want to charge money!
'' there is *nothing wrong* with charging money for free software.
'' you just can't stop people from making copies/changes, free of charge.

' q. you should donate to qb64!
'' absolutely!
' q. get on with the code, already!
'' this will be shorter next time! here is code:

screen 12 ' the following works in other screen modes, too
gcolor 9 ' same as in screen 0

glocate 1, 1 ' same as locate statement in screen 0
gscale 2 ' 2x2 pixel width

gprint ""
gprint("00000000000000000000000000")
gprint("00000000000000000000000000")
gprint("00000000x000000xxx00x00x00")
gprint("00000000x00000x00000x00x00")
gprint("000xx000xxx000xxx000xxxx00")
gprint("00x00x00x00x00x00x00000x00")
gprint("000xxx000xx0000xx000000x00")
gprint("00000x00000000000000000000")
gprint("00000x00000000000000000000")

glocate 3, 1
box$(1) = "_88888888888888888888888888"
box$(2) = "eeeeeeeeeeeeeeeeeeeeeeeeee"
boxside$(1) = "_8________________________8"
boxside$(2) = "e________________________e"
for boxes = 1 to 2
gprint box$(boxes)
for r = 1 to 7
gprint boxside$(boxes) ' print transparent box over / on top of text
next r
gprint box$(boxes)
glocate 2, 1
next boxes

glocate 7, 1
gcolor 14
gscale 5
gprint ""
gprint("___11111111111111111111111111")
gprint("____11111111x111111xxx11x11x11")
gprint("_____11111111x11111x11111x11x11")
gprint("______111xxx11xxxx11xxxx11xxxx11")
gprint("_______11x11x11x11x11x11x11111x11")
gprint("________11xxx111xxx111xxx111111x11")
gprint("_________1111x111111111111111111111")
gprint("__________1111x111111111111111111111")
gprint("___________11111111111111111111111111")

glocate 60, 1
gcolor 13
gscale 1
gprint ""
gprint("_____11111111111111111111111111")
gprint("______11111111x111111xxx11x11x11")
gprint("_______11111111x11111x11111x11x11")
gprint("________111xxx11xxxx11xxxx11xxxx11")
gprint("_________11x11x11x11x11x11x11111x11")
gprint("__________11xxx111xxx111xxx111111x11")
gprint("___________1111x111111111111111111111")
gprint("____________1111x111111111111111111111")
gprint("_____________11111111111111111111111111")

end

sub gscale(s):
shared gscalep
gscalep = int(s)
end sub

sub gcolor(c):
shared gcolorp
gcolorp = c
end sub

sub gbackcolor(c):
shared gbackcolorp
gbackcolorp = c
end sub

sub glocate(row, column):
shared gposxp
shared gposyp
gposyp = row
gposxp = column
end sub

sub gprint(p$):
shared gscalep
shared gposxp, gposyp
shared gcolorp, gbackcolorp
' # means "use the foreground color here."
' . means "use the background color here."
' _ means "transparent - don't draw this block at all" (you can layer!)
' 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f means "do color attribute 0 to 15."
' any letter after f: "use the foreground color here."
if gscalep < 1 then gscalep = 1
pcolorp = gcolorp
for p = 1 to len(p$):
select case lcase$(mid$(p$, p, 1))
case "#", "g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"
pcolorp = gcolorp
case "."
pcolorp = gbackcolorp
case "_"
pcolorp = -1
case "0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"
pcolorp = instr("0123456789abcdef", lcase$(mid$(p$, p, 1))) - 1
end select
if not pcolorp = -1 then
if gscalep > 1 then
line ((gposxp - 1) * gscalep, (gposyp - 1) * gscalep)-STEP(gscalep - 1, gscalep - 1), pcolorp, bf
else:
pset (gposxp, gposyp), pcolorp
end if
end if
glocate gposyp, gposxp + 1
next p
gposxp = 1
glocate gposyp + 1, 1 'gposyp = gposyp + 1
end sub

Posted on Dec 5, 2012, 9:27 PM

Respond to this message   

Return to Index


*Good stuff! Yayyy QB64!

by (Login qb432l)
Graphics-Forum

*

Posted on Dec 6, 2012, 3:51 AM

Respond to this message   

Return to Index


i hope it works in qbasic too...

by mn64 (no login)

i never used sub much unless the program was big enough, i just didn't need local scope or protected variables and it was extra typing :)

qb64 feels very strange with regards to subs. i'm sure it runs qbasic programs just fine in this regard, my "concern" is that qb64 is actually more flexible, and either the subs or the calls to them are written in a way that isn't compatible.

ordinarily, i wouldn't care. for these routines, i hoped they were very close to usuable in qbasic, if not the whole 100%. i'm not going to start testing things for compatibility in dosbox, but if you're running them in qbasic and they give you an error, i'd like to hear about it-- along with the line number, if you get one.

Posted on Dec 6, 2012, 5:04 AM

Respond to this message   

Return to Index


*Runs fine in QBasic (under DOSBox), though more slowly, of course.

by (Login qb432l)
Graphics-Forum

*

Posted on Dec 6, 2012, 7:02 AM

Respond to this message   

Return to Index


*hooray! thanks

by mn64 (no login)

Posted on Dec 6, 2012, 2:55 PM

Respond to this message   

Return to Index


Liked this,

by (Login GarryRicketson)
R

I liked this, it just now caught my interest, it worked good, with qb64/linux, I also run qbasic from DosBox, for linux, but have not yet tried it, but I am sure it would,
from Garry

Posted on Dec 27, 2012, 6:50 PM

Respond to this message   

Return to Index


glad!

by mn64 (no login)

was going to do a demo using the logo, then remembered i only made a 16-color version of this thing. you could do a version with more colors, but it might make it more complicated.

this isn't meant to be an incredible demo, it's meant to help people move from text-only programs to graphical ones. but it could inspire cooler stuff, i'm sure of it.

Posted on Dec 27, 2012, 7:41 PM

Respond to this message   

Return to Index


a graphical eye for the textmode guy

by mn64 (no login)

a series of graphics statements that work more like text mode:

if you want to print a smiley face in text mode, you can just do this:

print ".....####....."
print "...##....##..."
print "..#........#.."
print ".#.(o)..(o).#."
print "#............#"
print "#..(......)..#"
print ".#..(____)..#."
print "..#........#.."
print "...##....##..."
print ".....####....."

likewise, these statements work in graphics mode. but why do you need pset or line to do the same thing on a pixel scale? all it should take is:

gprint(".....####.....")
gprint("...##....##...")
gprint("..#........#..")
gprint(".#..##..##..#.")
gprint("#............#")
gprint("#..#......#..#")
gprint(".#..##..##..#.")
gprint("..#...##...#..")
gprint("...##....##...")
gprint(".....####.....")

i'm not knocking pset and line, i've loved them for decades. they don't seem to get a lot of love on the forum, though. you should really be able to do this:

gcolor(14, 1)
glocate(05, 5): gprint(".....####.....")
glocate(06, 5): gprint("...##....##...")
glocate(07, 5): gprint("..#........#..")
glocate(08, 5): gprint(".#..##..##..#.")
glocate(09, 5): gprint("#............#")
glocate(10, 5): gprint("#..#......#..#")
glocate(11, 5): gprint(".#..##..##..#.")
glocate(12, 5): gprint("..#...##...#..")
glocate(13, 5): gprint("...##....##...")
glocate(14, 5): gprint(".....####.....")

consider what it would take to do that with pset, and which one is more noob-friendly?

(not to mention pete-friendly. pete doesn't do graphics, not even to underline text. not even when you write the subroutine for him.)

but this idea goes beyond just pset, because pset doesn't scale. (what?) if you can do huge blocks with print, and single pixels with pset, you should be able to do something in between with gprint:

gcolor(14, 1)
gscale(4)
glocate( 5, 5): gprint(".....####.....")
glocate( 6, 5): gprint("...##....##...")
glocate( 7, 5): gprint("..#........#..")
glocate( 8, 5): gprint(".#..##..##..#.")
glocate( 9, 5): gprint("#............#")
glocate(10, 5): gprint("#..#......#..#")
glocate(11, 5): gprint(".#..##..##..#.")
glocate(12, 5): gprint("..#...##...#..")
glocate(13, 5): gprint("...##....##...")
glocate(14, 5): gprint(".....####.....")

now instead of single dots, your image will be rendered with 4x4 pixel-width blocks.

what about color? above you see the colors "#" and "." used.

"#" means "use the foreground color here."
"." means "use the background color here."
"_" means "transparent - don't draw this block at all" (you can layer!)
"0123456789abcdef" means "do each standard color from attribute 0 to 15."
any letter after f means: "use the foreground color here."

so to do "qb64" in green on black, you could do this:

gcolor(10, 5) 'green on magenta
blankspaceonleft$ = "___________________________________"
gprint(blankspaceonleft$ + "00000000000000000000000000")
gprint(blankspaceonleft$ + "00000000000000000000000000")
gprint(blankspaceonleft$ + "00000000x000000xxx00x00x00")
gprint(blankspaceonleft$ + "00000000x00000x00000x00x00")
gprint(blankspaceonleft$ + "000xx000xxx000xxx000xxxx00")
gprint(blankspaceonleft$ + "00x00x00x00x00x00x00000x00")
gprint(blankspaceonleft$ + "000xxx000xx0000xx000000x00")
gprint(blankspaceonleft$ + "00000x00000000000000000000")
gprint(blankspaceonleft$ + "00000x00000000000000000000")

this is probably more fun than pset!

no need to worry about setting up the line statement to draw boxes the size of gscale: gprint will do that for you.

and what about circles?
glocate(5, 5)
gcircleprint("..........", 20)

will go to row 5, column 15 (at the current scale) and then draw a circle of radius 20 x gscale with that point as the center.

it would be cool to have the current scale determine how many pixels wide the circular line is: in other words, if your "pixels" are scaled at 4x4, a circle with a radius of 20 (or 3, or 50) x 4 should be made of a line which is 4 pixels wide. but that can come later.

why have a string in the gcircleprint command? it's not necessary to put that in the design, it's only for fun. if you don't want to use it:

gcircleprint("", 20) 'there, it's gone :)

but you can use it to change the spacing/alignment of your circles, like gprint. if you want.

what about squares?

gsquareprint("", 20) 'square of line-width gscale, top-left corner at current row, column. height is 20 x gscale, width is 20 x gscale.

rectangles?

grectangleprint("", 10, 12) 'of line-width gscale, top-left corner at current row, column. height is 10 x gscale. width is 12 x gscale.

but if that isn't what you want, you can always get your rectangle the gprint way:

gprint("############")
gprint("#__________#")
gprint("#__________#")
gprint("#__________#")
gprint("#__________#")
gprint("#__________#")
gprint("#__________#")
gprint("#__________#")
gprint("#__________#")
gprint("############")

when can you use gprint, gcolor, glocate, gscale, gcircleprint, gsquareprint, and grectangleprint?

when they're added to qb64? no! (but i encourage galleon to consider such extensions.)

gprint, gcolor, glocate, gscale, gcircleprint, gsquareprint, and grectangleprint are just wrappers around existing qbasic graphic statements.

you can use them in qbasic AND qb64 as soon as i've coded them. it shouldn't take much, there are a lot of people on the forum who could crank these out in an afternoon whether i bothered to write them or not.

will this revolutionize graphics in basic? probably not. will it encourage a couple people who only use text mode to try some graphics in the future? i hope so, but i'm pretty sure pete will stick with screen 0 forever.

hey, screen 0 is pretty sweet, but qb64 is sort of doing this already (it's just stuck at gscale 8 or 16, i believe.)

Posted on Dec 4, 2012, 10:23 PM

Respond to this message   

Return to Index


Not a bad idea...

by (Login qb432l)
Graphics-Forum

I agree that there is a lot of potential in text mode for graphics that most people aren't even aware of, let alone explore.

I'm assuming that the "g" commands would be calls to sub procedures that you are going to write. When I first saw them I thought you might be confusing QBasic/QB64 with another BASIC language.

Not sure if you've seen it, but click the link "Example Programs" at the top of my forum page and then scroll down to MONOPOLY BOARD. Among other things, it shows the potential of ASCII graphics in QB.

-Bob [linked image]

Posted on Dec 5, 2012, 2:25 AM

Respond to this message   

Return to Index


i love ascii, and i'll check out the monopoly game...

by mn64 (no login)

i've heard all about it, but i didn't check it out last time i was a regular. (if pete came here more, he'd have to post something like: "last time *i* was irregular...")

this may be obvious, it might be the opposite, but the statements i'm planning are graphics statements, which draw graphics in graphics mode.

i've thought for a long time that pset, circle, line etc. should work exactly the same in mode 0 as they do in other modes. in one dialect (tinybasic i think) the graphics commands work the same in mode 0.

this thread has nothing to do with that, of course. it's about using print-like and locate-like commands (along with strings) to do graphics, without "thinking" in graphics. you and i think in graphics just fine. other people might have an easier time using something like print, to do a row of pixels (or colored blocks.) it's a theory, anyway.

Posted on Dec 5, 2012, 2:36 AM

Respond to this message   

Return to Index


you forgot sol3suit.bsv

by mn64 (no login)

it's probably a separate download that i missed the link for. great monopoly board, after that i tried to see how much work it would take to get your solitaire game (1-card draw? no! 3-card draw? no, no, no!) to work in qb64. 1200+ lines (i can't believe you got that to load) is a lot of editing i probably shouldn't entertain the false likelihood of, but i finally gave up (after a few minutes) when i saw this line:

BLOAD "Sol3SUIT.BSV", VARPTR(Suits(1))

i ran unzip again to make sure it wasn't included. anyway, give you a week and qb64, and you can probably code the REST of windows 3.x, not just the card game. (i'm looking forward to thebob's notepad especially.)

i want to figure out a way that you and i can get more qb64 hobbyists to code *anything* (regardless of how useful it is) with graphics. maybe it's changed since qb64 came out, but the last i knew, most people on the forum didn't. i don't think pset and line and other stuff are so inaccessible, but there has to be a way. i'm going to work on those locate/print style commands and see if they make any sort of difference.

Posted on Dec 5, 2012, 5:56 PM

Respond to this message   

Return to Index


You have to create sol3suit.bsv...

by (Login qb432l)
Graphics-Forum

Open QB64 and switch directories to samples\thebob\sol. there you will find both Sol3.BAS and S3GFX.BAS. Run S3GFX.BAS and it will create all the graphics used by Sol3. The Sol3 link on my Example Programs page should also take you to S3GFX.BAS, or if you downloaded Sol3, the graphics utility should be included. Many of the programs I wrote in recent years have a utility program associated with them that creates all the graphics for each particular program. It basically means that everything you need is in, or created by, text files. Makes the programs much easier to simply copy from the forum.

Good luck with your "g" commands!

-Bob [linked image]

P.S. Try running S3GFX.BAS in QBasic. That way you get to see the graphics being created. In QB64 it's over right away!



    
This message has been edited by qb432l on Dec 5, 2012 7:50 PM
This message has been edited by qb432l on Dec 5, 2012 7:45 PM

Posted on Dec 5, 2012, 7:35 PM

Respond to this message   

Return to Index


*wondered what that one was for! good stuff!

by mn64 (no login)

Posted on Dec 5, 2012, 9:16 PM

Respond to this message   

Return to Index


part ONE: of guide to rotating (on 1 axis) "3d" shapes using draw + arrays without trig

by mn64 (no login)

'part ONE: of guide to rotating (on 1 axis) "3d" shapes using draw + arrays without trig
'license: creative commons zero 1.0 (public domain)
'
'advantages: you don't need to use public domain equations/code that you don't grok
'caveats: the traditional, more math-intensive way is definitely cooler
'........ you're limited to what draw can do (0-360 degrees, no minutes)
'
'how: any 2d shape you can draw from around a center point (equilateral or not) works.
'for example, a 40x40 square:
screen 12
draw "bu20 r20 d20d20 l20l20 u20u20 r20 bd20"
'up 1/2, right 1/2, down, left, up, right 1/2, down to middle again
'for simplicity's sake, we'll use a 1 second delay for the animated square:
draw "c0 bu20 r20 d20d20 l20l20 u20u20 r20 bd20" ' color 0 to erase

' degrees = 30
' for p = 0 to degrees step int(degrees / 10) ' 10-second-long "animation"
' drawthis$ = "bu20 r20 d20d20 l20l20 u20u20 r20 bd20"
' rotation$ = "ta" + str$(p) ' turn angle?
' coloron$ = "c13"
' coloroff$ = "c0"
' '
' draw coloron$ + rotation$ + drawthis$
' '
' sleep 1 ' dont undo drawing yet
' color 0
' draw coloroff$ + rotation$ + drawthis$ ' clean up before rotating and doing it again
' next
' '
' color 7 ' just in case
' sleep 1
' system
'for the next step, we'll add a the "top" square of what will be a cube.
'you're not limited to cubes, or equilateral solids. you can do pyramids,
'irregular polyhedrons, whatever you need to do. i did a christmas tree,
'for now, here are two identical squares: (they connect in part TWO)
'

degrees = 30
for p = 0 to degrees step int(degrees / 10) ' 10-second-long "animation"
drawthis$ = "bu20 r20 d20d20 l20l20 u20u20 r20 bd20"
rotation$ = "ta" + str$(p) ' turn angle?
coloron$ = "c13"
coloroff$ = "c0"
'

pset (320, 240), 0 'center of bottom square
draw coloron$ + rotation$ + drawthis$
pset (320, 240 - 30), 0 'center of top square
draw coloron$ + rotation$ + drawthis$

'
sleep 1 ' dont undo drawing yet
color 0
pset (320, 240), 0 'center of bottom square
draw coloroff$ + rotation$ + drawthis$
pset (320, 240 - 30), 0 'center of top square
draw coloroff$ + rotation$ + drawthis$ ' clean up before rotating and doing it again
next
'
color 7 ' just in case
sleep 1
system

'obviously better timing can be used, like a save-timer-and-compare loop.
'(was surprised qb64 doesn't allow decimals for sleep yet. there a _sleep command?)

Posted on Dec 4, 2012, 6:18 PM

Respond to this message   

Return to Index


Short and sweet! (more)...

by (Login qb432l)
Graphics-Forum

I replaced SLEEP 1 with _DELAY .01 and it seemed to work out. Of course, with the shorter delay it was over before I could get my feet up. Even still...

Looking forward to PART 2 (Spring 2013?).

-Bob [linked image]



    
This message has been edited by qb432l on Dec 4, 2012 6:55 PM

Posted on Dec 4, 2012, 6:55 PM

Respond to this message   

Return to Index


it shouldn't take that long

by mn64 (no login)

the main reason i split it into part one and two (and ?) is so you didn't need to have it all on one page.

i haven't written part two yet, but it's much faster to code it and make it work than it is to explain it clearly.

the main reason i limited part ONE to "degrees = 30" is i didn't want to clutter up the tutorial with a traditional loop-delay. if you swap out sleep for _DELAY (thanks for that one! i would have looked it up eventually) then you can change degrees = 30 to degrees = 360 and have a better looking demo.

connecting them isn't difficult, nor is doing other shapes. SPOLIER: you use pos(0) and pos(1) (i think... it's screen, for text mode... it's in my tutorial, i guess i need to look at the graphics chapter again) to get the current location of each corner, save those to an arraw, and line (savex, savey)-(savex2, savey2) from corner 1 to corner 2.

it's a little bit tedious, but it's not very mathematical to code. i sometimes use trig stuff now, but i always found it too intimidating. hence this method, which you can see working in my old rotating tesseract program and 3d christmas tree.

Posted on Dec 4, 2012, 7:03 PM

Respond to this message   

Return to Index


I've used the DRAW command myself for rotations...

by (Login qb432l)
Graphics-Forum

'I've never been great at trig (though sometimes you have no
'choice). Here's a program I wrote to try it out (back in my
'QBasic days, hence the homemade delay):

DEFINT A-Z
SCREEN 13

Ship$ = "BD12 L2 U3 L10 E10 U5 R U4 R NU5 R D4 R D5 F10 L10 D3 L3 BU5 P12,12"
Erase$ = "BD12 L2 U3 L10 E10 U5 R U4 R NU5 R D4 R D5 F10 L10 D3 L3 BU5 P0,0"

x = 160: y = 100 'set to suit

DRAW "S12" '<----- change to a number between 4 and 12 to adjust scale

DO
Angle$ = "TA" + LTRIM$(STR$(Degree))
PSET (x, y), 12
DRAW Angle$ + Ship$
StartTIME! = TIMER: DO: LOOP WHILE TIMER < StartTIME! + .01
WAIT &H3DA, 8
PSET (x, y), 0
DRAW Angle$ + Erase$
Degree = Degree + 6
IF Degree = 360 THEN Degree = 0
LOOP WHILE INKEY$ = ""

'-Bob



    
This message has been edited by qb432l on Dec 4, 2012 9:33 PM
This message has been edited by qb432l on Dec 4, 2012 9:32 PM
This message has been edited by qb432l on Dec 4, 2012 9:29 PM

Posted on Dec 4, 2012, 9:27 PM

Respond to this message   

Return to Index


sweet! incidentally...

by mn64 (no login)

if i'd noticed the 3d forum, i would have put the 3d tutorial there. i will put part TWO in whatever subforum part ONE is found in at the time (if you move it, if you don't) but in the future, i'll put 3d stuff where it goes.

Posted on Dec 4, 2012, 10:21 PM

Respond to this message   

Return to Index


Yes, the 3D forum...

by (Login qb432l)
Graphics-Forum

I should have directed you there myself, but it really didn't occur to me -- also I was just glad to have someone post something in my forum after so long. Last time was Clippy's "I forgot what I was going to post now..." back in May!

-Bob [linked image]



    
This message has been edited by qb432l on Dec 5, 2012 4:33 AM

Posted on Dec 5, 2012, 2:30 AM

Respond to this message   

Return to Index

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement