1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| SUB G_WindowPlus (X AS LONG, Y AS LONG, Rotation AS SINGLE, Tr AS LONG, Text$, R AS LONG, G AS LONG, B AS LONG)
DIM px(3) AS SINGLE: DIM py(3) AS SINGLE: DIM LongText(25) AS INTEGER: DIM Z AS INTEGER
DIM ScaleX AS SINGLE, ScaleY AS SINGLE
DIM Texte$, ZI AS INTEGER, TexteW$(25), LigneW AS _BYTE, LongueurMax AS _BYTE
DIM DeltaY AS LONG, DeltaY1 AS LONG
DeltaY = _FONTHEIGHT(_FONT) + 4
_SETALPHA Tr, , Image
_CLEARCOLOR 0, Image
LigneW = 1
'Dfinition de la longueur du texte de la fentre
FOR Z = 1 TO LEN(Text$)
Texte$ = MID$(Text$, Z, 1)
IF Texte$ <> CHR$(13) THEN
LongText(LigneW) = LongText(LigneW) + 1
TexteW$(LigneW) = TexteW$(LigneW) + Texte$
'Dfinition de la longueur maximale de chaine
IF LigneW > 1 THEN
IF LongueurMax < LongText(LigneW) THEN LongueurMax = LongText(LigneW)
ELSEIF LigneW = 1 THEN
LongueurMax = LongText(LigneW)
END IF
ELSE
LigneW = LigneW + 1
END IF
NEXT
'Mise
l'chelle
ScaleY = 1 + LigneW / 4
ScaleX = LongueurMax / 10
DeltaY1 = LigneW * 10
W& = _WIDTH(G_Parchemin): H& = _HEIGHT(G_Parchemin)
px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
sinr! = SIN(-Rotation / 57.2957795131): cosr! = COS(-Rotation / 57.2957795131)
FOR i& = 0 TO 3
x2& = (px(i&) * cosr! + sinr! * py(i&)) * ScaleX + X + LongueurMax * 5: y2& = (py(i&) * cosr! - px(i&) * sinr!) * ScaleY + Y
px(i&) = x2&: py(i&) = y2&
NEXT
_MAPTRIANGLE _SEAMLESS(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), G_Parchemin TO(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
_MAPTRIANGLE _SEAMLESS(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), G_Parchemin TO(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
'Ecriture du texte
IF LigneW > 1 THEN
FOR Z = 1 TO LigneW
COLOR _RGBA(0, 0, 0, 255)
_PRINTSTRING (X, (Y - 17) + Z * DeltaY - DeltaY1), TexteW$(Z)
COLOR _RGBA(R, G, B, 255)
_PRINTSTRING (X, (Y - 17) - 2 + Z * DeltaY - DeltaY1), TexteW$(Z)
NEXT
ELSE
COLOR _RGBA(0, 0, 0, 255)
_PRINTSTRING (X, (Y - DeltaY1)), TexteW$(LigneW)
COLOR _RGBA(R, G, B, 255)
_PRINTSTRING (X, (Y - DeltaY1) - 2), TexteW$(LigneW)
END IF
END SUB
'On déclare notre procédure de cette manière
T_Parchemin$ = "Y a plein de fentre !!" + CHR$(13) + "C'est dingue !!!" + CHR$(13) + "On y voit plus rien !!"
G_WindowPlus 100, 100, 0, 255, T_Parchemin$, 255, 0, 0 |
Partager