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 - moises1953

Pages: [1] 2 3 4
1
Did you click the option to export EXE to source folder?
Yes
And compiling in the powershell with output option has the same result.
C:\qb64\qb64.exe -c D:\QB64F\MeCepWin-F\MeCepWin-B00.BAS -o D:\QB64F\MeCepWin-F\

2
I have compiled from the powershell and indeed the compiler does not find a dll declared only by its name if it is next to the executable.
Therefore not that the IDE rejects it, but that the compiler does not find it and the IDE prevents, OK.
It seems ugly to me that an application with its DLL's cannot be deployed in the same folder, whatever it is

3
this is the best i could get, with this metod:
1. Limit memory transfer by substituting CLS for a limited background put. (BlackSprite)
2. Insert autodisplay at the beginning of the loop

Code: QB64: [Select]
  1. 'tvscreen43& = _NEWIMAGE(1920, 1080, 32) 'Optional to test
  2. tvscreen43& = _NEWIMAGE(320, 240, 32)
  3.  
  4. SCREEN tvscreen43& '               Set tvscreen& as the screen where we will display everything in the end. The active screen.
  5. _MOUSEHIDE '                       Hide the mouse cursor.
  6.  
  7.  
  8. 'Making stuff easier to adjust
  9. CONST ScreenEndLeft = 0
  10. CONST ScreenEndRight = 320 '1920
  11. CONST ScreenEndTop = 0
  12. CONST ScreenEndBottom = 240 '1080
  13. CONST ScreenWidth = 320 '1920
  14. CONST ScreenHeight = 240 '1080
  15. CONST ScreenCenterX = (ScreenWidth / 2)
  16. CONST ScreenCenterY = (ScreenHeight / 2)
  17.  
  18. 'THIS HAS SOME LEFT OVERS BUT THEY SHOULD NOT MATTER...
  19. TYPE Shot '                        PlayerShot definition.
  20.   alive AS _BYTE '               Is the shot alive on screen or not. Can be set to false if it goes off screen or if it collides with like an enemy.
  21.   x AS SINGLE '                  X coordinate of the shot.
  22.   y AS SINGLE '                  Y coordinate of the shot.
  23.   speed AS SINGLE '              The speed of the shot. Could be adjusted according to the shot speed of different cannons etc. if needed.
  24.   spriteheight AS INTEGER '      The height of the shot sprite. A bit overkill but used for calculating when the shot is completely off the screen.
  25.   spritewidth AS INTEGER '       Same but width.
  26.   dir AS _BYTE '                 What direction is the shot travelling in?
  27.   angle AS SINGLE
  28.   stepy AS SINGLE '              These are used for trig stuff to aim etc. etc.
  29.   stepx AS SINGLE
  30.   sprite AS LONG '** long pointer            What sprite is used for the shot
  31.   'maxshots AS SINGLE '          How many of this particular shot can be fired on screen at the same time.
  32.   'dmg AS SINGLE                 Damage value of the shot. Targets HP is reduced by this when hit.
  33. REDIM SHARED Shots(0) AS Shot '    Make it a dynamic array. Can be redimmed later to accomodate different amounts of shots.
  34.  
  35.  
  36. 'Shot sprite
  37. '8x8px
  38. '(Part of code is borrowed from somewhere like a tutorial or something...).
  39. ShotSpriteData:
  40. DATA &HFFFC00FC,&HFFFC00FC,&HFF000000,&HFF000000,&HFF000000,&HFF000000,&HFFFC00FC,&HFFFC00FC
  41. DATA &HFFFC00FC,&HFF000000,&HFFF7D8A5,&HFFF7D8A5,&HFFF7D8A5,&HFFF7D8A5,&HFF000000,&HFFFC00FC
  42. DATA &HFF000000,&HFFF7D8A5,&HFFF7D8A5,&HFFFFFEFF,&HFFFFFEFF,&HFFF7D8A5,&HFFF7D8A5,&HFF000000
  43. DATA &HFF000000,&HFFF7D8A5,&HFFFFFEFF,&HFFFFFEFF,&HFFFFFEFF,&HFFFFFEFF,&HFFF7D8A5,&HFF000000
  44. DATA &HFF000000,&HFFF7D8A5,&HFFFFFEFF,&HFFFFFEFF,&HFFFFFEFF,&HFFFFFEFF,&HFFF7D8A5,&HFF000000
  45. DATA &HFF000000,&HFFF7D8A5,&HFFF7D8A5,&HFFFFFEFF,&HFFFFFEFF,&HFFF7D8A5,&HFFF7D8A5,&HFF000000
  46. DATA &HFFFC00FC,&HFF000000,&HFFF7D8A5,&HFFF7D8A5,&HFFF7D8A5,&HFFF7D8A5,&HFF000000,&HFFFC00FC
  47. DATA &HFFFC00FC,&HFFFC00FC,&HFF000000,&HFF000000,&HFF000000,&HFF000000,&HFFFC00FC,&HFFFC00FC
  48.  
  49.  
  50. DIM SHARED ShotSprite AS LONG, BlackSprite AS LONG '** long pointer
  51. BlackSprite = _NEWIMAGE(3, 8, 32)
  52. _PUTIMAGE (0, 0), 0, BlackSprite
  53.  
  54. RESTORE ShotSpriteData
  55. FOR y = 0 TO 7: FOR x = 0 TO 7
  56.   READ sprite&: PSET (x, y), sprite& '** Full color
  57. NEXT x: NEXT y
  58.  
  59. _SETALPHA 0, _RGB32(252, 0, 252), ShotSprite
  60. ShotSprite = _NEWIMAGE(8, 8, 32)
  61. _PUTIMAGE (0, 0), 0, ShotSprite
  62.  
  63.  
  64.  
  65.  
  66. 'Set some properties of the shot
  67. Shots(0).x! = 0
  68. Shots(0).y! = 100
  69. Shots(0).spritewidth% = 8
  70. Shots(0).spriteheight% = 8
  71. Shots(0).dir%% = 0
  72. Shots(0).sprite = ShotSprite
  73.  
  74. SCREEN tvscreen43&
  75.  
  76.  
  77.  
  78. DO '                                                      Start of the "game loop".
  79.  
  80.   _LIMIT 60! '                                           Limit fps to 60 fps...
  81.  
  82.   'CLS
  83.   xant! = Shots(0).x!
  84.   Shots(0).x! = (xant! + 2) '                     If done with dynamic fps this line would instead be:
  85.   'Shots(0).x! = Shots(0).x! + 2 * (delta## * 60)
  86.  
  87.   'If the shot as gone off the right side screen edge, reset its position to the left side of screen.
  88.   IF Shots(0).x! >= (ScreenEndRight + Shots(0).spritewidth%) THEN Shots(0).x! = (ScreenEndLeft - Shots(0).spritewidth%)
  89.  
  90.   _PUTIMAGE (xant!, Shots(0).y!), BlackSprite '** Put the black sprite on buffer
  91.  
  92.   '_DISPLAY '
  93.  
  94.   _PUTIMAGE (Shots(0).x!, Shots(0).y!), ShotSprite '** Put the sprite on screen
  95.  
  96.   _DISPLAY '                                            Display it hopefully flicker less...
  97.  
  98.  
  99.   'SECTION FOR USING A "FIXED" FPS INSTEAD OF USING _LIMIT (UNCOMMENT _LIMIT AT TOP OF LOOP)
  100.   'Comment out _LIMIT 60 at top of loop
  101.   'Uncomment: LoopStartTime## = TIMER(0.001)
  102.   'Uncomment: delta## = (TIMER(0.001) - LoopStartTime##)
  103.   '
  104.   'Uncomment the code lines below:
  105.   '-------------------------------------------------------------------------------------------
  106.   'IF delta## < 0.0167 THEN '                           'If the time it took to complete the loop is less than 1 / 60...
  107.   '                                                      0.0167 could be replaced with (1/60)
  108.   'DO '                                                 '...enter a mini loop and check the time again and again until it is 1/60 or more.
  109.   'delta## = (TIMER(0.001) - LoopStartTime##)
  110.   '
  111.   'LOOP UNTIL delta## >= (0.0167) '                     'Again its possible to use (1 / 60) instead of 0.0167...
  112.   'END IF
  113.   '-------------------------------------------------------------------------------------------
  114.  
  115.  
  116.   'FOR DYNAMIC FPS (LOOP CAN BE AS FAST AS IT WANT BUT SHOT MOVES THE SAME DISTANCE):
  117.   'Replace: Shots(0).x! = (Shots(0).x! + 2) with: Shots(0).x! = Shots(0).x! + 2 * (delta## * 60)
  118.   '
  119.   'Comment out _LIMIT 60 in the loop
  120.   'Uncomment: LoopStartTime## = TIMER(0.001)
  121.   'Uncomment: delta## = TIMER(0.001) - LoopStartTime##
  122.  
  123.  
  124.  
  125.   'VARIANTS OF _PUTIMAGE LINE:
  126.   '-------------------------------------------------------------------------------------------
  127.   '_PUTIMAGE (INT(Shots(0).x!), INT(Shots(0).y!)), Shots(0).sprite% 'Putting it at integer values of the single type x and y values
  128.   '                                                                  that can potentially have decimals (because it cant be put between pixels...).
  129.  
  130.   'PSET ((Shots(0).x!), Shots(0).y!), &HFFF7D8A5 '                   Its the same if we only put a single pixel on the screen...
  131.  
  132.   '-------------------------------------------------------------------------------------------
  133. _FREEIMAGE ShotSprite
  134. _FREEIMAGE BlackSprite
  135.  

4
I think that SCREEN does nothing.

Example:
Code: QB64: [Select]
  1. PRINT "SCREEN"
  2.  
  3.  

In this case you should rescale the screen if you had set mode 0, but leave mode 2 as it was.
You can try to put SCREEN 0 in the last line.

5
Search for DLLs in development and deployment:

In version 1.4 you could declare a DLL simply by name and place it at the executable address, in system32, or at a specified address.

In later versions the IDE has been denying the compilation if the executable is not in QB64, even though the option has been chosen to locate the executables with the sources, and these outside of QB64, which does not seem to be correct.
This is the wiki text: The dynamic library file can be located in the QB64 folder (alongside your programs' .EXE '), in Windows' system32 folder, or in a relative / absolute path specified along with the library name
The consequences that this has in the deployment of an application with DDL's, is that it can no longer be located with the executable, but it can be done:
1. in a QB64 folder, which will have to be created, even if it is not necessary.
2. in system32
3. in a predefined address, for example C: \ AppName, for which it will be necessary to have the same path in the development environment.

Could it be a bug in the IDE?

6
The deployment of a 64 bit application in Windows also needs the 'Microsoft C++ redistributable (x64) 2015'

Now I have installed QB64 version 1.5, and the problem persists.
Since deploying a DLL in the .EXE folder itself works, the IDE should not give an error when it exists.
This is an IDE bug, preventing compilation if the DLL is not in system32.

7
QB64 Discussion / Re: Maths accuracy
« on: May 26, 2021, 01:17:58 pm »
As FellippeHeitor has brilliantly put it, the precision of binary floating point representation has its limitations.

For the precise representation of times it is better to use double precision or if it is enough milliseconds in LONG, which lasts for tens of years.

Test this:
Code: QB64: [Select]
  1. sectimer# = TIMER(0.001)
  2. milisectimer& = sectimer# * 1000
  3.  
  4. secini# = 34200.77
  5. secfin# = 39818.38
  6.  
  7. milisecini& = secini# * 1000
  8. milisecfin& = secfin# * 1000
  9.  
  10. PRINT USING " #####.###    "; secini#, secfin#, sectimer#
  11. PRINT milisecini&, milisecfin&, milisectimer&
  12.  
  13.  

8
May be this will be usefull:
In 'Settings - Update and security - For programmers', there is a 'programmer mode', normally deactivated, that allows you to install applications from any source, even individual files.

9
QB64 Discussion / Re: What Code-page option to chose?
« on: May 26, 2021, 02:37:15 am »
May be this will be usefull

  [ You are not allowed to view this attachment ]  

10
QB64 Discussion / Deployment of application with DLL in Windows 10
« on: May 22, 2021, 02:25:42 am »
Use and deployment of external DLL's in QB64 version 1.4:
The DECLARE DYNAMIC LIBRARY ["DLL name1", "DLL name2", ...] instruction allows the use of any type of dynamic library, both in Windows (DLL) and in Linux (SO), as long as it is declared below the call structure with the correct data types. For example (Windows):
DECLARE DYNAMIC LIBRARY "kernel32"
  FUNCTION GetThreadUILanguage% ()
  FUNCTION LCIDToLocaleName% (BYVAL LCID &, lcidName $, BYVAL length%, BYVAL dwFlags ~ &)
  FUNCTION GetUserDefaultLocaleName% (pwsLocale $, BYVAL LocaleLength%)
END DECLARE

These language functions are in the Windows 'kernel32' module, but since they have not been used by QB64, they need to be declared, as well as the call structure of the functions to use.
To use a library from a provider, it should be enough to copy it to the application folder, and call it by its name, without more, for example:
DECLARE DYNAMIC LIBRARY "NmxDLLx64"
 SUB NMX_GetDllVersion_1 (usMajor ~%, usMinor ~%, usPatch ~%, usBuild ~%)

Unfortunately, if it is only in the application folder, the IDE cannot find it and therefore does not allow it to be compiled, so it is necessary to copy it to system32 for the IDE to find it. On the other hand, the use of a relative location address such as ". \ NmxDLLx64" makes it work when compiling, but not when deploying the application, since the absolute address is resolved at compile time and makes the application not find the DLL in its own folder, but instead looks for the address where it was located when it was compiled.
For the generated executable to be able to use an external library with a simple name declaration, it must be located in C: \ windows \ system32 or in the same folder as the application, and this is sufficient for most cases, But for the IDE to find it and allow compiling, it must be in system32, however the generated executable will look for it in the application folder itself, so it will be enough to copy the application and the DLL together.
In my opinion it is necesary to make the IDE look like the executable.

11
QB64 Discussion / Re: unicode of character:how to do ?
« on: May 18, 2021, 04:57:59 am »
Usually the character codes in Windows are 8 bits, and therefore 256 different characters, of which the first 128 correspond to the 7-bit ASCII used in telecommunications since the time of the teletype, however the last 128 may vary according to the adaptation to the language performed using code pages. In western countries the code page is 1252.
QB64 does a character code mapping to be compatible with the original MSDOS page, known as 437, but that mapping can be changed with the _MAPUNICODE instruction.
Additionally, the _MAPUNICODE function allows obtaining the unicode code of each character in UTF32 format, which is the internal Windows format.
With this simple program you can see all:
Code: QB64: [Select]
  1. DEFLNG H-P
  2. CONST Apl = "Maped Unicodes"
  3.  
  4. SCREEN NEWIMAGE(800, 600, 256)
  5. TITLE Apl
  6. CONTROLCHR OFF
  7. 'OPEN "MapedUnicodes.txt" FOR OUTPUT AS #1
  8. line$ = ""
  9. FOR i = 0 TO 255 STEP 16
  10.   PRINT USING "###:"; i;
  11.   FOR j = i TO i + 15
  12.     map = MAPUNICODE(j)
  13.     IF j = i THEN
  14.       line$ = STR$(map)
  15.     ELSE
  16.       line$ = line$ + "," + STR$(map)
  17.     END IF
  18.     PRINT USING "#####"; map;
  19.  
  20.     READ kunicode
  21.     IF kunicode - map THEN PRINT "*"; ELSE PRINT " ";
  22.   NEXT j
  23.   '  PRINT #1, line$
  24. 'CLOSE #1
  25. FOR i = 0 TO 255 STEP 16
  26.   PRINT USING "###:"; i;
  27.   FOR j = i TO i + 15
  28.     PRINT CHR$(j);
  29.   NEXT j
  30. PRINT CHR$(128)
  31.  
  32. 'unicodes -> CP437
  33. DATA 32,9786,9787,9829,9830,9827,9824,8226,9688,9675,9689,9794,9792,9834,9835,9788
  34. DATA 9658,9668,8597,8252,182,167,9644,8616,8593,8595,8594,8592,8735,8596,9650,9660
  35. DATA 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
  36. DATA 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
  37. DATA 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79
  38. DATA 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95
  39. DATA 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
  40. DATA 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,8962
  41. DATA 199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197
  42. DATA 201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402
  43. DATA 225,237,243,250,241,209,170,186,191,8976,172,189,188,161,171,187
  44. DATA 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
  45. DATA 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
  46. DATA 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
  47. DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  48. DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,32
  49.  

12
QB64 Discussion / Re: Memory in Use (API or something) QB64 code
« on: March 21, 2021, 01:59:48 pm »
Here is the Windows API for global memory status:
https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-globalmemorystatusex

And here the QB64 code:
Code: QB64: [Select]
  1. 'MemStat
  2. TYPE MEMORYSTATUSEX
  3.   dwLength AS LONG
  4.   dwMemoryLoad AS LONG
  5.   ullTotalPhys AS _UNSIGNED _INTEGER64
  6.   ullAvailPhys AS _UNSIGNED _INTEGER64
  7.   ullTotalPageFile AS _UNSIGNED _INTEGER64
  8.   ullAvailPageFile AS _UNSIGNED _INTEGER64
  9.   ullTotalVirtual AS _UNSIGNED _INTEGER64
  10.   ullAvailVirtual AS _UNSIGNED _INTEGER64
  11.   ullAvailExtendedVirtual AS _UNSIGNED _INTEGER64
  12.  
  13. DECLARE CUSTOMTYPE LIBRARY 'Memory Information using KERNEL32
  14.   FUNCTION GlobalMemoryStatusEx& (Mstat AS MEMORYSTATUSEX)
  15.  
  16. DIM MemStat AS MEMORYSTATUSEX
  17. DIM Result AS LONG
  18.  
  19. MemStat.dwLength = LEN(MemStat)
  20. Result = GlobalMemoryStatusEx&(MemStat)
  21.  
  22. 'PRINT MemStat.dwLength
  23. PRINT "% Memory in use......:"; MemStat.dwMemoryLoad
  24. PRINT "Total physical memory:"; USING "###,###,###,###"; MemStat.ullTotalPhys
  25. PRINT "Free physical memory.:"; USING "###,###,###,###"; MemStat.ullAvailPhys
  26. 'PRINT MemStat.ullTotalPageFile
  27. 'PRINT MemStat.ullAvailPageFile
  28. 'PRINT MemStat.ullTotalVirtual
  29. 'PRINT MemStat.ullAvailVirtual
  30. 'PRINT MemStat.ullAvailExtendedVirtual
  31.  
  32.  

13
QB64 Discussion / Re: Deployment of application with DLL in Windows 10
« on: March 20, 2021, 02:46:29 pm »
Well, if you are going to deploy an application with a DLL and you want it to look for it in the executable folder using 'DECLARE DYNAMIC LIBRARY ". \ <Dll name>", it will not do it, unless it is the same path in which it was compiled .
For more information read the initial post.

14
QB64 Discussion / Re: Deployment of application with DLL in Windows 10
« on: March 18, 2021, 12:27:42 pm »
In this case it is a DLL provided by a provider and does not include an .h file.

Are the conclusions valid?

15
The serial ports must be used  using put and get, char by char, so you must create your own line function, like this to substitute the print command

Code: QB64: [Select]
  1. SUB PrintCOM (line$) STATIC
  2.   DIM car AS _BYTE 'STRING * 1
  3.   FOR i = 1 TO LEN(line$)
  4.     car = ASC(line$, i)
  5.     PUT #1, , car
  6.   NEXT i
  7.   car = 13 'Cr: End of line in Windows
  8.   PUT #1, , car
  9.  


Pages: [1] 2 3 4