Menu

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.

Show posts Menu

Topics - planetm

#1
One (or maybe two) more questions from me, I really appreciate the supportive nature of these forums, thank you for all your help!

How do you deal with your android games losing focus? If I switch to another app during my game, then when returning the game starts back on the main menu. I figure I need to use GLB_ON_PAUSE and GLB_ON_RESUME. Do I have to save all the variables and current game state to an .ini file or similar in GLB_ON_PAUSE then load it all in GLB_ON_RESUME or is there a simpler approach?

One other unrelated question: is there a way to add a hyperlink from my app to open a webpage in the browser?

Thanks,

Matt.
#2
I've been working on a game and it's pretty much ready to go, but I'm still having issues with scaling on tablets. I'm starting with a resolution of 800x480 (that was the resolution of the phone I started development on) and I'm trying to scale it up to run on the Nexus 7 (1280x800).

If I use SETSCREEN 9000,9000,0 and GETSCREENSIZE (as suggested elsewhere by Ampos, thank you) the nexus reports a landscape resolution. I've then tried scaling using createscreen, followed by either stretchsprite or polyvector but neither displays anything (although they work fine on windows). I just tried the code at http://www.glbasic.com/forum/index.php?topic=6998.msg57145#msg57145 and that shows a blue screen, but the small square doesn't display. My own example at http://www.glbasic.com/forum/index.php?topic=7043.msg70852#msg70852 displays a blank screen in the createscreen/stretchsprite section.

It seems that the problems I'm experiencing and similar to those people mention on Asus Transformer tablets, the Nexus is also manufactured by Asus. The Nexus 7 seems very popular now so i really would like to resolve this. Any ideas?
#3
I'm sure this will be easy for somebody to solve. I was trying to use a routine from elsewhere on the forum to scale my game to run on different resolutions using CREATESCREEN and STRETCHSPRITE, but I can't get it to work correctly when testing on windows.

Here's a quick example:

Code (glbasic) Select
// --------------------------------- //
// Project: testzoom
// Start: Friday, July 06, 2012
// IDE Version: 10.283

// SETSCREEN 800,480,0 //original scale - works fine
// SETSCREEN 1024,768,0 // scaling up - works fine
// SETSCREEN 640,480,0 //scaling down - doesn't work
SETSCREEN 320,240,0 //scaling down - doesn't work

ALLOWESCAPE TRUE
GLOBAL xres,yres
GETSCREENSIZE xres,yres

CREATESCREEN 1,100,800,480

USESCREEN 1
CLEARSCREEN RGB(0,0,255)
DRAWRECT 100,100,600,280,RGB(255,0,0)

USESCREEN -1
CLEARSCREEN RGB(0,0,0)
STRETCHSPRITE 100,0,0,xres,yres

SHOWSCREEN

MOUSEWAIT

END


CREATESCREEN uses 800,480 and this should then be scaled to the screensize using STRETCHSPRITE. It's working for for higher resolutions (e.g. 1024,768), but produces strange results at lower resolutions (e.g. 640,480).

Please could somebody point out the (probably) glaringly obvious mistake!

Thank you.
#4
I have tried and failed to run glbasic using wine on the eee pc, with the default xandros linux install. I am using the most recent version of glbasic . The console output is below, it appears that the error revolves around 'CreatWindow invalid window height' or width. I'm guessing that this is since the eee desktop runs at 800x480 and the initial glbasic window where you choose your project is probably bigger than this. Can Gernot or anybody else suggest a solution? It'd be great for coding on the move...


Quoteerr:x11drv:X11DRV_CreateWindow invalid window width 2012132005
err:x11drv:X11DRV_CreateWindow invalid window height 2012742564
err:x11drv:X11DRV_CreateWindow invalid window height -2015403338
err:x11drv:X11DRV_CreateWindow invalid window height -2015403338
err:x11drv:X11DRV_CreateWindow invalid window height -2015403338
fixme:shdocvw:PersistStreamInit_InitNew (0x13bdd8)
err:x11drv:X11DRV_CreateWindow invalid window height -2015403338
fixme:shdocvw:navigate_url Unsupported args (Flags 0x33edd0:3; TargetFrameName 0x33ede0:8)
wine: Unhandled page fault on read access to 0x00000000 at address 0x104aba4 (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0104aba4).
Register dump:
 CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
 EIP:0104aba4 ESP:0033e6c0 EBP:0033e708 EFLAGS:00010206(   - 00      - RIP1)
 EAX:00000000 EBX:001689bc ECX:00110048 EDX:00000000
 ESI:001689b8 EDI:00000000
Stack dump:
0x0033e6c0:  001689bc 00000000 0033e78c 00148cdc
0x0033e6d0:  001689b8 00c29bc8 00c29c98 00000000
0x0033e6e0:  00000003 00110000 00000000 00000000
0x0033e6f0:  00000014 00000001 00000001 00c2565c
0x0033e700:  0033e78c 0104f723 0033e748 0103108a
0x0033e710:  00000000 00148cdc 0033e78c 00000000
Backtrace:
=>1 0x0104aba4 in necko (+0x1aba4) (0x0033e708)
  2 0x0103108a in necko (+0x108a) (0x0033e748)
  3 0x00c08aa0 in xpcom_core (+0x28aa0) (0x0033e790)
  4 0x00be232e in xpcom_core (+0x232e) (0x0033e7d0)
  5 0x010386ec in necko (+0x86ec) (0x0033e804)
  6 0x0103890b in necko (+0x890b) (0x0033e864)
  7 0x7bb4df82 load_gecko+0x202() in mshtml (0x0033eb44)
  8 0x7bb4e5e5 NSContainer_Create+0x25() in mshtml (0x0033eba4)
  9 0x7bb273a0 HTMLDocument_Create+0x220() in mshtml (0x0033ebf4)
  10 0x7bb46c50 in mshtml (+0x36c50) (0x0033ec14)
  11 0x7c8ccff2 CoCreateInstance+0x1c2() in ole32 (0x0033ec74)
  12 0x7bbe2ffc in shdocvw (+0x12ffc) (0x0033ed14)
  13 0x7bbe41c1 navigate_url+0x261() in shdocvw (0x0033ed64)
  14 0x7bbeb299 in shdocvw (+0x1b299) (0x0033eda4)
  15 0x78267106 in mfc80 (+0x97106) (0x0033ee3c)
  16 0x0042b459 in editore (+0x2b459) (0x00695930)
  17 0x00000001 (0x0045666c)
  18 0x00441ae0 in editore (+0x41ae0) (0x0043ef30)
  19 0xccccc300 (0x456254b8)
  20 0x00000000 (0x00000000)
0x0104aba4: movl        0x0(%eax),%ecx
Modules:
Module  Address                 Debug info      Name (115 modules)
PE        3a0000-  3f6000       Deferred        msvcr71
PE        400000-  577000       Export          editore
PE        7a0000-  8a6000       Deferred        mfc71
PE        bd0000-  bd6000       Deferred        xpcom
PE        be0000-  c49000       Export          xpcom_core
PE        c50000-  c77000       Deferred        nspr4
PE        c80000-  c87000       Deferred        plc4
PE        c90000-  c96000       Deferred        plds4
PE        db0000-  dc3000       Deferred        jsj3250
PE        dd0000-  e41000       Deferred        js3250
PE        e50000-  e8f000       Deferred        softokn3
PE        e90000-  ea6000       Deferred        gkgfx
PE        eb0000-  f0b000       Deferred        nss3
PE        f10000-  f16000       Deferred        xpistub
PE        f20000-  f34000       Deferred        xpcom_compat
PE        f40000-  f5a000       Deferred        smime3
PE        f60000-  f66000       Deferred        mozctlx
PE        f70000-  f90000       Deferred        ssl3
PE        f90000-  fc1000       Deferred        freebl3
PE        fd0000-  fe1000       Deferred        mozz
PE        ff0000- 102e000       Deferred        nssckbi
PE       1030000- 10ad000       Export          necko
PE      10000000-1000b000       Deferred        homepath
PE      5d360000-5d36e000       Deferred        mfc80enu
PE      78130000-781cb000       Deferred        msvcr80
PE      781d0000-782df000       Export          mfc80
ELF     7b800000-7b924000       Deferred        kernel32
  \-PE  7b820000-7b924000       \               kernel32
ELF     7b9e5000-7b9fa000       Deferred        midimap
  \-PE  7b9f0000-7b9fa000       \               midimap
ELF     7b9fa000-7ba20000       Deferred        msacm32
  \-PE  7ba00000-7ba20000       \               msacm32
ELF     7ba20000-7ba38000       Deferred        msacm32
  \-PE  7ba30000-7ba38000       \               msacm32
ELF     7ba38000-7ba4c000       Deferred        lz32
  \-PE  7ba40000-7ba4c000       \               lz32
ELF     7ba4c000-7bad9000       Deferred        winmm
  \-PE  7ba60000-7bad9000       \               winmm
ELF     7bad9000-7bb04000       Deferred        ws2_32
  \-PE  7bae0000-7bb04000       \               ws2_32
ELF     7bb04000-7bb8a000       Export          mshtml
  \-PE  7bb10000-7bb8a000       \               mshtml
ELF     7bb8a000-7bbc6000       Deferred        urlmon
  \-PE  7bb90000-7bbc6000       \               urlmon
ELF     7bbc6000-7bc00000       Export          shdocvw
  \-PE  7bbd0000-7bc00000       \               shdocvw
ELF     7bc00000-7bca0000       Deferred        ntdll
  \-PE  7bc10000-7bca0000       \               ntdll
ELF     7bca8000-7bcc1000       Deferred        version
  \-PE  7bcb0000-7bcc1000       \               version
ELF     7bcc1000-7bd60000       Deferred        oleaut32
  \-PE  7bcd0000-7bd60000       \               oleaut32
ELF     7bf00000-7bf03000       Deferred        
ELF     7bf05000-7bf1f000       Deferred        wsock32
  \-PE  7bf10000-7bf1f000       \               wsock32
PE      7c420000-7c4a7000       Deferred        msvcp80
ELF     7c4fd000-7c510000       Deferred        libresolv.so.2
ELF     7c81d000-7c83b000       Deferred        iphlpapi
  \-PE  7c820000-7c83b000       \               iphlpapi
ELF     7c83b000-7c895000       Deferred        rpcrt4
  \-PE  7c850000-7c895000       \               rpcrt4
ELF     7c895000-7c934000       Export          ole32
  \-PE  7c8a0000-7c934000       \               ole32
ELF     7c934000-7c966000       Deferred        uxtheme
  \-PE  7c940000-7c966000       \               uxtheme
ELF     7c986000-7c98b000       Deferred        libxfixes.so.3
ELF     7c98b000-7c994000       Deferred        libxcursor.so.1
ELF     7c994000-7c9b1000       Deferred        imm32
  \-PE  7c9a0000-7c9b1000       \               imm32
ELF     7c9b1000-7c9b7000       Deferred        libxrandr.so.2
ELF     7e404000-7e631000       Deferred        i915_dri.so
ELF     7e631000-7e63a000       Deferred        libdrm.so.2
ELF     7e63a000-7e6a4000       Deferred        libgl.so.1
ELF     7e6a4000-7e6a9000       Deferred        libxdmcp.so.6
ELF     7e6a9000-7e6ac000       Deferred        libxau.so.6
ELF     7e6ac000-7e798000       Deferred        libx11.so.6
ELF     7e798000-7e7a6000       Deferred        libxext.so.6
ELF     7e7a6000-7e7ab000       Deferred        libxxf86vm.so.1
ELF     7e7ab000-7e7c3000       Deferred        libice.so.6
ELF     7e7c3000-7e7cc000       Deferred        libsm.so.6
ELF     7e7cf000-7e7d7000       Deferred        libxrender.so.1
ELF     7e7d9000-7e865000       Deferred        winex11
  \-PE  7e7f0000-7e865000       \               winex11
ELF     7e87a000-7e89a000       Deferred        libexpat.so.1
ELF     7e89a000-7e8c5000       Deferred        libfontconfig.so.1
ELF     7e8c5000-7e8d9000       Deferred        libz.so.1
ELF     7e8d9000-7e943000       Deferred        libfreetype.so.6
ELF     7e943000-7e964000       Deferred        mpr
  \-PE  7e950000-7e964000       \               mpr
ELF     7e964000-7e9af000       Deferred        wininet
  \-PE  7e970000-7e9af000       \               wininet
ELF     7e9af000-7ea6e000       Deferred        comctl32
  \-PE  7e9c0000-7ea6e000       \               comctl32
ELF     7ea6e000-7eb6f000       Deferred        shell32
  \-PE  7ea80000-7eb6f000       \               shell32
ELF     7eb6f000-7ebc7000       Deferred        shlwapi
  \-PE  7eb80000-7ebc7000       \               shlwapi
ELF     7ebc7000-7ed01000       Deferred        user32
  \-PE  7ebe0000-7ed01000       \               user32
ELF     7ed01000-7ed4c000       Deferred        advapi32
  \-PE  7ed10000-7ed4c000       \               advapi32
ELF     7ed4c000-7ede3000       Deferred        gdi32
  \-PE  7ed60000-7ede3000       \               gdi32
ELF     7ede3000-7ee49000       Deferred        msvcrt
  \-PE  7edf0000-7ee49000       \               msvcrt
ELF     7efad000-7efb8000       Deferred        libnss_files.so.2
ELF     7efb8000-7efce000       Deferred        libnsl.so.1
ELF     7efce000-7eff3000       Deferred        libm.so.6
ELF     7eff6000-7f000000       Deferred        libnss_nis.so.2
ELF     b7c95000-b7c9e000       Deferred        libnss_compat.so.2
ELF     b7c9f000-b7ca3000       Deferred        libdl.so.2
ELF     b7ca3000-b7dd5000       Deferred        libc.so.6
ELF     b7dd5000-b7de7000       Deferred        libpthread.so.0
ELF     b7df5000-b7f09000       Deferred        libwine.so.1
ELF     b7f0b000-b7f22000       Deferred        ld-linux.so.2
Threads:
process  tid      prio (all id:s are in hex)
0000000a
        0000000b    0
00000008 (D) C:\Program Files\GLBasic\EditorE.exe
        0000000e    0
        0000000d    0
        00000009    0 <==
#5
Has anybody tried using an Arduino ( http://www.arduino.cc/ ) with glbasic? People have already got them interfaced with quite a few other packages ( http://www.arduino.cc/playground/Main/InterfacingWithSoftware ). I'm waiting for my Arduino to arrive and It occurs that I could have a lot of fun using it to control things in glbasic (a quick and easy example being making my own paddle controller for breakout/arkanoid using a potentiometer, but a few people have got them working with the wii nunchuck which would be interesting too).

I don't think glbasic has the ability to directly communicate with usb/serial ports, but guess it might be possible using inline and some C code, but my knowledge of C is pretty much zero. There is a page about communicating with an Arduino using C at http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/ and the code is at http://todbot.com/arduino/host/arduino-serial/arduino-serial.c

Has anybody tried this already? Would integrating the C code be possible? My Ardunio should arrive later this week, so if somebody can point me in the right direction (I'll need a lot of direction!)  I'll add interfacing with glbasic to my list of ideas!

Thanks,

Matt.
#6
Another 3D question, sorry!

I have my program plotting points on a 3D graph and I can fly around them. When I press L each point is labelled using X_PRINT. Currently I have one X_AMBIENT_LT light source, but the label text appears white when viewed from one side and dark grey when viewed from the other side. Surely if the light source is ambient both sides should be lit equally? The side facing 0,0,0 is lit brightly. Adding X_SPOT_LT sources doesn't seem to help, in fact, if I remove the ambient source, they don't seem to illuminate X_PRINT text at all.

Is this a bug or am I doing something wrong? (You can grab my program executable from http://on.plu.to/The_Nuclear_Valley_0.4b.zip to see for yourself)

Secondly, has the Linux segmentation error bug appeared again, I compiled my code for linux last night and it failed to run on my OpenSuse PC?

Thanks for the continued support Gernot,

Matt.
#7
I've just begun using the 3D functions of GLBasic. I've coded a very basic tool which plots a graph in 3D (for anybody that cares, I'm plotting number of neutrons against number of protons against binding energy per nucleon for about 3000 isotopes, produces the 'nuclear valley' shape - this is not relevant to my question though!). I'm amazed just how easy this has been in GLBasic, but now I want to be able to 'fly' around my graph.

My maths ability is pretty good and I have a reasonable grasp of vectors in 2D, but I can't get my head around how to code the movement stuff in 3D. I've searched around some and found references to cross products and the like but this is unfamiliar to me.

Ideally I'd like to 'fly' around the graph using a first person type control method. Something like arrow keys to go forwards/backwards and side to side, plus a mouselook type function. I'm storing the camera position cx,cy,cz and the direction relative to the camera dx,dy,dz and assume there are pretty standard functions used in 3D programming to process these for the type of movement i'm looking for.

Please could somebody point me in the direction of a good tutorial, or even provide some glbasic code for me to incorporate or build upon.

Thanks,

Matt.
#8
In my current project I'm grabbing a sprite from the backbuffer. Some of the image I have drawn to the backbuffer is RGB(255,0,128) which I assume should be transparent once I grabsprite. However, when I later draw the sprite to the screen it appears with the magenta (255,0,128) areas visible and not transparent.

I'm using a laptop with the desktop set to 32bit colour depth and i'm running the glbasic program full screen. Does transprency work with 'grabsprite' sprites? If so, what might I be doing wrong?

Thanks...
#9
I'm using the most recent update of GLBasic, but still just the demo. I'm running the IDE on win2k via VMware, on my Suse linux 10.2 system. When I complile a program for linux, then run it from the command line , I briefly see a window appear, then disappear and the console just states 'Segmentation fault'. This occurs with helloworld and arkanoid. OpenGL and SDL are both installed.

Any ideas?