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

#1
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
#2
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.
#3
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...