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.


Messages - dreamerman

Pages: [1] 2 3 ... 19
1
Bug Reports / Re: Profiler broken?
« on: Yesterday at 10:54 am »
I saw gprof2dot and tried it, little messing around with all that python, PATH setting stuff but it worked. Checked it on simple demo and produced image graph isn't something spectacular, at least it shows some connections between functions, but not all :/
There are some active profilers like tracy with more features but they require including additional functions/source in project, this particular profiler should be compatible with GCC & OpenGL.

2
GLBasic - en / Re: Fullscreen fix
« on: 2019-May-23 »
So You are rather looking for something like PRESCALER command? To get Your game scaled properly to all resolutions that user can choose.
There was also one system for that made by spacefractal
Or I'm getting something wrong - it's late :D

3
GLBasic - en / Re: Fullscreen fix
« on: 2019-May-23 »
hm.. on what OS You have problems with SetScreen? Did You tried using SetScreen on basic project just ot test if some graphic functions like 3d is causing problems?
Personally I didn't encounter problems with SetScreen apart one - default res 720p game on some user laptop (WXGA display) - game window was wrongly positioned - wasn't centered (so he wasn't able to see bottom of it), but that can be bypassed by manual change in app cfg file.

4
Bug Reports / Re: Profiler broken?
« on: 2019-May-23 »
Just tried and -pg is working ok (tested on small project), comment strip command, add '-pg' in project options in cmp & link, compile your app normally (no profiler).
Run your app for some time, so You will have something to measure, end/exit it, now it should create 'gmon.out' file, create .bat file or launch cmd, assuming that You will launch gprof.exe from app directory command should like this:
"GLBasic_SDK\Compiler\platform\Win32\bin\gprof.exe" youapp.exe gmon.out > profiler.txt
And here you have it. Only thing that those result's are basic and maybe could be better with other profiler/debugger - I will need to check some of them as nice graphs and better info/details would be handy :)

ps. I've checked some other profilers but all have some problems, either are vendor specific (AMD, Nvidia, Intel) or work only with VS projects (need *pdb file) and so on.. Basic gprof output may be sufficient, but I would like to compare it to GLB profiler (yet still can get it work even with previous versions hm..).

5
Bug Reports / Re: Profiler broken?
« on: 2019-May-22 »
That command is surely added by GLB Editor during compilation, so rather no way to fix this in that way. One workaround is to compile from cmd, You can grab whole compilation/link command passed to gcc using this
Start compile in GLB with profiler, switch to ProcessExplorer when GLB comes to 'link' part, hit space (on ProcessExplorer - pause refreshing) search for g++ entry and copy whole cmd, fix that wrongly placed ' ', save that to .bat file. Use it after GLB 'compile' stage to get your app (it would be something like output.obj in %TEMP%\glbasic folder).

On other hand just checked GLB v15 and I have some issues with profiler.. Didn't use it from a long time, yet I remember that it worked, now it produces empty csv file, maybe I'm doing something wrong...

ps. to avoid symbols stripping just comment (';') one line in proper platform.ini file:
Code: GLBasic [Select]
strip="%GLBASIC%Compiler\platform\Win32\bin\strip.exe" --strip-all

6
Bug Reports / Re: Profiler broken?
« on: 2019-May-21 »
Yes it's an error, surely with passing arguments to GCC (g++.exe) during link stage, GLB just doesn't add space before '-lGLBProfiler' command. Checked and 'GLBProfiler' library is in proper directory directory. File: 'resource.o' is from what I remember icon file, as now it's linked/added to project in different way than in previous GLB versions.
But another thing should be fixed too (also easy-to-fix), 'resource.rc' that's VERSIONINFO file, it contains little bug;
BLOCK "StringFileInfo" and BLOCK "VarFileInfo" should contain translation in same language code, now GLB sets StringFileInfo to '0809' code - UK English, but VarFileInfo has only translation for '0x409' - US English, this way file doesn't show proper description (author, copyright, version) in file-properties-details in system.
Just set both block's to same language, best US English so it would be:
Code: GLBasic [Select]
BLOCK "040904E4"
[...]
VALUE "Translation", 0x409, 1252
 
Info about VERSIONINFO resource file

7
It doesn't matter what programming language was used to make dll file, only what matters it that it should export functions with 'stdcall' calling convention, also 'cdecl' is supported without problems. (info about calling conventions: https://en.wikipedia.org/wiki/X86_calling_conventions) You can use DECLARE keyword to make direct use of dll functions in your code: http://www.glbasic.com/xmlhelp.php?lang=en&id=191&action=view
If you encounter problem with some specific dll and function just ask. GLB code is translated to c++, then compiled (so it doesn't have limitations present on other such tools), you can write direct c++ code to make use of some specific things not available directly on GLB itself ;)

8
Competitions / Re: GLBasic Contest 02: 2D Art
« on: 2019-May-16 »
@WPShadow - for me sounds ok.

@Snoopy - true console mode sounded original, we can have this earlier or later and another contest with limitations for only SetPixel.
For moment I was thinking that we are limited to standard console colors but:

main file
Code: GLBasic [Select]
// project -> options -> console program
LOCAL i1%, i2%
FOR i2 = 0 TO 15
        FOR i1 = 0 TO 15
                ConsoleSetColor(i1, i2)
                STDOUT "test"
        NEXT
        STDOUT "\n"
NEXT
KEYWAIT
second file
Code: GLBasic [Select]
IMPORT "C" int __stdcall GetStdHandle(int nStdHandle)
IMPORT "C" int __stdcall SetConsoleTextAttribute(int hConsoleOutput, int wAttributes)

FUNCTION ConsoleSetColor: fg_color%, bg_color%
        LOCAL console_handle% = GetStdHandle(-11)
        SetConsoleTextAttribute(console_handle, bg_color% * 16 + fg_color%)
ENDFUNCTION

only question is how fast console window can be refreshed, and some functions to print at selected X,Y position would be also usefully.
Another thing is that you need to have idea for demo that would fit into console/text mode nicely, this may be an issue for me hehe... :D

9
Off Topic / Re: Shaders
« on: 2019-May-15 »
Was it this topic? I think that there was also another one, but maybe not started by You, it had shaders included as sources not as attachments (that are now unavailable). Still this topic also gives some important info :)

10
Off Topic / Re: Shaders
« on: 2019-May-15 »
Already available shaders can be some base if you need basic/simple effects, only issue is that they are scattered on different forum threads.
Helmos I saw that topic some time ago but forgot to mark it, and now I can't find it :D

11
Imho if You want to delete elements by index/id in basic type array (int, float, string) and want to preserve elements position do something like this:

Code: GLBasic [Select]
// compile in Debug mode

GLOBAL myarray%[], elems2del%[], i1%, i2%, txt$
DIM myarray%[0]
DIM elems2del%[0]

SEEDRND 1
txt$ = ""
FOR i1 = 0 TO 20
        i2 = RND(100)
        DIMPUSH myarray[], i2
        INC txt$, i2 + ", "
NEXT
txt$ = LEFT$(txt$, LEN(txt$) - 2)

DEBUG txt$ + "\n"


DIMDATA elems2del[], 7, 14, 9   // or use DimPush
SORTARRAY elems2del[], 0        // ascending order

FOR i1 = LEN(elems2del[]) - 1 TO 0 STEP -1
        DIMDEL myarray[], elems2del[i1]
NEXT


txt$ = ""
FOR i1 = 0 TO LEN(myarray[]) - 1
        INC txt$, myarray[i1] + ", "
NEXT
txt$ = LEFT$(txt$, LEN(txt$) - 2)

DEBUG txt$ + "\n"


END

For dealing with UDT's I use 'toDelete%' flag, or approach similar to this, separate array with indexes to delete - depending on game logic, and if I don't need to preserve elements order just do elem[del_id] = elem[len[elem]-1], dec elem_count -> as this should be faster than multiple dimdel/push on large arrays.

12
GLBasic - en / Re: Inline C++
« on: 2019-May-10 »
What GLB version You are using? On v16 include files are in different path that in v15 (that I posted previously). Maybe some system environment variable was wrongly set, did You tried different GLB versions or reinstalling GLB?

in GLB v15:
cstdio -> 4.26KB
stdio.h ->14.7KB

13
Competitions / Re: GLBasic Contest 02: 2D Art
« on: 2019-May-10 »
Looks like that Norton heuristic is highly restrictive as I just checked that original exe file from Snoopy project with Total Virus (Steam uses this for scanning apps) and only 1 warning per 70 AV scanners.

@Snoppy: I really like those particles - due that shading from color to black, simple but very effective. In addition that music, theme from Space Odyssey is always great :)

@Moru: Nice and interesting, with some additional rules to include more colors could give some spectacular result. This could be used as background for some part of larger demo.


About next contest:
It all depends on the contest, something small doesn't long running time, still at least one month so all interested could code their entry on free weekend (as even this topic shows). Breaks could for example take half of time that contest was running, or at least two-three weeks independently of contest duration.

Console/textmode contest sounds cool, yet will force to work harder to code something interesting – should last longer than this. Additional rules could be added here – for example demo running time max 3 minutes.

14
GLBasic - en / Re: Inline C++
« on: 2019-May-09 »
hm.. strange, before posting I checked that code with GLB 15 & 16.. low chance, but maybe that lib is missing, check in: 'GLBasic\Compiler\platform\Win32\Include'.
Or maybe I did forgot about something trivial  ;/
Problem appears with all projects using INLINE? (some complete projects from forum too)

15
GLBasic - en / Re: Inline C++
« on: 2019-May-09 »
Another thing that INLINE shouldn't be in main source file (not sure about this), so this will work:
main source:
Code: GLBasic [Select]
GOSUB main

SUB main:

printf1()

PRINT "HELLO",100,100
SHOWSCREEN
KEYWAIT
ENDSUB
 
second file:
Code: GLBasic [Select]
INLINE
        }
                extern "C" {
                        #include <cstdio>
                }
        namespace __GLBASIC__ {
ENDINLINE


FUNCTION printf1:

INLINE

   char z[100] = "I am learning C programming language.";
 
   printf("%s", z);
   
   return 0;
   
ENDINLINE

ENDFUNCTION
 

Take a note that printf writes to standard output stream, so either app should be compiled as console application, use other function as GLBasic debug doesn't catch stdout info (not sure) or write output to file for example with such batch command in Windows (write file as *.bat):
Code: GLBasic [Select]
inline_test.exe >>stdout.txt

Pages: [1] 2 3 ... 19