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

Pages: [1]
1
Programs / Raylib Wrapper Complete
« on: August 16, 2019, 03:49:05 pm »
Hello all,

I have recently finished another wrapper for QB64. This time the source is included. It is a wrapper for Raylib. Raylib is a library for video game programming.

Raylib Wrapper: https://github.com/gAndy50/Qb64Wrappers

Feedback is appericated.

EDIT: Added Example on forum post.

Code: QB64: [Select]
  1. 'Raylib Basic Simple Window
  2. REM $include: 'raylib.bi'
  3.  
  4. LET w = 800
  5. LET h = 600
  6.  
  7. CALL InitWindow(w, h, "Simple")
  8.  
  9. SetTargetFPS (60)
  10.  
  11. DIM SHARED Col AS rColor
  12.  
  13. Col.r = 0
  14. Col.g = 255
  15. Col.b = 0
  16. Col.a = 255
  17.  
  18.  
  19.     BeginDrawing
  20.  
  21.     CALL ClearBackground(_RGBA32(Col.r, Col.g, Col.b, Col.a))
  22.  
  23.     CALL DrawText("Hello World" + CHR$(0), 10, 30, 20, _RGBA32(255, 0, 0, 255))
  24.  
  25.     IF IsKeyPressed(KEY_LEFT) THEN
  26.         CALL DrawText("Left" + CHR$(0), 10, 60, 20, _RGBA32(255, 0, 0, 255))
  27.     END IF
  28.  
  29.    CALL DrawFPS(10, 10)
  30.  
  31.     EndDrawing
  32.  
  33. LOOP UNTIL WindowShouldClose
  34.  
  35. CloseWindow
  36.  

2
Programs / Re: Sigil Wrapper [Complete]
« on: August 15, 2019, 10:01:08 pm »
Lefty is right (no pun).

We all expect way too much free stuff when it comes to digital goods.

However, I think the proposed gatekeeping/paywall needs to be reversed. Release the code first, and then if people feel it's worth donating to the author, then let them do so. I mean hell, we could *all* set up such tip jars. Imagine that, a "Donate" button built into the InForm face somewhere. Self-referential ads are a good idea in my opinion... but for real, don't make us "buy" the code up front - not to mention, such a pirate-friendly model is SO easy to break.

You make a very good point. If people like such software/code, then I think they should donate or at least send a few bucks the author's way. I'll release the code in hopes people will like it and maybe in return receive a little profit.

3
Programs / Re: Sigil Wrapper [Complete]
« on: August 15, 2019, 06:00:42 pm »
Well Lefty,
guess you will remain the one and only who will ever use this wrapper. You ask for money, think twice, we don't even have something real to test yet. Your codebox above is just pseudo code without providing sigil.bi to us.

And if you don't wanna release your source here, then you should at least create a reasonable demo program and provide the compiled EXE of it together with some more useful info, because nobody will buy the cat in a poke.

Thanks for the feedback. I will think about this.  My idea was only asking for about $5 USD for the source code.

4
Programs / Re: Sigil Wrapper [Complete]
« on: August 15, 2019, 04:33:49 pm »
You misunderstand our humor, I'd say there is considerable interest.

Alrighty then. Well anyone's who's interested, send me a PM. I believe I can sell this for a reasonable price, as it doesen't conflict with any of QB64's existing license.

5
Programs / Re: Sigil Wrapper [Complete]
« on: August 15, 2019, 04:10:14 pm »
Can't tell, seems like most of the replies are sarcarstic. Well if anyone is interested, send me a PM and we can work something out.

6
Programs / Sigil Wrapper (Source now Included!) [Complete]
« on: August 15, 2019, 01:12:12 am »
Hello,

I have made wrapper of the Sigil library for QB64. I haven't released the source code yet, but it is working! Wondering if some you might be interested in it.

SigilBasic https://github.com/gAndy50/Qb64Wrappers

If anyone finds this useful and would like to donate, I do have Paypal and Patreon.

Code: QB64: [Select]
  1. REM $include: 'sigil.bi'
  2.  
  3. CALL slWindow(640, 480, "Hello - Press arrow keys to change Backdrop color!", slFALSE)
  4.  
  5.     slRender
  6.     IF slGetKey(SL_KEY_LEFT) = 1 THEN
  7.         CALL slSetBackColor(255, 255, 255)
  8.     ELSEIF slGetKey(SL_KEY_RIGHT) = 1 THEN
  9.         CALL slSetBackColor(255, 255, 0)
  10.     ELSEIF slGetKey(SL_KEY_DOWN) = 1 THEN
  11.         CALL slSetBackColor(0, 0, 0)
  12.     ELSEIF slGetKey(SL_KEY_UP) = 1 THEN
  13.         CALL slSetBackColor(0, 0, 255)
  14.     END IF
  15.  
  16. LOOP UNTIL slGetKey(SL_KEY_ESCAPE)
  17.  
  18. slClose
  19.  
  20.  

7
Programs / Re: Raylib Wrapper Help
« on: August 14, 2019, 05:11:19 pm »
Hi again. Please return your definitions for TYPE (struct) rColor all as _UNSIGNED _BYTE (one color R or G or B or Alpha, one byte, max value = 255). This all colors in one are defined as _UNSIGNED LONG. So my next tip is try:

   CALL ClearBackground (_RGBA32(0,255,0,255)) if this create green background.

Maybe help you this example:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32) 'create screen
  2. LINE (300, 200)-(500, 400), _RGBA32(0, 255, 0, 255), BF
  3. P = POINT(400, 300)
  4. 'next four colors all are _UNSIGNED _BYTE TYPE
  5. PRINT "Alpha channel for point in 400,300 is"; _ALPHA32(P)
  6. PRINT "RED channel for point in 400,300 is"; _RED32(P)
  7. PRINT "GREEN channel for point in 400,300 is"; _GREEN32(P)
  8. PRINT "BLUE channel for point in 400,300 is"; _BLUE32(P)
  9. 'this is the same color for all channels in one and is _UNSIGNED LONG TYPE
  10. PRINT "Unsigned Long color for point 400,300 is:"; P
  11. PRINT "This color can be also written as "; _RGBA32(_RED32(P), _GREEN32(P), _BLUE32(P), _ALPHA32(P))
  12.  

Thanks. After trying this, I got it!

NOTE: I have the Declare Library function for Raylib inside of another .bi file.

Code: QB64: [Select]
  1. 'Raylib Basic Simple Window
  2. REM $include: 'raylib.bi'
  3.  
  4. LET w = 800
  5. LET h = 600
  6.  
  7. CALL InitWindow(w, h, "Simple")
  8.  
  9. SetTargetFPS (60)
  10.  
  11. DIM SHARED Col AS rColor
  12.  
  13. Col.r = 0
  14. Col.g = 255
  15. Col.b = 0
  16. Col.a = 255
  17.  
  18.     BeginDrawing
  19.  
  20.     CALL ClearBackground(_RGBA32(Col.r, Col.g, Col.b, Col.a))
  21.  
  22.     'CALL DrawText("Hello World" + CHR$(0), 10, 50, 20, 255, 255, 255, 255)
  23.  
  24.     CALL DrawFPS(10, 10)
  25.  
  26.     EndDrawing
  27.  
  28. LOOP UNTIL WindowShouldClose
  29.  
  30. CloseWindow
  31.  
  32.  

8
Programs / Re: Raylib Wrapper Help
« on: August 14, 2019, 03:10:32 pm »
Thanks for the tips, but I still can't get the screen to color correctly(I want the background to change green).

Code: QB64: [Select]
  1. TYPE rColor
  2.     r AS _UNSIGNED LONG
  3.     g AS _UNSIGNED LONG
  4.     b AS _UNSIGNED LONG
  5.     a AS _UNSIGNED LONG
  6.  

Code: QB64: [Select]
  1.    SUB ClearBackground (BYVAL rColor AS _UNSIGNED LONG)    
  2.  

Code: QB64: [Select]
  1. 'Raylib Basic Simple Window
  2. REM $include: 'raylib.bi'
  3.  
  4. LET w = 800
  5. LET h = 600
  6.  
  7. CALL InitWindow(w, h, "Simple") 'this brings up the window from Raylib
  8.  
  9. SetTargetFPS (60)
  10.  
  11. DIM SHARED Col AS rColor
  12.  
  13. Col.r = 0
  14. Col.g = 255
  15. Col.b = 0
  16. Col.a = 255
  17.  
  18.     BeginDrawing
  19.  
  20.     CALL ClearBackground(Col.r+Col.g+col.b+col.a) 'Still not changing the screent o green
  21.  
  22.     'CALL DrawText("Hello World" + CHR$(0), 10, 50, 20, 255, 255, 255, 255)
  23.  
  24.     CALL DrawFPS(10, 10)
  25.  
  26.     EndDrawing
  27.  
  28. LOOP UNTIL WindowShouldClose
  29.  
  30. CloseWindow
  31.  
  32.  

9
Programs / Raylib Wrapper Help
« on: August 13, 2019, 06:52:59 pm »
Hello All,

I am trying to make a wrapper for QB64 with Raylib. Its going along smoothly except for getting the color part right. When I run the program, I get a red screen, so I'm on the right path, just can't figure out what I'm doing wrong. I assume there's a way to convert bytes to ints, but I'm unsure how in QB64. I know most other coding languages have a simple function, is there some steps for doing how? I want the background to be green. Also, on a side note how would I disable the default screen from coming up when calling a window from an external library?

EDIT: I thought I should probably mention in the raylib.h file, the Color struct are defined as unsigned chars. Like this:

typedef struct Color {
    unsigned char r;
    unsigned char g;
    unsigned char b;
    unsigned char a;
} Color;

'Bi File (Flags)
Code: QB64: [Select]
  1. TYPE rColor
  2.  
  3.  

'Bi file (Function)
Code: QB64: [Select]
  1.   SUB ClearBackground (BYVAL rColor AS _UNSIGNED _BYTE)  
  2.  

'Sample Program
Code: QB64: [Select]
  1. 'Raylib Basic Simple Window
  2. REM $include: 'raylib.bi'
  3.  
  4. LET w = 800
  5. LET h = 600
  6.  
  7. CALL InitWindow(w, h, "Simple")
  8.  
  9. SetTargetFPS (60)
  10.  
  11. DIM SHARED Col AS rColor
  12.  
  13. Col.r = 0
  14. Col.g = 255
  15. Col.b = 0
  16. Col.a = 255
  17.  
  18.     BeginDrawing
  19.  
  20.     CALL ClearBackground(Col.g)
  21.  
  22.     'CALL DrawText("Hello World" + CHR$(0), 10, 50, 20, 255, 255, 255, 255) 'ignore for now
  23.  
  24.     CALL DrawFPS(10, 10)
  25.  
  26.     EndDrawing
  27.  
  28. LOOP UNTIL WindowShouldClose
  29.  
  30. CloseWindow
  31.  
  32.  

Pages: [1]