BASIC

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - aonyn

Pages: [1] 2
1
Hi Gernot,

I just noticed what I think may be a bug with multisampling and fullscreen mode in windows.
I am starting on a 3d project, using the entity system, and using a windows xp sp3 computer, and Geforce GTX 560 Ti, Driver 266.66

The app runs in windowed mode always.
In fullscreen mode, it runs with multisampling turned off.
If I turn on multisampling, the app crashes immediately, and wants to send an error report to microsoft.

Is this a known issue, or is it perhaps something on my system, or a glbasic bug?

Thanks,
Dave

2
DD-GUI / Data Grid
« on: 2011-Oct-07 »
Hi Gernot,

Sorry, I know this is a code snippets forum, and not feature request, however, I did not know where to post this because it is for DDGui.

Would it be possible to add a Data Grid widget to DDGui. (similar to an excel spreadsheet grid)?

This would be a very useful widget for me.

Thanks,
Dave Marconi

3
Bug Reports / GBAL Problem
« on: 2011-Oct-02 »
Hi Gernot,

I just started back into a GLBasic Project, after some time away (family stuff).
Anyway, I have updated to the latest GLBasic version 10.118.

I have a very simple gbal file I created, which contains a TYPE with some parameters and functions (a class basically)

Everything works fine when it is used as a gbas file.
when I compress to library, and try to use the gbal in my project instead of the gbas, I get the following error.

Code: GLBasic [Select]
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.10.074 SN:380c888f - 3D, NET
"DM_GUI_Test.gbas"(17) error : user type is not defined : TYPE FPS_Counter is not declared

FPS_Counter is the TYPE contained within the gbal of course.

However, if I rename the gbal extension to gbas, and add that to my project instead, it works as expected.

Is this a known issue with gbal files containing a TYPE (class)?

Thanks,
Dave

4
Math / Easing Functions
« on: 2011-Mar-12 »
Hi All,

Here is a collection of useful easing functions. I wanted these for a personal project, and decided to post them here as well, in hopes that they can be useful to others as well.
I translated these to GLBasic from the open source actionscript easing functions by Robert Penner. (www.robertpenner.com).

Also included are two mixing functions I added, which can be useful with this library, particularly the inverse mixing function.

Finally I included a sample of usage which includes the inverse mixing function, so you can see how they can be used together.
And of course a screenshot of the output of the sample.

regards,
Dave

Code: GLBasic [Select]
// ---------------------------------------------------------
// Mixing and Inverse Mixing Functions
// ---------------------------------------------------------
// by David Marconi
// ---------------------------------------------------------

// a = start value
// b = end value
// v = percent between values to return

// return value at percentage(v) between (a) and (b)
FUNCTION mix: a#, b#, v#
        RETURN ((b*v) / 100.0) + (a * (100.0-v) / 100.0)
ENDFUNCTION

// return value at inverse percentage(v) between (a) and (b)
FUNCTION mixInverse: a#, b#, v#
        RETURN ((a*v) / 100.0) + (b * (100.0 -v) / 100.0)
ENDFUNCTION

// ---------------------------------------------------------
// Easing Functions
// ---------------------------------------------------------
// Based on Actionscript by Robert Penner
// www.robertpenner.com
// ---------------------------------------------------------
//TERMS OF USE - EASING EQUATIONS
//
//Open source under the BSD License.
//
//Copyright © 2001 Robert Penner
//All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
//Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
//Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---------------------------------------------------------
// Translated to GLBasic by David Marconi
// ---------------------------------------------------------

// t = current time
// b = start value
// c = change in value
// d = duration

// simple linear tweening - no easing, no acceleration
FUNCTION linearTween: t#, b#, c#, d#
        RETURN c*t/d + b
ENDFUNCTION

// quadratic easing in - accelerating from zero velocity
FUNCTION easeInQuad: t#, b#, c#, d#
        t = t/d
        RETURN c*t*t + b
ENDFUNCTION

// quadratic easing out - decelerating to zero velocity
FUNCTION easeOutQuad: t#, b#, c#, d#
        t = t / d
        RETURN -c * t*(t-2) + b
ENDFUNCTION

// quadratic easing in/out - acceleration until halfway, then deceleration
FUNCTION easeInOutQuad: t#, b#, c#, d#
        t = t / (d/2)
        IF t < 1
                RETURN c/2*t*t + b
        ENDIF
        DEC t
        RETURN -c/2 * (t*(t-2) - 1) + b
ENDFUNCTION

// cubic easing in - accelerating from zero velocity
FUNCTION easeInCubic: t#, b#, c#, d#
        t = t/d
        RETURN c*t*t*t + b
ENDFUNCTION

// cubic easing out - decelerating to zero velocity
FUNCTION easeOutCubic: t#, b#, c#, d#
        t = t/d
        DEC t
        RETURN c*(t*t*t + 1) + b
ENDFUNCTION

// cubic easing in/out - acceleration until halfway, then deceleration
FUNCTION easeInOutCubic: t#, b#, c#, d#
        t = t / (d/2)
        IF t < 1
                RETURN c/2*t*t*t + b
        ENDIF
        DEC t, 2
        RETURN c/2*(t*t*t + 2) + b
ENDFUNCTION

// quartic easing in - accelerating from zero velocity
FUNCTION easeInQuart: t#, b#, c#, d#
        t = t/d
        RETURN c*t*t*t*t + b
ENDFUNCTION

// quartic easing out - decelerating to zero velocity
FUNCTION easeOutQuart: t#, b#, c#, d#
        t = t/d
        DEC t
        RETURN -c * (t*t*t*t - 1) + b
ENDFUNCTION

// quartic easing in/out - acceleration until halfway, then deceleration
FUNCTION easeInOutQuart: t#, b#, c#, d#
        t = t / (d/2)
        IF t < 1
                RETURN c/2*t*t*t*t + b
        ENDIF
        DEC t, 2
        RETURN -c/2 * (t*t*t*t - 2) + b
ENDFUNCTION

// quintic easing in - accelerating from zero velocity
FUNCTION easeInQuint: t#, b#, c#, d#
        t = t/d
        RETURN c*t*t*t*t*t + b
ENDFUNCTION

// quintic easing out - decelerating to zero velocity
FUNCTION easeOutQuint: t#, b#, c#, d#
        t = t/d
        DEC t
        RETURN c*(t*t*t*t*t + 1) + b
ENDFUNCTION

// quintic easing in/out - acceleration until halfway, then deceleration
FUNCTION easeInOutQuint: t#, b#, c#, d#
        t = t / (d/2)
        IF t < 1
                RETURN c/2*t*t*t*t*t + b
        ENDIF
        DEC t, 2
        RETURN c/2*(t*t*t*t*t + 2) + b
ENDFUNCTION

// sinusoidal easing in - accelerating from zero velocity
FUNCTION easeInSine: t#, b#, c#, d#
        LOCAL pi# = 3.1415926535
        RETURN -c * COS(t/d * (pi/2)) + c + b
ENDFUNCTION

// sinusoidal easing out - decelerating to zero velocity
FUNCTION easeOutSine: t#, b#, c#, d#
        LOCAL pi# = 3.1415926535
        RETURN c * SIN(t/d * (pi/2)) + b
ENDFUNCTION

// sinusoidal easing in/out - accelerating until halfway, then decelerating
FUNCTION easeInOutSine: t#, b#, c#, d#
        LOCAL pi# = 3.1415926535
        RETURN -c/2 * (COS(pi*t/d) - 1) + b
ENDFUNCTION

// exponential easing in - accelerating from zero velocity
FUNCTION easeInExpo: t#, b#, c#, d#
        RETURN c * POW(2, 10 * (t/d - 1)) + b
ENDFUNCTION

// exponential easing out - decelerating to zero velocity
FUNCTION easeOutExpo: t#, b#, c#, d#
        RETURN c * (-POW(2, -10 * t/d) + 1) + b
ENDFUNCTION

// exponential easing in/out - accelerating until halfway, then decelerating
FUNCTION easeInOutExpo: t#, b#, c#, d#
        t = t / (d/2)
        IF t < 1
                RETURN c/2 * POW(2, 10 * (t - 1)) + b
        ENDIF
        DEC t
        RETURN c/2 * (-POW(2, -10 * t) + 2) + b
ENDFUNCTION

// circular easing in - accelerating from zero velocity
FUNCTION easeInCirc: t#, b#, c#, d#
        t = t/d
        RETURN -c * (SQR(1 - t*t) - 1) + b
ENDFUNCTION

// circular easing out - decelerating to zero velocity
FUNCTION easeOutCirc: t#, b#, c#, d#
        t = t/d
        DEC t
        RETURN c * SQR(1 - t*t) + b
ENDFUNCTION

// circular easing in/out - acceleration until halfway, then deceleration
FUNCTION easeInOutCirc: t#, b#, c#, d#
        t = t / (d/2)
        IF t < 1
                RETURN -c/2 * (SQR(1 - t*t) - 1) + b
        ENDIF
        DEC t, 2
        RETURN c/2 * (SQR(1 - t*t) + 1) + b
ENDFUNCTION
 

Code: GLBasic [Select]
// Sample using easing functions to create a curve
// Also uses mixInverse function to assist easing of a > to < value range
FOR x=0 TO 99
        DRAWRECT linearTween(x, 0, 640, 99), mixInverse(0, 480, easeInQuad(x, 0, 99, 99)), 2, 2, RGB(255, 255, 255)
NEXT
SHOWSCREEN
MOUSEWAIT
END
 

[attachment deleted by admin]

5
GLBasic - en / Mac Crossover
« on: 2011-Feb-19 »
Hi All,

I am curious if anyone here has tried to get GLBasic to run on a Mac using Crossover.
If so, were you successful and how did you get it to work.

I tried this evening, and it installs, but it crashes when trying to run at the splash screen.
I am hoping to get this working.

BTW - in case someone does not know Crossover, but uses Wine - Crossover is just a commercially supported build of wine for Mac. So wine advice may also apply.

Thanks in advance,
Dave

6
Hi Gernot,

This is definitely not a major bug, but I just noticed it, and figure I will post it here so it is a known issue.
By no means is it a bug to lose sleep over though.

In the 9.006 IDE, you can scroll past the end of a document I think infinitely using the scroll wheel on a mouse.
Using the slide widget on the edge of the screen, it stops as it should.

Regards,
Dave

7
Bug Reports / Flicker in new V9 IDE
« on: 2011-Feb-14 »
Hi Gernot,

Now that I have GLB V9 working, so far everything seems good.
I have noticed one minor yet slightly annoying issue, which I don't know if it is a bug, or something with my system, although it is limited to the new IDE, and never happened in V8.

While typing code in the main workspace, the right side text area for jump / files / web / debug flickers.
It does not seem to hurt anything, but as I said, it can be annoying seeing the flickering out of the corner of my eye as I type.

Do you have any thoughts what could be the cause?

Thanks,
Dave

8
Hi All,

At long last, here is the wrapper for Xors3d which I have been working on.
I will be keeping it up to date (well as much as time permits)
Many functions remain untested, but I have used many as well, and all I have needed so far work well.

I am including the GLBasic wrapper source code (just include with your project), as well as some additional PureBasic source code (for a helper DLL which comunicates with the library in utf8 when strings are passed), as well as a compiled version of the helper DLL (for those who don't own PureBasic and can't compile it themselves.)

Please note that any function which returns a const char* (string) will be appended with $.
Otherwise, everything uses the exact command names from the Xors3d documentation.

If you encounter any bugs, please post here and let me know, I will do my best to get everything working perfectly.
Or if you solve a problem, please also post here and let me know what was solved and how.

I hope this is useful to some in the community.
It should be a nice companion for BigSofty's iXors3d library, allowing you to test code locally in windows, and then only making minor adjustments to convert to iXors.

Thanks to all who assisted me on the forum when I encountered problems writing this wrapper, and especially to BigSofty.

regards,
Dave

[attachment deleted by admin]

9
Hi Gernot,

I just encountered a bug I think, while working on my xors3d wrapper.
I was searching for a bug, and using the method of commenting out blocks of code, until I traced down the culprit of my problem.
When I found the bug and uncommented everything using the block comment toggle function, the ide changed all commands (in common with GLB such as 'if' and 'return') within the inline blocks to all caps, treating them as though they were within the glbasic scope, rather than C.
Unfortunately I just discovered this bug with quite a large block of code, so I will get back to cleaning up again.

Thanks in advance for your help on this one.

regards,
Dave

10
Hi Gernot,

I have a request for the IDE, specifically the display of functions in types on the jumps display.
Would it be possible, if the type could be listed as well as the type.

Perhaps for this sample code...
Code: GLBasic [Select]
TYPE foo
    FUNCTION bar:
    ENDFUNCTION
ENDTYPE
 

The jumps display would show the function bar as foo.bar

The reason for this request is, I have numerous types in my current project, many share embedded function names, such as load, set, get, kill, etc.
Now in the jumps display, I only see many instances of these common names, rather than conveniently seeing the associated types for each.

Of course this is not essential, but would be very helpful if possible.

Thanks,
Dave

11
Hi,

I just encountered some strange behavior.

I have several LOCAL variables, defined in my program after my TYPE definitions.
These type definitions contain functions, some with arguments.

The strange thing is, I added many functions with arguments, using the same names as some of the local variables outside and after the types, without trouble.
However, I just added another function to the last defined type, using two argument names which had already been used in other functions, and the compiler began to complain that those variables were not defined in this scope.

I was able to correct the problem two ways, but still I think there is some bug in the compiler.
The first way to correct the problem was to define the LOCAL variables to the main program BEFORE my type definitions - compiler problem gone, program works as expected.
The second way to correct the problem was to change the names of the arguments in the embedded function which caused the problem to new and unique names. - compiler problem gone, program works as expected. The strange thing being that earlier embedded functions use the existing argument names without trouble.

I was able to work around the problem, so it is not a showstopper.
However the behavior seems odd, and perhaps suspect, so I decided to post about it here.

regards,
Dave

12
Hi All,

I am attempting to wrap a dll, specifically, a new xors3d wrapper.
I am aware one exists, but I want to learn, and I understand the existing wrapper is no longer maintained anyway.
If I can successfully wrap xors3d, of course it will be my contribution to the community, and will be a nice compliment to bigsofty's ixors3d wrapper.

Anyway, I have one of the working samples from the purebasic version translated to glbasic, and necessary functions are wrapped to support the sample.
It compiles with no errors, but does not work as expected.
The wrapper file is added to the project, the dll files provided with the xors3d demo are place in the app folder inside the project, and the texture is placed in app's media folder, in a subfolder called textures

If someone sees what I am doing wrong, please provide me some feedback, so I can continue moving forward.
This is my first adventure with inline code, and I am working from Gernot's dll wrapping tutorial, as well as looking at how the purebasic wrapper is built for comparison.

Here is the sample code
Code: GLBasic [Select]
// --------------------------------- //
// Project: xors3d headers
// Start: Monday, September 13, 2010
// IDE Version: 8.085

// Sample xors3d usage

//GLOBAL KEY_ESCAPE% = 01
//GLOBAL KEY_W% = 17
//GLOBAL KEY_S% = 31
//GLOBAL KEY_A% = 30
//GLOBAL KEY_D% = 32

GLOBAL KEY_ESCAPE% = 27
GLOBAL KEY_W% = 87
GLOBAL KEY_S% = 83
GLOBAL KEY_A% = 65
GLOBAL KEY_D% = 68

// setup maximum supported AntiAlias TYPE
xSetAntiAliasType(xGetMaxAntiAlias())

// set application window caption
xAppTitle("Simple sample")

// initialize graphics mode
xGraphics3D(800, 600, 32, FALSE, TRUE)

// hide mouse pointer
xHidePointer()

// enable antialiasing
xAntiAlias(TRUE)

// create camera
LOCAL camera% = xCreateCamera(0)

// position camera
xPositionEntity(camera, 0, 0, -10)

// create cube
LOCAL cube% = xCreateCube(0)

// loading logo from file
LOCAL logoTexture% = xLoadTexture("Media\Textures\logo.jpg")

// texture cube
xEntityTexture(cube, logoTexture)

// for mouse look
xMoveMouse(xGraphicsWidth()*0.5, xGraphicsHeight()*0.5)
LOCAL mousespeed# = 0.5
LOCAL camerasmoothness# = 4.5

// main program loop
WHILE NOT xKeyDown(KEY_ESCAPE)
        IF xKeyDown(KEY_W)
                xMoveEntity(camera,  0,  0,  1)
        ENDIF

        IF xKeyDown(KEY_S)
                xMoveEntity(camera,  0,  0, -1)
        ENDIF

        IF xKeyDown(KEY_A)
                xMoveEntity(camera, -1,  0,  0)
        ENDIF

        IF xKeyDown(KEY_D)
                xMoveEntity(camera,  1,  0,  0)
        ENDIF

        LOCAL mxs# = 0.0
        LOCAL mys# = 0.0

        mxs = CurveValue(xMouseXSpeed() * mousespeed, mxs, camerasmoothness)
        mys = CurveValue(xMouseYSpeed() * mousespeed, mys, camerasmoothness)

        LOCAL Fix% = MOD(FtoI(mxs),360) + (mxs - FtoI(mxs))

        LOCAL camxa# = 0.0
        LOCAL camya# = 0.0

        camxa = camxa - Fix
        camya = camya + mys

        IF camya < -89
                camya = -89
        ENDIF

        IF camya > 89
                camya = 89
        ENDIF

        xMoveMouse(xGraphicsWidth()*0.5, xGraphicsHeight()*0.5)

        xRotateEntity(camera, camya, camxa, 0.0)

        // turn cube
        xTurnEntity(cube, 0, 1, 0)

        // render scene
        xRenderWorld()

        // switch back buffer
        xFlip()
WEND

// for camera mouse look
FUNCTION CurveValue#: newValue#, oldValue#, increments%
        IF increments% > 1
                oldValue# = oldValue# - (oldValue# - newValue#) / increments%
        ENDIF
        IF increments% <= 1
                oldValue# = newValue#
        ENDIF
        RETURN oldValue#
ENDFUNCTION

// float to integer
FUNCTION FtoI%: input#
        LOCAL output% = input#
        RETURN output%
ENDFUNCTION
 

And here is the wrapper code
Code: GLBasic [Select]
// --------------------------------- //
// Project: xors3d headers
// Start: Monday, September 13, 2010
// IDE Version: 8.085

// AntiAliasing Types
        GLOBAL AANONE% = 0
        GLOBAL AA2SAMPLES% = 1
        GLOBAL AA3SAMPLES% = 2
        GLOBAL AA4SAMPLES% = 3
        GLOBAL AA5SAMPLES% = 4
        GLOBAL AA6SAMPLES% = 5
        GLOBAL AA7SAMPLES% = 6
        GLOBAL AA8SAMPLES% = 7
        GLOBAL AA9SAMPLES% = 8
        GLOBAL AA10SAMPLES% = 9
        GLOBAL AA11SAMPLES% = 10
        GLOBAL AA12SAMPLES% = 11
        GLOBAL AA13SAMPLES% = 12
        GLOBAL AA14SAMPLES% = 13
        GLOBAL AA15SAMPLES% = 14
        GLOBAL AA16SAMPLES% = 15

// Texture Loading Flags
        GLOBAL FLAGS_COLOR% = 1
        GLOBAL FLAGS_ALPHA% = 2
        GLOBAL FLAGS_MASKED% = 4
        GLOBAL FLAGS_MIPMAPPED% = 8
        GLOBAL FLAGS_CLAMPU% = 16
        GLOBAL FLAGS_CLAMPV% = 32
        GLOBAL FLAGS_SPHERICALENVMAP% = 64
        GLOBAL FLAGS_CUBICENVMAP% = 128
        GLOBAL FLAGS_R32F% = 256
        GLOBAL FLAGS_RESERVED% = 512
        GLOBAL FLAGS_VOLUMETEXTURE% = 1024
        GLOBAL FLAGS_ARGB16F% = 2048
        GLOBAL FLAGS_ARGB32F% = 4096

INLINE
        extern "C"
        {
                // Camera Functions
                        DECLARE_ALIAS(glb_xCreateCamera, "xors3d.dll", "xCreateCamera", (int, int), int);

                // Entity Control Functions
                        DECLARE_ALIAS(glb_xEntityTexture, "xors3d.dll", "xEntityTexture", (int, int, int, int), void);

                // Entity Movement Functions
                        DECLARE_ALIAS(glb_xPositionEntity, "xors3d.dll", "xPositionEntity", (int, float, float, float, int), void);
                        DECLARE_ALIAS(glb_xMoveEntity, "xors3d.dll", "xMoveEntity", (int, float, float, float, int), void);
                        DECLARE_ALIAS(glb_xRotateEntity, "xors3d.dll", "xRotateEntity", (int, float, float, float, int), void);
                        DECLARE_ALIAS(glb_xTurnEntity, "xors3d.dll", "xTurnEntity", (int, float, float, float, int), void);

                // Graphics Functions
                        DECLARE_ALIAS(glb_xRect, "xors3d.dll", "xRect", (int, int, int, int, int), void);
                        DECLARE_ALIAS(glb_xGetMaxAntiAlias, "xors3d.dll", "xGetMaxAntiAlias", (), int);
                        DECLARE_ALIAS(glb_xSetAntiAliasType, "xors3d.dll", "xSetAntiAliasType", (int), void);
                        DECLARE_ALIAS(glb_xAppTitle, "xors3d.dll", "xAppTitle", (const char*), void);
                        DECLARE_ALIAS(glb_xSetWND, "xors3d.dll", "xSetWND", (int), void);
                        DECLARE_ALIAS(glb_xSetRenderWindow, "xors3d.dll", "xSetRenderWindow", (int), void);
                        DECLARE_ALIAS(glb_xFlip, "xors3d.dll", "xFlip", (), void);
                        DECLARE_ALIAS(glb_xGraphicsWidth, "xors3d.dll", "xGraphicsWidth", (), int);
                        DECLARE_ALIAS(glb_xGraphicsHeight, "xors3d.dll", "xGraphicsHeight", (), int);
                        DECLARE_ALIAS(glb_xRenderWorld, "xors3d.dll", "xRenderWorld", (float, int), void);
                        DECLARE_ALIAS(glb_xAntiAlias, "xors3d.dll", "xAntiAlias", (int), void);
                        DECLARE_ALIAS(glb_xHidePointer, "xors3d.dll", "xHidePointer", (), void);
                        DECLARE_ALIAS(glb_xGraphics3D, "xors3d.dll", "xGraphics3D", (int, int, int, int, int), void);

                // Input - Keyboard Functions
                        DECLARE_ALIAS(glb_xKeyDown, "xors3d.dll", "xKeyDown", (int), int);

                // Input - Mouse Functions
                        DECLARE_ALIAS(glb_xMouseXSpeed, "xors3d.dll", "xMouseXSpeed", (), int);
                        DECLARE_ALIAS(glb_xMouseYSpeed, "xors3d.dll", "xMouseYSpeed", (), int);
                        DECLARE_ALIAS(glb_xMoveMouse, "xors3d.dll", "xMoveMouse", (int, int), void);

                // Mesh Functions
                        DECLARE_ALIAS(glb_xCreateCube, "xors3d.dll", "xCreateCube", (int, int), int);

                // Texture Functions
                        DECLARE_ALIAS(glb_xLoadTexture, "xors3d.dll", "xLoadTexture", (const char*, int), int);
        }
ENDINLINE

// Camera Functions
        FUNCTION xCreateCamera: entity%, parent%=0
                INLINE
                        if(glb_xCreateCamera)
                                return glb_xCreateCamera(entity, parent);
                ENDINLINE
        ENDFUNCTION

// Entity Control Functions
        FUNCTION xEntityTexture: entity%, texture%, frame%=0, index%=0
                INLINE
                        if(glb_xEntityTexture)
                                glb_xEntityTexture(entity, texture, frame, index);
                ENDINLINE
        ENDFUNCTION

// Entity Movement Functions
        FUNCTION xPositionEntity: entity%, x#, y#, z#, isGlobal%=FALSE
                INLINE
                        if(glb_xPositionEntity)
                                glb_xPositionEntity(entity, x, y, z, isGlobal);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xMoveEntity: entity%, x#, y#, z#, isGlobal%=FALSE
                INLINE
                        if(glb_xMoveEntity)
                                glb_xMoveEntity(entity, x, y, z, isGlobal);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xRotateEntity: entity%, x#, y#, z#, isGlobal%=FALSE
                INLINE
                        if(glb_xRotateEntity)
                                glb_xRotateEntity(entity, x, y, z, isGlobal);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xTurnEntity: entity%, x#, y#, z#, isGlobal%=FALSE
                INLINE
                        if(glb_xTurnEntity)
                                glb_xTurnEntity(entity, x, y, z, isGlobal);
                ENDINLINE
        ENDFUNCTION

// Graphics Functions
        FUNCTION xRect: x%, y%, width%, height%, solid%=FALSE
                INLINE
                        if(glb_xRect)
                                glb_xRect(x, y, width, height, solid);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xGetMaxAntiAlias:
                INLINE
                        if(glb_xGetMaxAntiAlias)
                                return glb_xGetMaxAntiAlias();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xSetAntiAliasType: typeID%
                INLINE
                        if(glb_xSetAntiAliasType)
                                glb_xSetAntiAliasType(typeID);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xAppTitle: title$
                INLINE
                        if(glb_xAppTitle)
                                glb_xAppTitle(title_Str.c_str());
                ENDINLINE
        ENDFUNCTION

        FUNCTION xSetWND: window%
                INLINE
                        if(glb_xSetWND)
                                glb_xSetWND(window);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xSetRenderWindow: window%
                INLINE
                        if(glb_xSetRenderWindow)
                                glb_xSetRenderWindow(window);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xFlip:
                INLINE
                        if(glb_xFlip)
                                glb_xFlip();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xGraphicsWidth:
                INLINE
                        if(glb_xGraphicsWidth)
                                return glb_xGraphicsWidth();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xGraphicsHeight:
                INLINE
                        if(glb_xGraphicsHeight)
                                return glb_xGraphicsHeight();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xRenderWorld: twin#=1.0, renderShadows%=FALSE
                INLINE
                        if(glb_xRenderWorld)
                                glb_xRenderWorld(twin, renderShadows);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xAntiAlias: state%
                INLINE
                        if(glb_xAntiAlias)
                                glb_xAntiAlias(state);
                ENDINLINE
        ENDFUNCTION

        FUNCTION xHidePointer:
                INLINE
                        if(glb_xHidePointer)
                                glb_xHidePointer();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xGraphics3D: width%=640, height%=480, depth%=16, mode%=FALSE, vsync%=FALSE
                INLINE
                        if(glb_xGraphics3D)
                                glb_xGraphics3D(width, height, depth, mode, vsync);
                ENDINLINE
        ENDFUNCTION

// Input - Keyboard Functions
        FUNCTION xKeyDown: key%
                INLINE
                        if(glb_xKeyDown)
                                return glb_xKeyDown(key);
                ENDINLINE
        ENDFUNCTION

// Input - Mouse Functions
        FUNCTION xMouseXSpeed:
                INLINE
                        if(glb_xMouseXSpeed)
                                return glb_xMouseXSpeed();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xMouseYSpeed:
                INLINE
                        if(glb_xMouseYSpeed)
                                return glb_xMouseYSpeed();
                ENDINLINE
        ENDFUNCTION

        FUNCTION xMoveMouse: x%, y%
                INLINE
                        if(glb_xMoveMouse)
                                glb_xMoveMouse(x, y);
                ENDINLINE
        ENDFUNCTION

// Mesh Functions
        FUNCTION xCreateCube: entity%, parent%=0
                INLINE
                        if(glb_xCreateCube)
                                return glb_xCreateCube(entity, parent);
                ENDINLINE
        ENDFUNCTION

// Texture Functions
        FUNCTION xLoadTexture: path$, flag%=9
                INLINE
                        if(glb_xLoadTexture)
                                return glb_xLoadTexture(path_Str.c_str(), flag);
                ENDINLINE
        ENDFUNCTION
 

Thanks in advance,
Dave

13
GLBasic - en / Volume change for sound
« on: 2010-Aug-21 »
Hi all,

Is there a way to change the volume of a sound, while the sound is already playing, or is it only possible to set the volume when the sound is initiated?
If it is possible, it would be very useful in my current project, so any help is very appreciated.

Thanks in advance,
Dave

14
Hi all,

I have a general question about sounds on iphone.
I have a project which uses looped sounds, which overlap each other for a smooth loop, with simple cross fading.
The duration of the samples are exactly 1000 ms, and I initiate repeats at 334 ms, so there are never more than 3 instances of a sound at one time.
I currently have the channels parameter set to 4, although based on this timing, I am sure I can also set it to 3.

This is working perfectly and as expected on PC, however the sounds are stuttering on iphone. It sounds as though iphone only handles 2 instances of a sound, rather than 3 or 4.
Is this indeed the case, and I need to adapt my method, or is it more likely something wrong with my code which the PC was handling more elegantly than iphone.

Thanks in advance for any feedback.

Regards,
Dave

15
Hi Gernot,

This is not a major bug, but perhaps a bug nonetheless.
In the IDE, I just noticed, if you save a file with folded functions, close the project, and reopen it later, then unfold the folded functions, white space (blank line) separating the functions is lost.

Of course this is not a showstopper, just a nuisance bug, I just like to separate my functions with a blank line.

I have not noticed this before, so I will test it more, and see if I can reproduce it reliably, or if it is sporatic.

regards,
Dave

Pages: [1] 2