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: 42
|
Everybody's heard about t...
Forum: Utilities
Last Post: Frankvab
Yesterday, 06:07 AM
» Replies: 22
» Views: 1,299
|
MBA Assignment Help in Du...
Forum: General Discussion
Last Post: hafsahomar
06-11-2025, 07:05 AM
» Replies: 0
» Views: 15
|
лучшие песни медляки слуш...
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
|
|
|
ERROR: C++ compilation failed. |
Posted by: Ed Davis - 11-15-2022, 07:13 PM - Forum: Help Me!
- Replies (3)
|
 |
I'm getting:
Quote:QB64-PE Compiler V3.4.0
Beginning C++ output from QB64 code...
[.............................................. ] 92%
Beginning C++ output from QB64 code...
[..................................................] 100%
Compiling C++ code into EXE...
ERROR: C++ compilation failed.
Check .\internal\temp\compilelog.txt for details.
On:
Code: (Select All) declare sub main
declare sub get_numeric_args(args() as double)
dim args(4) as double
get_numeric_args(args())
sub get_numeric_args(args() as double)
args(1) = 123
end sub
compilelog.txt:
Quote:internal\c\c_compiler\bin\c++.exe -O2 -w -std=gnu++11 -DGLEW_STATIC -DFREEGLUT_STATIC -Iinternal\c\libqb/include -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal\c/qbx.cpp -c -o internal\c/qbx.o
In file included from internal\c/qbx.cpp:2529:
internal\c/..\\temp\\maindata.txt: In function 'void QBMAIN(void*)':
internal\c/..\\temp\\maindata.txt:13:2: error: 'pass1' was not declared in this scope
pass1;
^~~~~
mingw32-make: *** [Makefile:412: internal\c/qbx.o] Error 1
maindata.txt
Code: (Select All) if (!__ARRAY_DOUBLE_ARGS){
__ARRAY_DOUBLE_ARGS=(ptrszint*)mem_static_malloc(9*ptrsz);
new_mem_lock();
mem_lock_tmp->type=4;
((ptrszint*)__ARRAY_DOUBLE_ARGS)[8]=(ptrszint)mem_lock_tmp;
__ARRAY_DOUBLE_ARGS[4]= 0 ;
__ARRAY_DOUBLE_ARGS[5]=( 4 )-__ARRAY_DOUBLE_ARGS[4]+1;
__ARRAY_DOUBLE_ARGS[6]=1;
__ARRAY_DOUBLE_ARGS[0]=(ptrszint)mem_static_malloc(__ARRAY_DOUBLE_ARGS[5]*8);
memset((void*)(__ARRAY_DOUBLE_ARGS[0]),0,__ARRAY_DOUBLE_ARGS[5]*8);
__ARRAY_DOUBLE_ARGS[2]=1+2;
}
pass1;
main.txt
Code: (Select All) S_0:;
do{
if(!qbevent)break;evnt(4);}while(r);
do{
SUB_GET_NUMERIC_ARGS(&(pass1=((double*)(__ARRAY_DOUBLE_ARGS[0]))[0]));
if(!qbevent)break;evnt(5);}while(r);
sub_end();
return;
}
void SUB_GET_NUMERIC_ARGS(ptrszint*_SUB_GET_NUMERIC_ARGS_ARRAY_DOUBLE_ARGS){
qbs *tqbs;
ptrszint tmp_long;
int32 tmp_fileno;
uint32 qbs_tmp_base=qbs_tmp_list_nexti;
uint8 *tmp_mem_static_pointer=mem_static_pointer;
uint32 tmp_cmem_sp=cmem_sp;
#include "data1.txt"
mem_lock *sf_mem_lock;
new_mem_lock();
sf_mem_lock=mem_lock_tmp;
sf_mem_lock->type=3;
if (new_error) goto exit_subfunc;
do{
tmp_long=array_check(( 1 )-_SUB_GET_NUMERIC_ARGS_ARRAY_DOUBLE_ARGS[4],_SUB_GET_NUMERIC_ARGS_ARRAY_DOUBLE_ARGS[5]);
if (!new_error) ((double*)(_SUB_GET_NUMERIC_ARGS_ARRAY_DOUBLE_ARGS[0]))[tmp_long]= 123 ;
if(!qbevent)break;evnt(8);}while(r);
exit_subfunc:;
free_mem_lock(sf_mem_lock);
#include "free1.txt"
if ((tmp_mem_static_pointer>=mem_static)&&(tmp_mem_static_pointer<=mem_static_limit)) mem_static_pointer=tmp_mem_static_pointer; else mem_static_pointer=mem_static;
cmem_sp=tmp_cmem_sp;
}
void SUB_VWATCH(){
qbs *tqbs;
ptrszint tmp_long;
int32 tmp_fileno;
uint32 qbs_tmp_base=qbs_tmp_list_nexti;
uint8 *tmp_mem_static_pointer=mem_static_pointer;
uint32 tmp_cmem_sp=cmem_sp;
#include "data2.txt"
mem_lock *sf_mem_lock;
new_mem_lock();
sf_mem_lock=mem_lock_tmp;
sf_mem_lock->type=3;
if (new_error) goto exit_subfunc;
exit_subfunc:;
free_mem_lock(sf_mem_lock);
#include "free2.txt"
if ((tmp_mem_static_pointer>=mem_static)&&(tmp_mem_static_pointer<=mem_static_limit)) mem_static_pointer=tmp_mem_static_pointer; else mem_static_pointer=mem_static;
cmem_sp=tmp_cmem_sp;
}
Thanks for any help!
|
|
|
Small 25 line program |
Posted by: Gadgetjack - 11-15-2022, 06:40 PM - Forum: Programs
- Replies (22)
|
 |
I found this on the "mmbasic" site and converted it to run on qb64.
Screen 12
n = 255
r = (2 * pi) / 235
x = 0
v = 0
t = 0
sz = 200
s = 0
scrw = 640: scrh = 480
sw = scrw / sz: sh = scrh / sz
offset = scrh / 4.5
Do
Cls
For i = 50 To n
For j = 50 To n
u = Sin(i + v) + Sin(r * i + x)
v = Cos(i + v) + Cos(r * i + x)
x = u + t
q = scrw / 2 + u * offset
a = scrh / 2 + v * offset
PSet (q, a), _RGB32(Int(Rnd * 256), Int(Rnd * 256), Int(Rnd * 256))
Next j
Next i
t = t + .025
Loop
A screen shot really does not look as good so run it and see.
|
|
|
_TITLE and extended ASCII characters. |
Posted by: Pete - 11-15-2022, 04:25 PM - Forum: Help Me!
- Replies (37)
|
 |
I'd like to put CHR$(240), three small horizontal lines, in my title bar, but the _TITLE function cannot convert extended ASCII characters. Is there another method that wold print the 3 horizontal bars into the title bar so it doesn't look like this: ð
Pete
|
|
|
DAY 009:_PutImage |
Posted by: bplus - 11-15-2022, 12:00 AM - Forum: Keyword of the Day!
- Replies (54)
|
 |
Here is what it looks like in Wiki:
Quote:_PUTIMAGE [STEP] [(dx1, dy1)-[STEP][(dx2, dy2)]][, sourceHandle&][, destHandle&][, ][STEP][(sx1, sy1)[-STEP][(sx2, sy2)]][_SMOOTH]
Yikes! but all we are doing is copying an image from Source Image Handle and rectangular section to Destination Image Handle and rectangular section.
After working with it for awhile now this is what I see:
(for the moment ignore all that STEPping)
_PutImage rectangle, handle, handle, rectangle
2 line rectangles on either end of the parameters.
2 Image handles in the middle of the parameters.
What belongs to what, the order is: D,S,D,S
D for Destination where you want the rectangle image to go.
S for Source where the image is coming from.
(Kind of an odd sequence but... let us continue.)
Now Rectangle knowledge from working with Line (left, top)-(right, bottom) format comes in handy here (as does the practice with Step). (top, left) corner to (bottom, right) corner defines the rectangle space we are grabbing from Source and then pasting into the Destination.
If you want to fill the whole destination rectangle with the image, leave destination rectangle blank and it will fill the destination image by default. Same with the other end, if you want to use the whole image from the Source handle leave the Source rectangle blank as default.
Where do image handles come from?
Well most important is the current screen image, it is 0 automatically.
You can start an Image handle, say IH& Long Type from
IH& = _LoadImage("Filename.ext")
or
IH& = _NewImage(width, height, colorMode) ' starts a container to draw and/or _PutImage and/or start font and print.
STEP allows you to use the last graphics command (x, y) as the start for the next graphics, a very handy use of step for images is to start with the (x,y) location of the top left corner of the rectangle and -Step(ImageWidth, ImageHeight) instead of adding width to x height to y and finding the absolute position value for the 2nd (x, y).
I think this covers the most common uses of _PutImage there are plenty more details to go over, maybe pick those off with discussion?
|
|
|
Function to calculate FPS with another FPS |
Posted by: TerryRitchie - 11-14-2022, 05:37 PM - Forum: Utilities
- No Replies
|
 |
In another post I asked for help in how to determine slower frame rates within a master frame rate for a Pac-Man clone I'm working on. DSMan decoded some of the original Ms. Pac-Man assembly code to reveal how it was being accomplished.
I took that idea and created a function that will determine any frame rate within a master frame rate up to 60 FPS. The function and demo code created to show the function in action are below. With this function you can change the frame rate of a game at any time and still maintain any object's desired slower frame rate.
There is an anomaly in the slope that you'll see as it is drawn. I'm not really sure what to make of this? Any ideas?
Code: (Select All) ' Getting slower frame rates within a master frame rate
DIM F(60) AS INTEGER ' frame counters
DIM FramesPerSecond AS INTEGER ' game's frames per second
DIM Dummy AS INTEGER ' used to set intital data
DIM Frame AS INTEGER ' frame counter
DIM Wipe AS INTEGER ' trigger a clearing of frame counters
DIM x AS INTEGER ' cycle through 1 to FramesPerSecond
'+--------------+
'+ Example code |
'+--------------+
Frame = 0 ' reset frame counter
FramesPerSecond = 60 ' set game FPS
SCREEN _NEWIMAGE(640, 480, 32) ' create graphics screen
DO ' begin various FPS loop
Dummy = FPS(-1, FramesPerSecond) ' create frame data set
DO ' begin demo loop
_LIMIT FramesPerSecond ' limit loop to game's frame rate
CLS ' clear the screen
LOCATE 2, 2: PRINT "Counting down from 60 FPS to 1 FPS" ' inform user of progress
LOCATE 3, 2: PRINT "Frames per second ="; FramesPerSecond
LOCATE 4, 1: PRINT INT(Frame / FramesPerSecond) + 1; "of 5 seconds elapsed"
Frame = Frame + 1 ' increment game frame counter
Wipe = 0 ' reset frame counter wipe trigger
IF Frame = FramesPerSecond * 5 THEN Frame = 0: Wipe = -1 ' when 5 seconds has elapsed reset frame counter and trigger a wipe
FOR x = 1 TO FramesPerSecond ' cycle through all available frame rates
IF Wipe THEN F(x) = 0 ' clear frame counter if wipe triggered
IF FPS(x, Frame) THEN F(x) = F(x) + 1 ' is this frame rate's frame active during this frame in the game?
LINE (10, 200 - x * 2)-(10 + F(x), 200 - x * 2) ' yes, draw a line showing progress of frames counted
NEXT x
_DISPLAY ' update the screen with changes
LOOP UNTIL Wipe OR _KEYDOWN(27) ' leave when user presses the ESC key or a wipe triggered
FramesPerSecond = FramesPerSecond - 1 ' decrease the game's frames per second
IF FramesPerSecond < 1 THEN FramesPerSecond = 60 ' reset the game's frame rate when needed
LOOP UNTIL _KEYDOWN(27) ' leave when user presses the ESC key
SYSTEM ' return to the operating system
'--------------------------------------------------------------------------------------------------------------------------------------------+-----+
FUNCTION FPS (TargetFPS AS INTEGER, Frame AS INTEGER) STATIC ' | FPS |
'+---------------------------------------------------------------------------------------------------------------------------------------+-----+
'| Returns frame rates embedded in a master frame rate |
'| |
'| Usage: dummy = FPS(-1, 60) When the target FPS is less than 1 a new data set is created for the requested frame rate |
'| MoveNow = FPS(24, InputFrame) Will return -1 (TRUE) if input frame is on during the target frame rate |
'| |
'| Example: IF FPS(Object.FPS, GameFrame) then Move(Object) Move the object if the object's frame is on within the game's current frame count |
'+---------------------------------------------------------------------------------------------------------------------------------------------+
DIM f AS INTEGER ' frame counter/value
DIM b AS SINGLE ' bit counter/step rate
DIM FramesCreated AS INTEGER ' numer of frames calculated
IF TargetFPS < 1 THEN ' calculate frame counters?
REDIM FPSnum(Frame) AS _UNSIGNED _INTEGER64 ' yes, resize 64bit value array
REDIM Bit(Frame) AS _UNSIGNED _INTEGER64 ' resize bit value array
FOR b = 1 TO Frame ' cycle through bit values
Bit(b) = 2 ^ (b - 1) ' calculate value of each bit
NEXT b
FOR f = 1 TO Frame ' cycle through requested frames
FOR b = 1 TO Frame STEP (Frame / f) ' cycle through bits at current frames per second
FPSnum(f) = FPSnum(f) + Bit(b) ' calculate which bits are turned on
NEXT b
NEXT f
FramesCreated = Frame ' remember number of frames created
EXIT FUNCTION ' leave function
END IF
IF FramesCreated = 0 THEN EXIT FUNCTION ' no data created yet, leave
f = Frame ' don't modify input value
IF f < 1 THEN EXIT FUNCTION ' invalid frame number requested, leave
IF f > FramesCreated THEN f = f MOD FramesCreated ' keep frame number within range
IF FPSnum(TargetFPS) AND Bit(f) THEN FPS = -1 ' report if bit is on for current frame in requested FPS
END FUNCTION
'---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
BAM "SDLC" Tools |
Posted by: CharlieJV - 11-14-2022, 04:43 AM - Forum: QBJS, BAM, and Other BASICs
- No Replies
|
 |
Just in case you geek out on this kind of stuff or are otherwise interested/curious...
SDLC = Software Development Life Cycle
I'm just in the process of laying out BAM's "SDLC" Tools, starting out with the basics:
- Idea Manager
- Requirement Manager
- Change Request Manager
- Issue Manager
- Task Manager
Imagine you're working on a complex QB64PE project.
You have an idea, you add it to BAM via the Idea Manager.
That Idea may eventually get deleted/dropped, or may transition into being a new Requirement, or transition into being a Change Request to a previously fulfilled Requirement (a requirement can be a defined need to solve a defined problem, might be a feature, might be a constraint).
If it is a new requirement, eventually that requirement transitions into being a task. When that task gets completed, it transitions to being a fulfilled requirement AND a completed task.
If a Change Request, that change request is linked to some previously fulfilled requirement, and eventually the change request transitions into being a task. When done, that task transitions to being a completed task AND an implemented change request.
An issue (problem/bug/whatever), that issue might be related to a previously fulfilled requirement, and eventually the issue transitions into being a task (AND an issue in the process of being resolved). Or the issue transitions into being a new requirement, and the new requirement eventually transitions into also is a task (AND an issue being resolved).
Something like that.
Just piecing together "flow" to have an idea how to build the "managers" of all this info, and the "editors" for all of this info.
|
|
|
Clouds |
Posted by: james2464 - 11-13-2022, 08:12 PM - Forum: Programs
- Replies (6)
|
 |
Not the most useful program, but I enjoyed making it.
3 mysterious monoliths have been placed on the shore. You can use your mouse wheel while hovering over them to find out what they do.
Code: (Select All) 'clouds
'james2464 - Nov 13 2022
Dim Shared scx, scy, ct As Integer
scx = 800: scy = 600
Screen _NewImage(scx, scy, 32)
Const PI = 3.141592654#
Randomize Timer
Dim Shared bg&, cd&(200)
bg& = _NewImage(scx + 1, scy + 1, 32)
For ct = 1 To 180
cd&(ct) = _NewImage(301, 151, 32)
Next ct
Dim Shared c(100) As Long
colour1
Type movingcloud
x As Single
y As Single
xv As Single
s As Single
End Type
Dim Shared cloud(180) As movingcloud
Dim Shared cloudtotal, wind
cloudtotal = 180
wind = 1.0
makeclouds
background1
_PutImage (1, 1)-(scx - 1, scy - 1), 0, bg&, (1, 1)-(scx - 1, scy - 1) 'take snapshot of screen
cloudtotal = 30
'=====================================================
Do
_Limit 30
'------------------- mouse stuff -------------------
Do While _MouseInput
mx% = _MouseX
my% = _MouseY
If mx% > 400 And mx% < 430 Then
If my% > 480 Then
cloudtotal = cloudtotal - _MouseWheel * 2
End If
End If
If mx% > 500 And mx% < 530 Then
If my% > 480 Then
wind = wind - _MouseWheel * .2
End If
End If
If mx% > 600 And mx% < 630 Then
If my% > 480 Then
For ct = 1 To cloudtotal
cloud(ct).y = cloud(ct).y - _MouseWheel * 5
If cloud(ct).y > 390 Then cloud(ct).y = 390
If cloud(ct).y < 10 Then cloud(ct).y = 10
'adjust speed and scale accordingly
cloud(ct).xv = Rnd * .3 + ((400 - cloud(ct).y) / 500) * 5
cloud(ct).s = ((400 - cloud(ct).y) / 500) * 1.5
Next ct
End If
End If
Loop
If cloudtotal > 180 Then cloudtotal = 180
'----------------------------------------------------
Cls
_PutImage (0, 0)-(scx, scy), bg&, 0 'draw background
For ct = 1 To cloudtotal
_PutImage (cloud(ct).x, cloud(ct).y)-(cloud(ct).x + (500 * cloud(ct).s), cloud(ct).y + (150 * cloud(ct).s)), cd&(ct), 0 'cloud
cloud(ct).x = cloud(ct).x + (cloud(ct).xv * wind)
If wind > 0 Then
If cloud(ct).x > 1000 Then
cloud(ct).x = -800
cloud(ct).y = Rnd * 555 - 10
If cloud(ct).y > 390 Then
cloud(ct).y = Rnd * 30 + 360
End If
newcloud
End If
Else
If cloud(ct).x < -800 Then
cloud(ct).x = 1000
cloud(ct).y = Rnd * 555 - 10
If cloud(ct).y > 390 Then
cloud(ct).y = Rnd * 30 + 360
End If
newcloud
End If
End If
Next ct
_Display
Loop
Sub background1
Cls
'sky
Line (1, 1)-(scx - 1, scy - 1), c(1), BF
y = 400
For t = 1 To y
m = 255 * ((400 - t) / 400)
c(99) = _RGBA(150, 150, 255, m)
Line (1, t)-(scx - 1, t), c(99)
Next t
'water
ty = scy - y
For t = y To scy
t2 = ((scy - t) * 2)
m = 255 * ((scy - t2) / scy)
c(99) = _RGBA(50, 50, 150, m)
Line (1, t)-(scx - 1, t), c(99)
Next t
'beach
x = scx
For t = 410 To scy
r = Rnd * (x / 30 + 2)
x = x - r
c(99) = _RGB(150, 150, 130)
Line (x, t)-(scx, t), c(99)
Next t
'control monoliths
c(99) = _RGB(120, 120, 100) 'cloud total
Line (400, 480)-(430, scy - 10), c(99), BF
c(99) = _RGB(100, 130, 100) 'wind
Line (500, 480)-(530, scy - 10), c(99), BF
c(99) = _RGB(130, 100, 100) 'distance
Line (600, 480)-(630, scy - 10), c(99), BF
End Sub
Sub colour1
c(0) = _RGB(0, 0, 0)
c(1) = _RGB(255, 255, 255)
c(2) = _RGB(255, 255, 0)
c(3) = _RGB(255, 0, 0)
c(4) = _RGB(0, 255, 0)
c(5) = _RGB(0, 255, 255)
c(6) = _RGB(255, 0, 255)
c(7) = _RGB(30, 30, 255)
c(8) = _RGB(150, 150, 250)
c(9) = _RGB(250, 150, 150)
c(10) = _RGB(150, 250, 150)
c(11) = _RGB(150, 150, 255) 'sky blue
c(12) = _RGB(150, 75, 125) 'cars
c(13) = _RGB(255, 0, 0)
c(14) = _RGB(50, 150, 50) 'ground
End Sub
Sub makeclouds
'create cloud images with clear background
For ct = 1 To cloudtotal
Cls 'cloud 1
Line (0, 0)-(302, 152), c(1), B
b = Int(Rnd * 110 + 3) 'number of circles per cloud
For t = 1 To b
fct = fct + 1
If ct / 6 = Int(ct / 6) Then
x1 = Rnd * 120 - 60
Else
x1 = Rnd * 300 - 150
End If
If x1 < -120 Then x1 = x1 + 50
If x1 > 120 Then x1 = x1 - 50
y1 = Rnd * 70 + 60 - (t / 5)
d1 = Rnd * 14 + 7
If y1 + d1 > 120 Then y1 = 120 - d1 - Rnd * 10
'circle construction
t3 = Int(Rnd * 400) + 30 'resolution
For t2 = 1 To t3
rr = Rnd * 6.3 'random radian
rl = Rnd * (d1 * .8) 'random line length
dx = Cos(rr) * rl: dy = Sin(rr) * rl
dx2 = x1 + dx
dy2 = y1 + dy
g1 = 240 - y1 * .3 'darkness
g2 = 240 - y1 * .3 'darkness
g3 = 255 - y1 * .3 'darkness
a = 255 - (rl * 9)
c(99) = _RGB(g1, g2, g3)
Circle (150 + dx2, 10 + dy2), 1, c(99)
'Sleep
Next t2
Next t
_PutImage (1, 1)-(301, 151), 0, cd&(ct), (1, 1)-(300, 150)
_ClearColor c(0), cd&(ct)
'starting position
cloud(ct).x = Rnd * 1400 - 600
cloud(ct).y = Rnd * 555 - 10
If cloud(ct).y > 390 Then
cloud(ct).y = Rnd * 30 + 360
End If
newcloud
Next ct
End Sub
Sub newcloud
'initial speed
cloud(ct).xv = Rnd * .3 + ((400 - cloud(ct).y) / 500) * 5
'scale
cloud(ct).s = ((400 - cloud(ct).y) / 500) * 1.5
End Sub
|
|
|
|