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

Messages - nicoatek

#2
Voici une petite librairie qui permet d'avoir des Application qui tourneront sous n'importe quelle résolution d'écran:
- UNISCREEN_CREATE: Créé une résolution de largeur w et hauteur h (Screen 0 et Sprite 0 sont utilisés).
- UNISCREEN_SETSIZE: Utilise une nouvelle dimension virtuelle de largeur w et hauteur h.
- UNISCREEN_SHOW: Affiche l'écran virtuelle.
- UNISCREEN_GETMOUSE: Remplie les valeurs mx#, my#, lmb#, rmb# (MouseX, MouseY, LeftMouseButton, RightMouseButton) passées par référence. Les valeurs mx# et my# sont basées sur la résolution virtuelle.

A noter que Screen 0 est Sprite 0 sont utilisés et ne peuvent pas être modifiés ou supprimés.

Exemple:
Code (glbasic) Select

UNISCREEN_CREATE(400, 300) // Créé un écran de 400, 300 en s'adaptant à la taille et l'orientation du support utilisé (créé aussi un ecran virtuel de 400 sur 300).
UNISCREEN_SETSIZE(800, 600) // Redimensionne l'écran virtuelle à 800 sur 600
USESCREEN 0
// Draw blablabla...
UNISCREEN_SHOW()


Code (glbasic) Select

// --------------------------------- //
// Project: UniScreen.gbas
// Start: Tuesday, May 15, 2012
// IDE Version: 10.283


// SETCURRENTDIR("Media") // go to media files

GLOBAL UNISCREEN_RX#, UNISCREEN_RY#
GLOBAL UNISCREEN_OUTW#, UNISCREEN_OUTH#
GLOBAL UNISCREEN_STRETCH = FALSE

FUNCTION UNISCREEN_SETSIZE: w#, h#
IF w >= h
UNISCREEN_RX = 1
UNISCREEN_RY = h / w
ELSE
UNISCREEN_RX = w / h
UNISCREEN_RY = 1
ENDIF
CREATESCREEN 0, 0, w, h
ENDFUNCTION

FUNCTION UNISCREEN_GETMOUSE: BYREF mx#, BYREF my#, BYREF lmb#, BYREF rmb#
LOCAL x#, y#, w#, h#, spw#, sph#
LOCAL _mx#, _my#, _lmb#, _rmb#
MOUSESTATE _mx, _my, _lmb, _rmb

IF UNISCREEN_STRETCH = FALSE
IF UNISCREEN_RX > UNISCREEN_RY
IF UNISCREEN_OUTW * UNISCREEN_RY > UNISCREEN_OUTH
w = UNISCREEN_OUTW * (UNISCREEN_OUTH / (UNISCREEN_OUTW * UNISCREEN_RY))
h = UNISCREEN_OUTH
ELSE
w = UNISCREEN_OUTW
h = UNISCREEN_OUTW * UNISCREEN_RY
ENDIF
ELSE
IF UNISCREEN_OUTH * UNISCREEN_RX > UNISCREEN_OUTW
w = UNISCREEN_OUTW
h = UNISCREEN_OUTH * (UNISCREEN_OUTW / (UNISCREEN_OUTH * UNISCREEN_RX))
ELSE
w = UNISCREEN_OUTH * UNISCREEN_RX
h = UNISCREEN_OUTH
ENDIF
ENDIF
x = (UNISCREEN_OUTW - w) / 2.0
y = (UNISCREEN_OUTH - h) / 2.0
ELSE
x = 0
y = 0
w = UNISCREEN_OUTW
h = UNISCREEN_OUTH
ENDIF
GETSPRITESIZE 0, spw, sph
mx = INTEGER((_mx - x) * (spw / w))
my = INTEGER((_my - y) * (sph / h))
lmb = _lmb
rmb = _rmb
ENDFUNCTION

FUNCTION UNISCREEN_CREATE: w#, h#, fullscreen#
LOCAL info$ = PLATFORMINFO$("DEVICE")
LOCAL desktopWidth#, desktopHeight#
LOCAL orientation% = 0

GETDESKTOPSIZE desktopWidth, desktopHeight
IF w >= h
UNISCREEN_RX = 1
UNISCREEN_RY = h / w

IF info$ <> "DESKTOP"
IF desktopWidth < desktopHeight
orientation = 1
UNISCREEN_OUTW = desktopHeight
UNISCREEN_OUTH = desktopWidth
ELSE
UNISCREEN_OUTW = desktopWidth
UNISCREEN_OUTH = desktopHeight
ENDIF
ELSE
UNISCREEN_OUTW = w
UNISCREEN_OUTH = h
ENDIF
ELSE
UNISCREEN_RX = w / h
UNISCREEN_RY = 1

IF info$ <> "DESKTOP"
IF desktopWidth > desktopHeight
orientation = 3
UNISCREEN_OUTW = desktopHeight
UNISCREEN_OUTH = desktopWidth
ELSE
UNISCREEN_OUTW = desktopWidth
UNISCREEN_OUTH = desktopHeight
ENDIF
ELSE
UNISCREEN_OUTW = w
UNISCREEN_OUTH = h
ENDIF
ENDIF
SETSCREEN UNISCREEN_OUTW, UNISCREEN_OUTH, fullscreen
SETORIENTATION orientation
CREATESCREEN 0, 0, w, h
ENDFUNCTION

FUNCTION UNISCREEN_COMPUTEVIEW: BYREF x, BYREF y, BYREF w, BYREF h
IF UNISCREEN_RX > UNISCREEN_RY
IF UNISCREEN_OUTW * UNISCREEN_RY > UNISCREEN_OUTH
w = UNISCREEN_OUTW * (UNISCREEN_OUTH / (UNISCREEN_OUTW * UNISCREEN_RY))
h = UNISCREEN_OUTH
ELSE
w = UNISCREEN_OUTW
h = UNISCREEN_OUTW * UNISCREEN_RY
ENDIF
ELSE
IF UNISCREEN_OUTH * UNISCREEN_RX > UNISCREEN_OUTW
w = UNISCREEN_OUTW
h = UNISCREEN_OUTH * (UNISCREEN_OUTW / (UNISCREEN_OUTH * UNISCREEN_RX))
ELSE
w = UNISCREEN_OUTH * UNISCREEN_RX
h = UNISCREEN_OUTH
ENDIF
ENDIF
x = (UNISCREEN_OUTW - w) / 2.0
y = (UNISCREEN_OUTH - h) / 2.0
ENDFUNCTION

FUNCTION UNISCREEN_SHOW:
LOCAL x#, y#, w#, h#

USESCREEN -1
IF UNISCREEN_STRETCH = FALSE
UNISCREEN_COMPUTEVIEW(x, y, w, h)
STRETCHSPRITE 0, x, y, w, h
ELSE
STRETCHSPRITE 0, 0, 0, UNISCREEN_OUTW, UNISCREEN_OUTH
ENDIF
SHOWSCREEN
// VIEWPORT x, y, -1, -1
ENDFUNCTION
#3
Ca y est, on peut enfin créer un projet communautaire en GLB!!!
Des Idées?
#4
Les  Français sont dans la place!

Salut à tous et merci Kitty (Thanks Kitty)
#5
Hi!
There are few problems for 3D in android with the last beta.

Without a call to X_AUTONORMALS, Android and windows won't produce the same effect.
It Seems the depth buffer is wrong in Android.
#6
Anyway, I've wrote a couple of functions that minimize the delay.

Code (glbasic) Select

GLOBAL waveLoops[] AS WAVELOOP

TYPE WAVELOOP
waveid
state
length
chn
mil
ENDTYPE

FUNCTION wlAdd: id, l
LOCAL wl AS WAVELOOP
wl.waveid = id
wl.length = l
wl.state = 0
wl.chn = 0
wl.mil = 0
DIMPUSH waveLoops[], wl
RETURN LEN(waveLoops) - 1
ENDFUNCTION

FUNCTION wlPlay: id
waveLoops[id].state = 1
waveLoops[id].chn = PLAYSOUND(waveLoops[id].waveid, 0, 1)
waveLoops[id].mil = GETTIMERALL() + waveLoops[id].length
ENDFUNCTION

FUNCTION wlUpdate:
LOCAL mil
FOREACH wl IN waveLoops[]
IF wl.state = 1
mil = GETTIMERALL()
IF mil >= wl.mil
wl.chn = PLAYSOUND(wl.waveid, 0, 1)
wl.mil = GETTIMERALL() + wl.length
ENDIF
ENDIF
NEXT
ENDFUNCTION


- wlAdd function for adding a previously loaded wave file to the list (you need to specify the length in milliseconds)
- wlPlay to start the loop
- wlUpdate must be called continuously in the main program loop

Needs to add wlPause, wlStop, wlIsPlaying, and some volume and panning functions.

Thanks for replies!
#7
I use the export from Fruity Loops Producer (my music tool).
But the mp3 result is surely in VBR (Variable Bit Rate) which seems to be wrong with GLBasic.

I think it will work with Audacity and its MP3 exporter, but the short latency produce a kind of noise each time my loop restart as for WAV files.

If no solutions, i should have to write an entire song for the Widows version (which i am not good at).
#8
My MP3 problem should be due to the exporter from my sequencer.
But this short latency...
Hope it will be solved in a next update, or maybe there is a trick for this.
#9
Hi, there!

In my current project, I' ve got a short background music that should loop seamlessly.
This works great on my Android platform, but not on my windows XP.

With WAV files, the music loops with a little noise.
With MP3 files, start of the music seems to be cropped and so, don' loops properly.

Is somebody got this problem too?
And is this a bug?

Thanks for any solution.
#10
I've seen this on the processing forum (which is based on java), it should help:

QuoteSounds was one of the biggest problems when developing this game. First i was using ApWidgets with multiple MediaPlayers. But later in process i find out that this was very laggy on some devices. After days of searching and studying i found way to use SoundPool and get contents from /data folder ( /assets after export ). AssetManager was the solution.

Music files was too big for the SoundPool, so i had to use MediaPlayer instead.

original post from the processing forum: https://forum.processing.org/android-processing/13
#11
QuoteA JXD? Russian console?
http://www.jxd.hk/download.asp?selectclassid=020001

I am having the same problem on each device.
Hopefully, sound latency is not so disturbing, as for the action game I am working on.

Hope this could be fixed in v11, thanks.
#12
Thanks for answers,

I have got a JXD S601 (Android tablet/console), and a LG Optimus Black as phone.
Both are running Android 2.2.x.
#13
Hi, all!

Not sure it s a bug or may be due to my phones, but I have noticed that in my android systems, sounds are not playing at the good time.
Nothing dramatically, but...