changeset 8057 | 93e16240f178 |
parent 8039 | a3b86c1f63b4 |
parent 8028 | dc30104660d3 |
child 8096 | 453917e94e55 |
child 8138 | cfb228baa598 |
8051:f26422ef0333 | 8057:93e16240f178 |
---|---|
54 |
54 |
55 procedure WarpMouse(x, y: Word); inline; |
55 procedure WarpMouse(x, y: Word); inline; |
56 procedure SwapBuffers; {$IFDEF USE_VIDEO_RECORDING}cdecl{$ELSE}inline{$ENDIF}; |
56 procedure SwapBuffers; {$IFDEF USE_VIDEO_RECORDING}cdecl{$ELSE}inline{$ENDIF}; |
57 |
57 |
58 implementation |
58 implementation |
59 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands, |
59 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands |
60 uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF} |
60 , uPhysFSLayer |
61 {$IF NOT DEFINED(SDL13) AND DEFINED(USE_VIDEO_RECORDING)}, glut {$ENDIF}; |
61 , uDebug |
62 {$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF} |
|
63 {$IF NOT DEFINED(SDL13) AND DEFINED(USE_VIDEO_RECORDING)}, glut {$ENDIF}; |
|
62 |
64 |
63 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); |
65 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); |
64 |
66 |
65 var MaxTextureSize: LongInt; |
67 var MaxTextureSize: LongInt; |
66 {$IFDEF SDL13} |
68 {$IFDEF SDL13} |
307 |
309 |
308 if not reload then |
310 if not reload then |
309 for fi:= Low(THWFont) to High(THWFont) do |
311 for fi:= Low(THWFont) to High(THWFont) do |
310 with Fontz[fi] do |
312 with Fontz[fi] do |
311 begin |
313 begin |
312 s:= UserPathz[ptFonts] + '/' + Name; |
314 s:= cPathz[ptFonts] + '/' + Name; |
313 if not FileExists(s) then |
|
314 s:= Pathz[ptFonts] + '/' + Name; |
|
315 WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... '); |
315 WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... '); |
316 Handle:= TTF_OpenFont(Str2PChar(s), Height); |
316 Handle:= TTF_OpenFontRW(rwopsOpenRead(s), true, Height); |
317 SDLTry(Handle <> nil, true); |
317 SDLTry(Handle <> nil, true); |
318 TTF_SetFontStyle(Handle, style); |
318 TTF_SetFontStyle(Handle, style); |
319 WriteLnToConsole(msgOK) |
319 WriteLnToConsole(msgOK) |
320 end; |
320 end; |
321 |
321 |
563 begin |
563 begin |
564 LoadImage:= nil; |
564 LoadImage:= nil; |
565 WriteToConsole(msgLoading + filename + '.png [flags: ' + inttostr(imageFlags) + '] '); |
565 WriteToConsole(msgLoading + filename + '.png [flags: ' + inttostr(imageFlags) + '] '); |
566 |
566 |
567 s:= filename + '.png'; |
567 s:= filename + '.png'; |
568 tmpsurf:= IMG_Load(Str2PChar(s)); |
568 tmpsurf:= IMG_Load_RW(rwopsOpenRead(s), true); |
569 |
569 |
570 if tmpsurf = nil then |
570 if tmpsurf = nil then |
571 begin |
571 begin |
572 OutError(msgFailed, (imageFlags and ifCritical) <> 0); |
572 OutError(msgFailed, (imageFlags and ifCritical) <> 0); |
573 exit; |
573 exit; |
595 |
595 |
596 function LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
596 function LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
597 var tmpsurf: PSDL_Surface; |
597 var tmpsurf: PSDL_Surface; |
598 begin |
598 begin |
599 // check for file in user dir (never critical) |
599 // check for file in user dir (never critical) |
600 tmpsurf:= LoadImage(UserPathz[path] + '/' + filename, imageFlags and (not ifCritical)); |
600 tmpsurf:= LoadImage(cPathz[path] + '/' + filename, imageFlags); |
601 |
|
602 // if unsuccessful check data dir |
|
603 if (tmpsurf = nil) then |
|
604 tmpsurf:= LoadImage(Pathz[path] + '/' + filename, imageFlags); |
|
605 |
|
606 LoadDataImage:= tmpsurf; |
|
607 end; |
601 end; |
608 |
602 |
609 |
603 |
610 function LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
604 function LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
611 var tmpsurf: PSDL_Surface; |
605 var tmpsurf: PSDL_Surface; |