Welcome, Guest |
You have to register before you can post on our site.
|
Latest Threads |
As technology rapidly evo...
Forum: Utilities
Last Post: Frankvab
Yesterday, 06:09 AM
» Replies: 14
» Views: 38
|
Everybody's heard about t...
Forum: Utilities
Last Post: Frankvab
Yesterday, 06:07 AM
» Replies: 22
» Views: 1,296
|
MBA Assignment Help in Du...
Forum: General Discussion
Last Post: hafsahomar
06-11-2025, 07:05 AM
» Replies: 0
» Views: 13
|
лучшие песни медляки слуш...
Forum: Petr
Last Post: WillieTop
06-08-2025, 02:21 AM
» Replies: 0
» Views: 29
|
пинк слушать онлайн беспл...
Forum: SMcNeill
Last Post: WillieTop
06-08-2025, 02:20 AM
» Replies: 0
» Views: 24
|
скачать музыку российскую...
Forum: madscijr
Last Post: WillieTop
06-08-2025, 02:18 AM
» Replies: 0
» Views: 23
|
нежная музыка mp3 скачать
Forum: Keybone
Last Post: WillieTop
06-08-2025, 02:17 AM
» Replies: 0
» Views: 25
|
лучшая песня слушать онла...
Forum: bplus
Last Post: WillieTop
06-08-2025, 02:16 AM
» Replies: 0
» Views: 28
|
пикник слушать онлайн луч...
Forum: Spriggsy
Last Post: WillieTop
06-08-2025, 02:15 AM
» Replies: 0
» Views: 23
|
какая сейчас популярная м...
Forum: RhoSigma
Last Post: WillieTop
06-08-2025, 02:14 AM
» Replies: 0
» Views: 19
|
|
|
SOLVED: need help running code from Notepad++ with the NppExec plugin |
Posted by: madscijr - 05-06-2022, 03:04 PM - Forum: Help Me!
- Replies (2)
|
 |
Hey everyone.
A while ago I asked about setting up Notepad++ to compile/debug QB64 code, and TempodiBasic graciously provided some instructions which I finally got around to trying out, only it's not (fully) working.
I'm running Windows 10 Pro with QB64 2.0.2, and Notepad++ which self-updated to v8.3.3 today and works fine.
Per the instructions, I installed the NppExec plugin, and added the QB64 folder to the system path, and rebooted.
I have a "hello world" program in my qb64 folder, e.g. - C:\Users\{username}\Documents\Code\qb64\programs\hello1.bas
which is opened in Notepad++.
I went in the Plugin menu and selected NPPExec, and configured it per the instructions
checking the options Show NppExec Console, Console Command History and Follow $(CURRENT_DIRECTORY).
Then with my program open in the editor, I pressed F6 for "Execute NppExec Script..."
and a command window opened.
I typed the command:
Code: (Select All) QB64.EXE -c "$(FULL_CURRENT_PATH)" -o "$(FULL_CURRENT_PATH)"
NPP_RUN $(CURRENT_DIRECTORY) && $(NAME_PART) && ".exe"
and saved it, and clicked OK.
A DOS window opens and it looks like QB64 is compiling my code
(so far so good) and then Windows opens the \qb64\programs\ folder in Explorer,
and I can see my program now has an EXE file created with the current date/time.
In Notepad++, the NppExec console has:
QB64.EXE -c "C:\Users\{username}\Documents\Code\qb64\programs\hello1.bas" -o "C:\Users\{username}\Documents\Code\qb64\programs\hello1.bas"
Process started (PID=8892) >>>
<<< Process finished (PID=8892). (Exit code 0)
NPP_RUN: C:\Users\{username}\Documents\Code\qb64\programs && hello1 && ".exe"
================ READY ================
The problem is the EXE is compiled but not being run (I have to double-click on it to actually execute it, and it does work).
Is there anything I should change or add to the F6 command to make NppExec actually run the code once it's compiled?
I checked my Windows Security & antivirus and am not seeing any warnings or anything, so I don't think that's the issue.
Any help much appreciated...
|
|
|
Boolean Algebra |
Posted by: TarotRedhand - 05-06-2022, 11:44 AM - Forum: Learning Resources and Archives
- Replies (11)
|
 |
Some years ago I wrote a tutorial on this topic for the scripting community of Neverwinter Nights. I have now gone through this and edited it to make it relevant for QB64. As I am new to QB64, I would appreciate it if someone will download it, read it and let me know of any errors that they come across no matter how small. The package contains 2 pdf documents (the readme and the 20 page tutorial), an HTML cheat sheet and a plain text document of pre-calculated constants.
Dropbox Link removed - Download link to newer, more accurate version on page 2 of this thread.
All comments welcome.
Thanks.
TR
|
|
|
image unroller |
Posted by: James D Jarvis - 05-05-2022, 09:26 PM - Forum: Programs
- Replies (3)
|
 |
A simple little image unroller that does an image reveal like a scroll being unrolled. Someone posted an example in a facebook group in their dialect of basic asking if other forms of basic could handle it. So I whipped this up.
Code: (Select All) ' Picture unroller
img& = _LoadImage("hexmap0001.jpg", 32) 'your image here
w = _Width(img&)
h = _Height(img&)
sc& = _NewImage(w, h, 32)
Screen sc&
Cls: s = 3
For yc = 0 To h Step s:
_Limit 30
_PutImage (0, 0), img&, sc&, (0, 0)-(w, yc)
_PutImage (0, yc - 6)-(w, yc + 6), img&, sc&, (0, yc)-(w, yc + 3)
Next yc
|
|
|
How can I read characters from the screen? |
Posted by: hanness - 05-05-2022, 09:16 PM - Forum: General Discussion
- Replies (4)
|
 |
Assume that I am initializing my display like this:
_FullScreen _Off , _Smooth
_FreeImage oldimage&
Font& = _LoadFont(FontPath$, FontSize, "MONOSPACE")
_Font Font&
Now I write a bunch of text to the screen.
Later, I want to read the character at the upper left of the screen. I tried to do this like this:
print screen(1,1)
or
MyVar$ = CHR$(screen(1,1))
However, I'm getting an illegal function call when the line with screen(1,1) is executed.
Is this only valid with screen mode 0 or am I missing something here?
If this cannot be made to work, is there any other way to read characters from the screen?
|
|
|
List of QB64 Constants? |
Posted by: dcromley - 05-05-2022, 04:49 PM - Forum: Help Me!
- Replies (5)
|
 |
Is there a list of QB64 constants, like _PI=3.14..?
Also, 1/0 gives INF and -1/0 gives -INF. Are there INF and -INF constants?
This code is just some experimenting (some garbage in the 2nd line of output - no problem).
Code: (Select All) DefLng I
DefSng F
On Error GoTo zerr
Print _Pi
fhi = 1 / 0
flo = -1 / 0
Print "div by 0 - float:", fhi; flo
ihi = 1 / 0
ilo = -1 / 0
Print "div by 0 - long integer:", ihi, ilo
Print "Sqr(-1)= "; Sqr(-1)
zerr:
Print Chr$(13) + "Err"; Err; "in line"; _ErrorLine
End
|
|
|
QB64 Surabikku - Sliding block puzzle |
Posted by: Dav - 05-05-2022, 04:39 PM - Forum: Dav
- Replies (11)
|
 |
QB64 Surabikku is a clone of an online sliding block puzzle I was playing called Surabikku. Click the arrows to slide the blocks until the puzzle board looks the same as the smaller image shown. Simple to play but not so simple to solve. May update this to use images instead of blocks, one day.
- Dav
EDIT: bplus made an update to this puzzle, you can find it HERE. Thanks, bplus!
Code: (Select All) '=============
'SURABIKKU.BAS
'=============
'QB64 version of a SURABIKKU like puzzle.
'Use Arrows to slide pieces so board matches the solved image.
'Coded by Dav, MAY/2022
SCREEN _NEWIMAGE(1024, 675, 32)
'=== define deminsions for board
DIM SHARED row, col, size: row = 3: col = 3: size = 175
DIM SHARED boxes: boxes = row * col
'=== define box value, x/y, values...
DIM SHARED bv&(boxes) 'box values (scrambled)
DIM SHARED slv&(boxes) 'box values (solved)
DIM SHARED bx1(boxes), by1(boxes) 'top x/y cords of box
DIM SHARED bx2(boxes), by2(boxes) ' bottom x/y cords of box
'=== make color box images
DIM SHARED red&, blu&, grn&
red& = _NEWIMAGE(size, size, 32): _DEST red&: CLS , _RGB(255, 0, 0)
blu& = _NEWIMAGE(size, size, 32): _DEST blu&: CLS , _RGB(0, 0, 255)
grn& = _NEWIMAGE(size, size, 32): _DEST grn&: CLS , _RGB(0, 255, 0)
_DEST 0: _DISPLAY
'=== init box x.y values
bc = 1 'counter
FOR r = 1 TO row
FOR c = 1 TO col
x = 75 + (c * size): y = 75 + (r * size)
bx1(bc) = x - size: bx2(bc) = x ' generate x/y values
by1(bc) = y - size: by2(bc) = y
bc = bc + 1
NEXT
NEXT
'=== assign scrambled up box values
bv&(1) = red&: bv&(2) = grn&: bv&(3) = red&
bv&(4) = blu&: bv&(5) = grn&: bv&(6) = blu&
bv&(7) = grn&: bv&(8) = blu&: bv&(9) = red&
'=== assign solved box values
slv&(1) = red&: slv&(2) = red&: slv&(3) = grn&
slv&(4) = red&: slv&(5) = blu&: slv&(6) = grn&
slv&(7) = blu&: slv&(8) = blu&: slv&(9) = grn&
'=== draw puzzle
CLS , _RGB(32, 32, 32)
FOR b = 1 TO boxes
_PUTIMAGE (bx1(b), by1(b))-(bx2(b), by2(b)), bv&(b)
LINE (bx1(b), by1(b))-(bx2(b), by2(b)), _RGB(0, 0, 0), B
NEXT
'=== print info
PPRINT 668, 28, 25, _RGB(128, 128, 128), 255, "QB64 SURABIKKU"
PPRINT 665, 25, 25, _RGB(255, 255, 0), 255, "QB64 SURABIKKU"
PPRINT 725, 75, 20, _RGB(128, 128, 128), 255, "Click Arrow."
PPRINT 725, 110, 20, _RGB(128, 128, 128), 255, "Move Blocks."
PPRINT 725, 250, 20, _RGB(255, 255, 255), 255, "Make it like:"
'=== draw solved puzzle on right
_PUTIMAGE (725, 300)-(800, 375), slv&(1)
_PUTIMAGE (800, 300)-(875, 375), slv&(2)
_PUTIMAGE (875, 300)-(950, 375), slv&(3)
_PUTIMAGE (725, 375)-(800, 450), slv&(4)
_PUTIMAGE (800, 375)-(875, 450), slv&(5)
_PUTIMAGE (875, 375)-(950, 450), slv&(6)
_PUTIMAGE (725, 450)-(800, 525), slv&(7)
_PUTIMAGE (800, 450)-(875, 525), slv&(8)
_PUTIMAGE (875, 450)-(950, 525), slv&(9)
'=== draw top arrows
FOR t = 0 TO 450 STEP 175
LINE (130 + t, 55)-(160 + t, 25), _RGB(128, 128, 128)
LINE (160 + t, 25)-(190 + t, 55), _RGB(128, 128, 128)
LINE (130 + t, 55)-(190 + t, 55), _RGB(128, 128, 128)
NEXT
'=== draw bottom arrows
FOR t = 0 TO 450 STEP 175
LINE (130 + t, 620)-(160 + t, 650), _RGB(128, 128, 128)
LINE (160 + t, 650)-(190 + t, 620), _RGB(128, 128, 128)
LINE (130 + t, 620)-(190 + t, 620), _RGB(128, 128, 128)
NEXT
'=== draw left arrows
FOR t = 0 TO 450 STEP 175
LINE (20, 160 + t)-(50, 130 + t), _RGB(128, 128, 128)
LINE (20, 160 + t)-(50, 190 + t), _RGB(128, 128, 128)
LINE (50, 130 + t)-(50, 190 + t), _RGB(128, 128, 128)
NEXT
'=== draw right arrows
FOR t = 0 TO 450 STEP 175
LINE (620, 130 + t)-(650, 160 + t), _RGB(128, 128, 128)
LINE (620, 190 + t)-(650, 160 + t), _RGB(128, 128, 128)
LINE (620, 130 + t)-(620, 190 + t), _RGB(128, 128, 128)
NEXT
_DISPLAY
slidespeed = 300
DO
IF _MOUSEBUTTON(1) = 0 THEN clicked = 0
mi = _MOUSEINPUT: mx = _MOUSEX: my = _MOUSEY
IF _MOUSEBUTTON(1) = -1 AND clicked = 0 THEN
clicked = 1
'===== if top-left button clicked...
IF mx > 75 AND mx < 250 AND my > 0 AND my < 75 THEN
'=== slide column up
FOR y = 0 TO size
'=== just move bottom two images up
_PUTIMAGE (bx1(4), by1(4) - y), bv&(4)
_PUTIMAGE (bx1(7), by1(7) - y), bv&(7)
'=== expand bottom location with top image
_PUTIMAGE (bx1(7), by2(7) - y)-(bx2(7), by2(7)), bv&(1)
'=== redraw boxes around them, for looks
LINE (bx1(1), by1(1))-(bx2(1), by2(1)), _RGB(0, 0, 0), B
LINE (bx1(4), by1(4))-(bx2(4), by2(4)), _RGB(0, 0, 0), B
LINE (bx1(7), by1(7))-(bx2(7), by2(7)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(1): t2& = bv&(4): t3& = bv&(7) 'old values
bv&(1) = t2&: bv&(4) = t3&: bv&(7) = t1& 'new values
END IF
'===== if bottom-left button clicked...
IF mx > 75 AND mx < 250 AND my > 600 AND my < 675 THEN
'=== slide column down
FOR y = 0 TO size
'=== expand top location with bottom image
_PUTIMAGE (bx1(1), by1(1))-(bx2(1), by2(1) + y), bv&(7)
'=== just move top two images down
_PUTIMAGE (bx1(1), by1(1) + y), bv&(1)
_PUTIMAGE (bx1(4), by1(4) + y), bv&(4)
'=== redraw boxes around them, for looks
LINE (bx1(1), by1(1))-(bx2(1), by2(1)), _RGB(0, 0, 0), B
LINE (bx1(4), by1(4))-(bx2(4), by2(4)), _RGB(0, 0, 0), B
LINE (bx1(7), by1(7))-(bx2(7), by2(7)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(1): t2& = bv&(4): t3& = bv&(7) 'old values
bv&(1) = t3&: bv&(4) = t1&: bv&(7) = t2& 'new values
END IF
'===== if top-middle button clicked...
IF mx > 250 AND mx < 425 AND my > 0 AND my < 75 THEN
'=== slide column up
FOR y = 0 TO size
'=== just move bottom two images up
_PUTIMAGE (bx1(5), by1(5) - y), bv&(5)
_PUTIMAGE (bx1(8), by1(8) - y), bv&(8)
'=== expand bottom location with top image
_PUTIMAGE (bx1(8), by2(8) - y)-(bx2(8), by2(8)), bv&(2)
'=== redraw boxes around them, for looks
LINE (bx1(2), by1(2))-(bx2(2), by2(2)), _RGB(0, 0, 0), B
LINE (bx1(5), by1(5))-(bx2(5), by2(5)), _RGB(0, 0, 0), B
LINE (bx1(8), by1(8))-(bx2(8), by2(8)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(2): t2& = bv&(5): t3& = bv&(8) 'old values
bv&(2) = t2&: bv&(5) = t3&: bv&(8) = t1& 'new values
END IF
'===== if bottom-middle button clicked...
IF mx > 250 AND mx < 425 AND my > 600 AND my < 675 THEN
'=== slide column down
FOR y = 0 TO size
'=== expand top location with bottom image
_PUTIMAGE (bx1(2), by1(2))-(bx2(2), by2(2) + y), bv&(8)
'=== just move top two images down
_PUTIMAGE (bx1(2), by1(2) + y), bv&(2)
_PUTIMAGE (bx1(5), by1(5) + y), bv&(5)
'=== redraw boxes around them, for looks
LINE (bx1(2), by1(2))-(bx2(2), by2(2)), _RGB(0, 0, 0), B
LINE (bx1(5), by1(5))-(bx2(5), by2(5)), _RGB(0, 0, 0), B
LINE (bx1(8), by1(8))-(bx2(8), by2(8)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(2): t2& = bv&(5): t3& = bv&(8) 'old values
bv&(2) = t3&: bv&(5) = t1&: bv&(8) = t2& 'new values
END IF
'===== if top-right button clicked...
IF mx > 425 AND mx < 600 AND my > 0 AND my < 75 THEN
'=== slide column up
FOR y = 0 TO size
'=== just move bottom two images up
_PUTIMAGE (bx1(6), by1(6) - y), bv&(6)
_PUTIMAGE (bx1(9), by1(9) - y), bv&(9)
'=== expand bottom location with top image
_PUTIMAGE (bx1(9), by2(9) - y)-(bx2(9), by2(9)), bv&(3)
'=== redraw boxes around them, for looks
LINE (bx1(3), by1(3))-(bx2(3), by2(3)), _RGB(0, 0, 0), B
LINE (bx1(6), by1(6))-(bx2(6), by2(6)), _RGB(0, 0, 0), B
LINE (bx1(9), by1(9))-(bx2(9), by2(9)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(3): t2& = bv&(6): t3& = bv&(9) 'old values
bv&(3) = t2&: bv&(6) = t3&: bv&(9) = t1& 'new values
END IF
'===== if bottom-right button clicked...
IF mx > 425 AND mx < 600 AND my > 600 AND my < 675 THEN
'=== slide column down
FOR y = 0 TO size
'=== expand top location with bottom image
_PUTIMAGE (bx1(3), by1(3))-(bx2(3), by2(3) + y), bv&(9)
'=== just move top two images down
_PUTIMAGE (bx1(3), by1(3) + y), bv&(3)
_PUTIMAGE (bx1(6), by1(6) + y), bv&(6)
'=== redraw boxes around them, for looks
LINE (bx1(3), by1(3))-(bx2(3), by2(3)), _RGB(0, 0, 0), B
LINE (bx1(6), by1(6))-(bx2(6), by2(6)), _RGB(0, 0, 0), B
LINE (bx1(9), by1(9))-(bx2(9), by2(9)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(3): t2& = bv&(6): t3& = bv&(9) 'old values
bv&(3) = t3&: bv&(6) = t1&: bv&(9) = t2& 'new values
END IF
'===== if left-top button clicked...
IF mx > 0 AND mx < 75 AND my > 75 AND my < 250 THEN
'=== slide column left
FOR x = 0 TO size
'=== just move right two images left
_PUTIMAGE (bx1(2) - x, by1(2)), bv&(2)
_PUTIMAGE (bx1(3) - x, by1(3)), bv&(3)
'=== and expand far right location with far left image
_PUTIMAGE (bx2(3) - x, by1(3))-(bx2(3) - x, by2(3)), bv&(1)
'=== redraw boxes around them, for looks
LINE (bx1(1), by1(1))-(bx2(1), by2(1)), _RGB(0, 0, 0), B
LINE (bx1(2), by1(2))-(bx2(2), by2(2)), _RGB(0, 0, 0), B
LINE (bx1(3), by1(3))-(bx2(3), by2(3)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(1): t2& = bv&(2): t3& = bv&(3) 'old values
bv&(1) = t2&: bv&(2) = t3&: bv&(3) = t1& 'new values
END IF
'===== if right-top button clicked...
IF mx > 600 AND mx < 675 AND my > 75 AND my < 250 THEN
'=== slide column left
FOR x = 0 TO size
'=== just move left two images right
_PUTIMAGE (bx1(1) + x, by1(1)), bv&(1)
_PUTIMAGE (bx1(2) + x, by1(2)), bv&(2)
'=== and expand far left location with far right image
_PUTIMAGE (bx1(1), by1(1))-(bx1(1) + x, by2(1)), bv&(3)
'=== redraw boxes around them, for looks
LINE (bx1(1), by1(1))-(bx2(1), by2(1)), _RGB(0, 0, 0), B
LINE (bx1(2), by1(2))-(bx2(2), by2(2)), _RGB(0, 0, 0), B
LINE (bx1(3), by1(3))-(bx2(3), by2(3)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(1): t2& = bv&(2): t3& = bv&(3) 'old values
bv&(1) = t3&: bv&(2) = t1&: bv&(3) = t2& 'new values
END IF
'===== if left-middle button clicked...
IF mx > 0 AND mx < 75 AND my > 250 AND my < 425 THEN
'=== slide column left
FOR x = 0 TO size
'=== just move right two images left
_PUTIMAGE (bx1(5) - x, by1(5)), bv&(5)
_PUTIMAGE (bx1(6) - x, by1(6)), bv&(6)
'=== and expand far right location with far left image
_PUTIMAGE (bx2(6) - x, by1(6))-(bx2(6) - x, by2(6)), bv&(4)
'=== redraw boxes around them, for looks
LINE (bx1(4), by1(4))-(bx2(4), by2(4)), _RGB(0, 0, 0), B
LINE (bx1(5), by1(5))-(bx2(5), by2(5)), _RGB(0, 0, 0), B
LINE (bx1(6), by1(6))-(bx2(6), by2(6)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(4): t2& = bv&(5): t3& = bv&(6) 'old values
bv&(4) = t2&: bv&(5) = t3&: bv&(6) = t1& 'new values
END IF
'===== if right-middle button clicked...
IF mx > 600 AND mx < 675 AND my > 250 AND my < 425 THEN
'=== slide column left
FOR x = 0 TO size
'=== just move left two images right
_PUTIMAGE (bx1(4) + x, by1(4)), bv&(4)
_PUTIMAGE (bx1(5) + x, by1(5)), bv&(5)
'=== and expand far left location with far right image
_PUTIMAGE (bx1(4), by1(4))-(bx1(4) + x, by2(4)), bv&(6)
'=== redraw boxes around them, for looks
LINE (bx1(4), by1(4))-(bx2(4), by2(4)), _RGB(0, 0, 0), B
LINE (bx1(5), by1(5))-(bx2(5), by2(5)), _RGB(0, 0, 0), B
LINE (bx1(6), by1(6))-(bx2(6), by2(6)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(4): t2& = bv&(5): t3& = bv&(6) 'old values
bv&(4) = t3&: bv&(5) = t1&: bv&(6) = t2& 'new values
END IF
'===== if left-bottom button clicked...
IF mx > 0 AND mx < 75 AND my > 425 AND my < 600 THEN
'=== slide column left
FOR x = 0 TO size
'=== just move right two images left
_PUTIMAGE (bx1(8) - x, by1(8)), bv&(8)
_PUTIMAGE (bx1(9) - x, by1(9)), bv&(9)
'=== and expand far right location with far left image
_PUTIMAGE (bx2(9) - x, by1(9))-(bx2(9) - x, by2(9)), bv&(7)
'=== redraw boxes around them, for looks
LINE (bx1(7), by1(7))-(bx2(7), by2(7)), _RGB(0, 0, 0), B
LINE (bx1(8), by1(8))-(bx2(8), by2(8)), _RGB(0, 0, 0), B
LINE (bx1(9), by1(9))-(bx2(9), by2(9)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(7): t2& = bv&(8): t3& = bv&(9) 'old values
bv&(7) = t2&: bv&(8) = t3&: bv&(9) = t1& 'new values
END IF
'===== if right-bottom button clicked...
IF mx > 600 AND mx < 675 AND my > 425 AND my < 600 THEN
'=== slide column left
FOR x = 0 TO size
'=== just move left two images right
_PUTIMAGE (bx1(7) + x, by1(7)), bv&(7)
_PUTIMAGE (bx1(8) + x, by1(8)), bv&(8)
'=== and expand far left location with far right image
_PUTIMAGE (bx1(7), by1(7))-(bx1(7) + x, by2(7)), bv&(9)
'=== redraw boxes around them, for looks
LINE (bx1(7), by1(7))-(bx2(7), by2(7)), _RGB(0, 0, 0), B
LINE (bx1(8), by1(8))-(bx2(8), by2(8)), _RGB(0, 0, 0), B
LINE (bx1(9), by1(9))-(bx2(9), by2(9)), _RGB(0, 0, 0), B
_DISPLAY
_LIMIT slidespeed
NEXT
'=== update/assign new values
t1& = bv&(7): t2& = bv&(8): t3& = bv&(9) 'old values
bv&(7) = t3&: bv&(8) = t1&: bv&(9) = t2& 'new values
END IF
'==== check if puzzle is solved....
solved = 1 'assume it is first
FOR s = 1 TO boxes
'=== if piece doesnt match, not solved
IF bv&(s) <> slv&(s) THEN solved = 0
NEXT
'=== Solved? END
IF solved = 1 THEN BEEP: BEEP: END
END IF
LOOP
END
SUB PPRINT (x, y, size, clr&, trans&, text$)
'This sub outputs to the current _DEST set
'It makes trans& the transparent color
'x/y is where to print text
'size is the font size to use
'clr& is the color of your text
'trans& is the background transparent color
'text$ is the string to print
'=== get users current write screen
orig& = _DEST
'=== if you are using an 8 or 32 bit screen
bit = 32: IF _PIXELSIZE(0) = 1 THEN bit = 256
'=== step through your text
FOR t = 0 TO LEN(text$) - 1
'=== make a temp screen to use
pprintimg& = _NEWIMAGE(16, 16, bit)
_DEST pprintimg&
'=== set colors and print text
CLS , trans&: COLOR clr&
PRINT MID$(text$, t + 1, 1);
'== make background color the transprent one
_CLEARCOLOR _RGB(0, 0, 0), pprintimg&
'=== go back to original screen to output
_DEST orig&
'=== set it and forget it
x1 = x + (t * size): x2 = x1 + size
y1 = y: y2 = y + size
_PUTIMAGE (x1 - (size / 2), y1)-(x2, y2 + (size / 3)), pprintimg&
_FREEIMAGE pprintimg&
NEXT
END SUB
|
|
|
Color CONST Warning v1.5+ |
Posted by: bplus - 05-05-2022, 04:31 PM - Forum: General Discussion
- Replies (3)
|
 |
I just ran into the problem again last night, checking out an old program that worked fine before version 1.5
This WAS a set of CONST's (without suffix because at one time you didn't need suffix for a CONST)
Code: (Select All) Dim Shared As _Unsigned Long skyC, ballC, groundC, cannonC, printC ' fix color Const for v 2.0 and 1.5 broken too
skyC = &HFF9988FF
ballC = &HFF000000
groundC = &HFF405020
cannonC = &HFF884422
printC = &HFFEEDDCC
]
I was reviewing a Mod I made of Ken's Artillary program years ago and surprised the dang cannon balls were blowing up at the ends of the cannons not having moved a pixel!?!? WTH
The Point value for sky was not matching the color Const for skyC.
Oh yeah, something (not so) funny happened to Color constants and now they need suffix or the above fix.
I am classifying this as a bug because code is not compatible with the past.
|
|
|
|