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

Pages: [1] 2
1
Code Snippets / FASTMEM2SPRITE
« on: 2017-Nov-11 »
For my application I found a certain slowness with MEM2SPRITE so I searched in the GLBASIC forum for a solution to this problem without finding anything.
So I wrote FASTMEM2SPRITE using the OpenGL routines. The result it is very fast and in some conditions, in high sprite resolution, even a 6X ratio on my computer. In Android, the increase is even slightly higher. The syntax is the same, obviously by adding FAST to the command. The only difference is that to draw the sprite because of the different coordinates of the OpenGL screen (bottom / left) you have to use the ZOOMSPRITE nsprite, 0,0, 1, -1 (vertical mirror).
Tried on Win and Android.
If you have better solution then you will be happy to receive your jobs.
Use it freely and let me know.
Ciao

2
Bug Reports / GLB 15.004 DO NOT COMPILE
« on: 2017-Aug-17 »
I rewrite after thread problem.
GLB 15.004 DO NOT COMPILE my FLAG_SPRITE, see source at http://www.glbasic.com/forum/index.php?Topic=11002msg96884#msg96884 and also Kanonet's X_SPRITE program (http://www.glbasic.com/forum/index.php?topic=7992.msg74110#msg74110).
GLB 15.005 fails to install
Can anyone check?
Ciao

3
GLBasic - en / Flag
« on: 2017-May-04 »
Hello guys, do you need a 3D waving flag in your games? Take a look at this program.
I used Kanonet's great XSPRITE program as base, because in real 3D (with X_OBJADDVERTEX ....) it's slower.
Works with Android.
Let me know.
Ciao

4
DD-GUI / DDGUI absolute positioning
« on: 2017-Feb-21 »
if you want the absolute positioning in DDGUI you must add the following lines of code in DDgui.gbas

   wabspos%=0 //added  line 444
   CASE "XPOS";     wdg.wxpos% = val$;wdg.wabspos%=1 //added  line 767
   CASE "YPOS";     wdg.wypos% = val$;wdg.wabspos%=1 //added  line 768
   IF wdg.wabspos%=1 // added  line 1585
      xpos%=wdg.wxpos% // added  line 1586
      ypos%=wdg.wypos% // added  line 1587
   ENDIF // added  line 1588


and use absolute positioning in this way:
DDgui_set(L_n_rate_year$, "YPOS",120)
DDgui_set(L_n_rate_year$, "XPOS", 50)



Only tried with DDgui_widget DDgui_numbertext DDgui_text DDgui_button.
These changes should not create incompatibility with standard DDGUI programs.
If this happens I apologize.
Let me know
Ciao
Qedo

5
GLBasic - en / DDGUI absolute positioning
« on: 2017-Feb-18 »
Hello to all
I wanted to write a simple rate and banking calculator by using DDGUI.
I found big problems to place text input and widget because of its relative positioning of the controls.
So I slightly modified the code DDGUI adding 7 lines of code.
I can now precisely place where I want DDgui_widget DDgui_numbertext DDgui_text DDgui_button.
Only tried with these.
if anyone is interested I will send the code
ciao
Qedo

6
GLBasic - en / DDgui & Android
« on: 2016-Dec-27 »
Hello to all
Do you know if there are problems with DDgui compiled for Android?
I tried with DDgui_test.gbas and also with my simplified version but with no success.
Tried with BlueStacks emulator and my smartphone (LG G3 Android 6.0) .
Error: "The application has stopped."
Some idea?
Ciao
Qedo

7
GLBasic - en / GL ES
« on: 2016-Dec-09 »
Hi all
It is expected to shift to the GL ES 2.0 or higher?
I would like to use the Shader on Android.
Ciao
Qedo

8
Hi
this example provides 2 different output in debug mode and in normal mode.
This problem has made me crazy in the vector font program that I'm writing
Ciao
Qedo

// Project: bug
// Start: Tuesday, August 16, 2016
// IDE Version: 14.329

a=0
IF a<>0 THEN
a=a-100
PRINT a , 10,10
SHOWSCREEN
MOUSEWAIT

9
It seems don't work SETMOUSE in PRESCALER condition (V14.006), without the command SYSTEMPOINTER TRUE
Try the example  and after, commenting "SYSTEMPOINTER TRUE".

Code: GLBasic [Select]
GETDESKTOPSIZE sx,sy
SETSCREEN sx,sy,1

SYSTEMPOINTER TRUE // if comment this line don't work SETMOUSE in PRESCALER condition
xfactor=3
xs=sx/xfactor
ys=sy/xfactor
PRESCALER xs,ys

   WHILE TRUE
          DRAWRECT      100, 100, 300, 100, RGB(255, 255, 0)
      LimitMouse(100, 100, 400, 200)
      PRINT "<=", mx, my
      IF b1 THEN END
      SHOWSCREEN
   WEND

FUNCTION LimitMouse: minx, miny, maxx, maxy
   MOUSESTATE mx, my, b1, b2
   PRINT mx+" "+my,0,0
   IF mx<minx THEN mx=minx
   IF mx>maxx THEN mx=maxx
   IF my<miny THEN my=miny
   IF my>maxy THEN my=maxy
   SETMOUSE mx, my
ENDFUNCTION
 


10
GLBasic - en / how to manage PRESCALER
« on: 2015-Aug-21 »
I'd like to know your thought on how to handle PRESCALER?
logical 1 or 2?, or other?
Ciao

1) graphic output fixed: example 480,320

     PRESCALER 480,320

     case  a:
      native resolution 1920-1280:  scaling factor = 4 (1920/480,1280/320)
     case  b
      native resolution 1280-720:  scaling factor = 2,66 (1280/480) o 2,25 (720/320)

     cons: only case "a" WORK, case "b" DON'T WORK considering the parameters of the scaling command PRESCALER
     pros: graphic output fixed

2) scaling factor fixed: example 4

   scaling_factor=4
   GETDESKTOPSIZE sx,sy
   xs=sx/scaling_factor
   ys=sy/scaling_factor
   PRESCALER xs,ys

     case a:
      native resolution 1920-1280:  graphic output = 480,320 (1920/4-1280/4)   RATIO 1.5 
     case b
      native resolution 1280-720:  graphic output = 320,180 (1280/4-720/4) RATIO 1.77


   cons: graphic output depending on the resolution of the video device (consider the multitude of resolutions in the world Android) and different ratio
   pros: ?

11
this simple program work correctly in GlBasic 10.283 and creates a sprite hole, while don't work in Glbasic 11.414  (see the picture)
Any idea?
Ciao


id% = GENSPRITE()
// Create virtual screen
CREATESCREEN 1,id%,32,32

USESCREEN 1
DRAWRECT 0,0,31,31,RGB(255,255,255) // white background os the sprite
DRAWRECT 4,4,24,24,RGB(255,0,128)  // transparent hole in the sprite

USESCREEN -1
DRAWRECT 100,100,70,70,RGB(255,0,0)  // draw the red background

DRAWSPRITE id%,120,120  // draw the sprite

SHOWSCREEN
MOUSEWAIT

12
GLBasic - en / GPS on Android
« on: 2012-Mar-08 »
Hi,
I'm writing a program for runners on Android. Someone's how to use GPS module?
Thank you
Ciao

13
GLBasic - en / array index
« on: 2012-Feb-12 »
hello all.
where is the mistake?
with  array3dLen_C = 80 all OK. With upper indices there is the error:
EXCEPTION_STACK_OVERFLOW.

ciao

INLINE
      int tc, zc, yc;
      int array3dLen_C=80;
      int array3d_C[array3dLen_C][array3dLen_C][array3dLen_C];
      for (tc = 0; tc < array3dLen_C; tc++)
         for (zc = 0; zc < array3dLen_C; zc++)
            for (yc = 0; yc < array3dLen_C; yc++)
                array3d_C[yc][zc][tc] = i;
ENDINLINE

14
Code Snippets / POW speed
« on: 2011-Sep-17 »
Don't use POW function  for value of power less or ugual to 40. It is very slow
Try this code
Ciao


[attachment deleted by admin]

15
I ask two things to those more experienced than me.
1) between GLB and C, in the float matrix multiplication benchmark, why there is a relationship in the rate of 5/1?   1400ms GLBasic and 300ms INLINE C. I think too high
2) Why the local arrays slow the program by 60%? LOCAL=2300ms against GLOBAL=1400ms.
To see this uncomment:
// LOCAL  a[]
// LOCAL  b[]
// LOCAL  c[]
Ciao

[attachment deleted by admin]

Pages: [1] 2