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

Pages: [1] 2 3 4
1
Off Topic / itch.io GBJam 5
« on: 2016-Sep-29 »

2
Normally, it's fine even unfocused but how can I capture the screen when the server program is running minimized or perhaps even as a console?




3
On Linux/RPi, how can I fast pass an array (not command args nor serial) from a running GLBasic program to a running cpp (compiled with g++)?  :'( :S

4
Bug Reports / RPi 3D X_ROTATION crashes
« on: 2015-Dec-11 »
Although I've attempted unsuccessfully many times to, I decided to try out 3D carefully on the Raspberry Pi 2 again and gladly discovered that it works very well this time. The problems that I encountered was X_ROTATION only caused the crash (segmentation fault or sometimes bus error). Also, SIN and COS are not working so I easily replaced that with QSIN/QCOS, to rotate the camera around the object. Ambient light work 95% but some flickering from scene rotation but spotlights don't work. Test file attached.

 ;) 8)


5
There's self. but how can I reference nested type referencing?   :-[
Logically, should there be parent. also?   :zzz:

Nested TYPE Example:
Code: GLBasic [Select]
TYPE _item
    id
    selected_id
    color
    size
    FUNCTION set:
         self.id = basket.item_id                    // absolute
//      self.id = parent.parent.item_id       // would prefer relative          
    ENDFUNCTION
ENDTYPE

TYPE _group
    apple AS _item
    banana AS _item
ENDTYPE

TYPE _base
    item_id
    fruit AS _group
ENDTYPE

GLOBAL basket as _base
basket.fruit.apple.set()
 

6
Beta Tests / Bouldery(dash)
« on: 2015-Oct-22 »
So here's another game, a Boulderdash type, that I get near to completion, well at least the goal was for functionality so that it just now needs some design and art.  :whistle:  Any suggestions for what the players could be? perhaps erico might like to help me complete this game so it looks presentable and fun.  :P


7
I'm presume a Android smart watch is just a smaller screen. I'm not so sure about them so I wonder would GLBasic compile for it?  :zzz:

8
GLBasic - en / JSON parser?
« on: 2014-Nov-19 »
Has anyone posted or created a json parser?  :whistle:

9
GLBasic - en / 3D Vertex Rotation
« on: 2014-Nov-05 »
I'm trying to create a wireframe for 3D array of vertices with just X_LINE output (no X_GETMATRIX or X_GETFACES input) although I can't seem to get it right. Any suggestion why this classic function isn't right as the object is skewed at certain angles but okay near the perpendicular? :'(
Code: GLBasic [Select]
        FUNCTION rotation AS _point: ob AS _obj, v AS _point
                LOCAL p AS _point
                p = v
                INC p.x, v.x
                INC p.y, (COS(ob.angle.x) * v.y) - (SIN(ob.angle.x) * v.z)
                INC p.z, (SIN(ob.angle.x) * v.y) - (COS(ob.angle.x) * v.z)             
               
                INC p.x, (SIN(ob.angle.y) * p.z) + (COS(ob.angle.y) * p.x)
                INC p.y, v.y
                INC p.z, (COS(ob.angle.y) * p.z) - (SIN(ob.angle.y) * p.x)             

                INC p.x, (COS(ob.angle.z) * p.x) - (SIN(ob.angle.z) * p.y)
                INC p.y, (SIN(ob.angle.z) * p.x) + (COS(ob.angle.z) * p.y)             
                INC p.z, v.z
                RETURN p
        ENDFUNCTION

        FUNCTION wire: ob AS _obj
                IF self.mouse.b1
                        ob.rotate.x = self.mouse.y_axis
                        ob.rotate.y = self.mouse.x_axis
                        INC ob.angle.x, ob.rotate.x
                        INC ob.angle.y, ob.rotate.y
                ENDIF
                LOCAL e AS _point
                LOCAL f AS _point
                FOR i = 0 TO ob.vertices - 2
                        ALIAS v AS ob.ver[i]
                        ALIAS u AS ob.ver[i + 1]
                        e = self.rotation(ob, v)
                        f = self.rotation(ob, u)
                        X_LINE  e.x, e.y, e.z,  f.x, f.y, f.z,  1, 0xffffff // v.color.value
                NEXT
        ENDFUNCTION
 

10
Off Topic / 3D printed logo
« on: 2014-Oct-25 »
 :whistle:

11
Code Snippets / Gamepad Test
« on: 2014-Aug-10 »
So I finally got a USB PC/Linux gamepad for the first time, a Logitech F310.  :enc: =D
It's cool and works well, so I had to write a test tool and included some compensation trimming as I noticed that the left and right, x & y axis of the analog sticks don't spring back to center sometimes (eg. 0.05 at worst).  ::) I'm not sure if this is hardware or software as the springy z triggers always return to zero.  :P

I was hoping to use it on Adnroid but when I test it only returns the accelerometers.

Code: GLBasic [Select]
// --------------------------------- //
// Project: Game Pad Test
// Start: Sunday, August 10, 2014
// IDE Version: 12.096

TYPE _font
        num
        width
        height
ENDTYPE

TYPE _sprite
        num
        width
        height
ENDTYPE

TYPE _screen
        width
        height
        width2
        height2
        backcolor
        font AS _font
        sprite_id

        FUNCTION init:
                SETSCREEN 800, 600, 0
                GETSCREENSIZE self.width, self.height
                self.width2 = self.width / 2
                self.height2 = self.height / 2
                self.backcolor = 0x000000
                self.font.num = GENFONT()
                LOCAL file$ = "Media/font.png" // make a font file!
                IF DOESFILEEXIST(file$)
                        LOADFONT file$, self.font.num
                        SETFONT self.font.num
                ENDIF
                GETFONTSIZE self.font.width, self.font.height
        ENDFUNCTION
ENDTYPE

TYPE _joy
        a = 0
        b = 1
        x = 2
        y = 3
        lb = 4
        rb = 5
        back = 6
        start = 7
        l = 8
        r = 9

        jx = 0
        jy = 1
        jz = 2
        rx = 3
        ry = 4
        rz = 5
        dx = 6
        dy = 7

        count
        stick[] AS _stick

        FUNCTION init:
                self.count = GETNUMJOYSTICKS() - 1
                IF self.count > -1
                        DIM self.stick[self.count + 1]
                        FOR i = 0 TO self.count
                                self.stick[i].id = i
                                DIM self.stick[i].button[32]
                                DIM self.stick[i].control[8]
                                FOR j = 0 TO 31
                                        SELECT j
                                                CASE joy.a
                                                        self.stick[i].button[j].name$ = "A (Green)"
                                                CASE joy.b
                                                        self.stick[i].button[j].name$ = "B (Red)"
                                                CASE joy.x
                                                        self.stick[i].button[j].name$ = "X (Blue)"
                                                CASE joy.y
                                                        self.stick[i].button[j].name$ = "Y (Yellow)"
                                                CASE joy.lb
                                                        self.stick[i].button[j].name$ = "Left Top"
                                                CASE joy.rb
                                                        self.stick[i].button[j].name$ = "Right Top"
                                                CASE joy.back
                                                        self.stick[i].button[j].name$ = "Back"
                                                CASE joy.start
                                                        self.stick[i].button[j].name$ = "Start"
                                                CASE joy.l
                                                        self.stick[i].button[j].name$ = "Left Joy"
                                                CASE joy.r
                                                        self.stick[i].button[j].name$ = "Right Joy"
                                                DEFAULT
                                                        self.stick[i].button[j].name$ = "?"
                                        ENDSELECT
                                NEXT
                                FOR j = 0 TO 7
                                        SELECT j
                                                CASE joy.jx
                                                        self.stick[i].control[j].name$ = "Left Joy X"
                                                CASE joy.jy
                                                        self.stick[i].control[j].name$ = "Left Joy Y"
                                                CASE joy.jz
                                                        self.stick[i].control[j].name$ = "Left Joy Z"
                                                CASE joy.rx
                                                        self.stick[i].control[j].name$ = "Right Joy X"
                                                CASE joy.ry
                                                        self.stick[i].control[j].name$ = "Right Joy Y"
                                                CASE joy.rz
                                                        self.stick[i].control[j].name$ = "Right Joy Z"
                                                CASE joy.dx
                                                        self.stick[i].control[j].name$ = "Pad X"
                                                CASE joy.dy
                                                        self.stick[i].control[j].name$ = "Pad Y"
                                                DEFAULT
                                                        self.stick[i].control[j].name$ = "?"
                                        ENDSELECT
                                NEXT
                        NEXT
                ENDIF
        ENDFUNCTION

        FUNCTION show:
                WHILE TRUE
                        IF self.count > -1
                //              FOREACH js IN joy.stick[]
                                        self.stick[0].update()
                                        self.stick[0].view()
                //              NEXT
                        ELSE
                                PRINT "No joystick found. Connect one and restart!", 0, 0
                                self.init()
                        ENDIF
                        SHOWSCREEN
                WEND
        ENDFUNCTION
ENDTYPE

TYPE _button
        value
        name$
        press
        last_value
ENDTYPE

TYPE _stick
        id
        trm = 0.055
        control[] AS _button
        button[] AS _button

        FUNCTION trim:
                LOCAL val
                FOR i = 0 TO 5
                        val = self.control[i].value
                        IF (val < 0 AND val > -self.trm) OR (val > 0 AND val < self.trm)
                                val = 0.0
                        ENDIF
                        IF val = 0.0
                                self.control[i].value = 0.0
                                self.control[i].press = 0
                        ELSE
                                INC self.control[i].press
                        ENDIF
                        self.control[i].value = val
                NEXT
        ENDFUNCTION

        FUNCTION update:
                self.control[joy.jx].value = GETJOYX(self.id)
                self.control[joy.jy].value = GETJOYY(self.id)
                self.control[joy.jz].value = GETJOYZ(self.id)
                self.control[joy.rx].value = GETJOYRX(self.id)
                self.control[joy.ry].value = GETJOYRY(self.id)
                self.control[joy.rz].value = GETJOYRZ(self.id)
                self.control[joy.dx].value = GETDIGIX(self.id)
                self.control[joy.dy].value = GETDIGIY(self.id)
                FOR i = 0 TO 31
                        self.button[i].value = GETJOYBUTTON(self.id, i)
                        IF self.button[i].value <> 0
                                INC self.button[i].press
                        ELSE
                                self.button[i].press = 0
                        ENDIF
                NEXT
                trim()
        ENDFUNCTION

        FUNCTION view:
                LOCAL x = 0, h = screen.font.height, y = 0, c
                FOR i = 0 TO 7
                        IF self.control[i].value <> 0
                                c = 0x00ff00
                        ELSE
                                c = 0x000022
                        ENDIF
                        x = screen.width * 0.05
                        DRAWRECT x - h, (i * h), h - 1, h - 1, c
                        PRINT self.control[i].name$ + ":", x, i * h
                        x = screen.width * 0.3
                        PRINT FORMAT$(3, 3, self.control[i].value), x, i * h
                        x = screen.width * 0.435
                        PRINT self.control[i].press, x, i * h
                NEXT
                FOR i = 0 TO 15 //31
                        IF self.button[i].value <> 0
                                c = 0x00ff00
                        ELSE
                                c = 0x000022
                        ENDIF
                        x = screen.width * 0.55
                        DRAWRECT x - h, (i * h), h - 1, h - 1, c
                        PRINT self.button[i].name$ + ":", x, i * h
                        x = screen.width * 0.8
                        PRINT self.button[i].value,               x, i * h
                        x = screen.width * 0.88
                        PRINT self.button[i].press,       x, i * h
                NEXT
                plot()
        ENDFUNCTION

        FUNCTION plot:
                LOCAL jx = self.control[joy.jx].value
                LOCAL jy = self.control[joy.jy].value
                LOCAL jz = self.control[joy.jz].value
                LOCAL rx = self.control[joy.rx].value
                LOCAL ry = self.control[joy.ry].value
                LOCAL rz = self.control[joy.rz].value
                LOCAL s = (10 * jz) + 20, t = (s / 2)
                DRAWRECT (jx * screen.width2) + screen.width2 - t, (jy * screen.height2) + screen.height2 - t, s, s, 0x00ffff
                DRAWRECT (rx * screen.width2) + screen.width2 - t, (ry * screen.height2) + screen.height2 - t, s, s, 0xffff00
        ENDFUNCTION
ENDTYPE

GLOBAL screen AS _screen
GLOBAL joy AS _joy
screen.init()
joy.init()
joy.show()
 

12
GLBasic - en / Texture Brightness
« on: 2014-Jul-31 »
It's a simple query but I am really wondering if there is a way to set the texture brightness for a 3d object, preferable without lighting objects in the scene. Much like ALPHAMODE but without the opaqueness. I'm not sure if ALPHATESTING can do it or X_SETCELSHADES then with lights if I have to.  :-[

13
Off Topic / The Game That Time Forgot
« on: 2014-Jun-22 »
I think we all are still trying to design our great teenage minded game.  :whistle:

<a href="http://www.youtube.com/watch?v=2b0tSu0QDQ0" target="_blank">http://www.youtube.com/watch?v=2b0tSu0QDQ0</a>

Before discovering Blitz Basic, I remember going in to the software store to get a game only to find an interesting application called Klik & Play.  :P

14
I test on Cubietruck and Radxa Rock Android with a desktop keyboard. The KEY() command only works for some keys. I'd like to use WASD but not all work but the arrow keys do.   :blink:

Is this a bug or is there another method?

15
I'm wondering what are the data type replacements for these parameters, which are used in Arduino C;
IMPORT uint32_t get_color(byte r, byte g, byte b)
How do you import this function:?  :bed:
Code: GLBasic [Select]
uint32_t Color(byte r, byte g, byte b) {
        uint32_t c;
        c = r;
        c <<= 8;
        c |= g;
        c <<= 8;
        c |= b;
        return c;
}
 

Pages: [1] 2 3 4