branch | webgl |
changeset 9986 | 72f2bc996934 |
parent 9127 | e350500c4edb |
9984:84835d0ceb64 | 9986:72f2bc996934 |
---|---|
300 |
300 |
301 function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; |
301 function RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture; |
302 var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; |
302 var textWidth, textHeight, x, y, w, h, i, j, pos, prevpos, line, numLines, edgeWidth, edgeHeight, cornerWidth, cornerHeight: LongInt; |
303 finalSurface, tmpsurf, rotatedEdge: PSDL_Surface; |
303 finalSurface, tmpsurf, rotatedEdge: PSDL_Surface; |
304 rect: TSDL_Rect; |
304 rect: TSDL_Rect; |
305 //chars: set of char = [#9,' ',';',':','?','!',',']; |
305 {$IFNDEF PAS2C} |
306 chars: set of char = [#9,' ',';',':','?','!',',']; |
|
307 {$ENDIF} |
|
306 substr: shortstring; |
308 substr: shortstring; |
307 edge, corner, tail: TSPrite; |
309 edge, corner, tail: TSPrite; |
308 begin |
310 begin |
309 case SpeechType of |
311 case SpeechType of |
310 1: begin; |
312 1: begin; |
344 j:= 0; |
346 j:= 0; |
345 if (length(s) > 20) then |
347 if (length(s) > 20) then |
346 begin |
348 begin |
347 w:= 0; |
349 w:= 0; |
348 i:= round(Sqrt(length(s)) * 2); |
350 i:= round(Sqrt(length(s)) * 2); |
349 // s:= WrapText(s, #1, chars, i); |
351 {$IFNDEF PAS2C} |
352 s:= WrapText(s, #1, chars, i); |
|
353 {$ENDIF} |
|
350 pos:= 1; prevpos:= 0; line:= 0; |
354 pos:= 1; prevpos:= 0; line:= 0; |
351 // Find the longest line for the purposes of centring the text. Font dependant. |
355 // Find the longest line for the purposes of centring the text. Font dependant. |
352 while pos <= length(s) do |
356 while pos <= length(s) do |
353 begin |
357 begin |
354 if (s[pos] = #1) or (pos = length(s)) then |
358 if (s[pos] = #1) or (pos = length(s)) then |