GLBasic forum

Main forum => GLBasic - en => Topic started by: aroldo on 2011-Sep-09

Title: WebOS Sample Project
Post by: aroldo on 2011-Sep-09
Does any one have a sample GLBasic project for WebOS, that you can share?
Or some guide lines of what to include in the Options so my GLBasic projects can bet targeted to Pre, Pre 2 and HP Touchpad?


Thanks,
Title: Re: WebOS Sample Project
Post by: Ian Price on 2011-Sep-09
The sample project above works.

To target Pre etc. you need to go into the [Project] tab. Select [Options]. Change Platform Configuration to [WebOS]. Set the required [RESOLUTION] 320x480 or 480x320 for Pre. You can type in other values in the textbox. Then click [OK]

Now use the [Compiler] tab and select [Build Multi-platform]. Select the WebOS icon and click [OK]

This will compile your app and place it in the Destination folder within the main folder. You can either then use a Macro to send your compiled app to your device (make sure it's plugged in before sending) or use QuickInstaller to transfer it. The app can then be run on your device.
Title: Re: WebOS Sample Project
Post by: Crivens on 2011-Sep-09
Or just follow the guidelines in the help pages for compiling to WebOS. It's what I did and it was pretty straightforward (massively compared to Android or iOS)

Cheers
Title: Re: WebOS Sample Project
Post by: aroldo on 2011-Sep-09
Thanks for the reply,

I was looking for some cross reference between Windows and Pre 2.
For instance
Code (glbasic) Select
MOUSESTATE mx, my, b1, b2

The mx and my works on the Pre 2 but can't get the b1 or b2. In the Pre 2 it will be a Tap Event.

Also how I make the character to display bigger?
I compiled the \sample\Media\Playsound for WebOS and loaded in my Pre 2
Code (glbasic) Select
PRINT "Pan[%]:" + mx + " Vol[%]:" + my, 30, 150

Prints to small!


   
Title: Re: WebOS Sample Project
Post by: Ian Price on 2011-Sep-09
MOUSESTATE mx,my,b1,b2 allows proper mouse touch as Windows does. Admittedly b2 (right mouse button) isn't used, but you can still do loads with one button. Plus you can use multi-touch on the Pre, which negates the need for a second button anyway.

The stock PRINT command uses the "smalfont.png" (IIRC) - change the font and your printing will be larger. It is small, but not unreadable on Pre.

You are better off using a bitmap font routine anyway - search the forums, there are several routines. I'll post one later if required.

edit: smalfont.png - one "l", sorry, stupid 8.3 convention from 1998
Title: Re: WebOS Sample Project
Post by: aroldo on 2011-Sep-09
Ian Price,

Thanks, I will search the forums.
Title: Re: WebOS Sample Project
Post by: aroldo on 2011-Sep-09
I made some changes to the Playsound project and downloaded to my Pre 2.
I noticed an issue with the DRAWLINE command, if I draw a line on the left side of the screen (landscape orientation) starting at 0 the line is not visible on the Pre 2 screen, the same happens if I draw a line at the x=0,y=320 and at the right at 480.
If I start draw a line at the left side starting at x=1, it shows on the screen and if I  draw a line at the x=0,y=319 and at the right at 479 it shows that line.

One thing is clear if I have a screen with 480 wide by 320 tall and I start drawing at x=0, y=0 they should end at 479 and 319 respectively.
Why do I have to draw the line on right side of the screen starting at x=1? Is that a bug?

Please refer to the code below

Code (glbasic) Select
// ------------------------------------------------------------- //
// PLAYSOUND Sample
// ------------------------------------------------------------- //

// Laden eines Sounds aus einer Wav-Datei / Load sound from wav-file
LOADSOUND "sensaura.wav", 5, 4 // Num: 0 - 127 max
WHILE TRUE
MOUSESTATE mx, my, b1, b2
IF my>100 THEN my=100
SETMOUSE mx, my
mx=INTEGER((mx-240)*10/24) // -100 <-> +100

DRAWLINE 0, 0, 479, 0, RGB(255,255,255)//top
DRAWLINE 0, 319, 479, 319, RGB(255,255,255)//botton
[b]DRAWLINE 1, 0, 1, 319, RGB(255,255,255)//left  <-- Does not print the line IF YOU CHANGE to DRAWLINE 0, 0, 0,     319, RGB(255,255,255[/b]
DRAWLINE 479, 0, 479, 319, RGB(255,255,255)//right
// PAN
PRINT "x:"+mx+" y:"+my+" b1:"+b1+" b2:"+b2,20,20
PRINT "PAN", 100,80
DRAWLINE 0, 100, 200, 100, RGB(255,255,255)
DRAWLINE mx+100, 90, mx+100, 110, RGB(200,255,255)
// VOL
PRINT "VOL", 100,110
DRAWLINE 0, 130, 200, 130, RGB(255,255,255)
DRAWLINE my*2, 120, my*2, 140, RGB(255,255,200)

IF b1 THEN PLAYSOUND (5, mx/100, my/100)

PRINT "Pan[%]:" + mx + " Vol[%]:" + my, 30, 150
SHOWSCREEN
WEND
HUSH // Ruhe / Silence
Title: Re: WebOS Sample Project
Post by: Kitty Hello on 2011-Sep-14
test if DRAWRECT works properly. If it does, the DRAWLINE is some pixels off (I have that on windows as well and there's a pretty ugly hack to get proper pixel mappings, that was not required on iPhone IIRC).

If DRAWRECT is off, too, there might be some bug due to SETORIENTATION changes.
Title: Re: WebOS Sample Project
Post by: aroldo on 2011-Sep-14
Kitty Hello,

I did the DRAWRECT 0,0,320,480 RGB(255,255,0) it works fine!
I also tried DRAWLINE 0,0,320,480, RGB(255,255,0) no problem.

When I reported the problem I was using the GLBasic FREE trial version, now I have premium.
May be the alignment is an issue with the GLBasic FREE  trial.
Title: Re: WebOS Sample Project
Post by: MrTAToad on 2011-Sep-14
Or fixed in the last update ? :)