Willicious
Members-
Content Count
92 -
Joined
-
Last visited
Community Reputation
1 NeutralTechnical Information
-
Delphi-Version
Delphi 10.4 Sydney
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Change "FadeOut" code to "FadeIn" code
Willicious replied to Willicious's topic in Delphi IDE and APIs
@Anders - Brilliant! This last one worked a treat. I copied in the ShowScreen procedure as an override and it works great for all screens except the play screen (in this case, it fades from white instead of black). However, I also noticed that the latest version of the FadeOut procedure (the one from the PR) also fades to white on the play screen. So, I'm guessing that this is because FadeIn and FadeOut use MasterAlpha, and somewhere in the Lemmix codebase the background of the play screen is set to white, but I could be wrong. I'll look into this more tomorrow. Thanks again, it's taken a long time to get anywhere with this! -
Change "FadeOut" code to "FadeIn" code
Willicious replied to Willicious's topic in Delphi IDE and APIs
OK, I think the reason why none of the attempts at a FadeIn procedure are working is because the UI isn't actually responding to the updates. This could either be because the App is idle at the point the FadeIn is being called, or because it's only processing the first message from the FadeIn procedure, and then none of the others. At one point, I tried displaying an animated "Fade" graphic (basically a large black square which gradually faded to transparent over 8 frames) over the existing screen image - I could only ever get it to display one frame of this animation. The app is definitely capable of processing messages and animations in the menu screens, though, because other animated images (a text scroller) are shown, clickable regions have graphical effects applied to them, and the FadeOut procedure works. Here's where FadeOut is called, maybe there's a clue in here somewhere: procedure TGameBaseScreen.CloseScreen(aNextScreen: TGameScreenType); begin Self.OnKeyDown := nil; Self.OnKeyPress := nil; Self.OnClick := nil; Self.OnMouseDown := nil; Self.OnMouseMove := nil; ScreenImg.OnMouseDown := nil; ScreenImg.OnMouseMove := nil; Application.OnIdle := nil; fScreenIsClosing := True; if fCloseDelay > 0 then begin Update; Sleep(fCloseDelay); end; FadeOut; if GameParams <> nil then begin GameParams.NextScreen := aNextScreen; GameParams.MainForm.Cursor := crNone; end; Close; PostMessage(MainFormHandle, LM_NEXT, 0, 0); end; And, here's where FadeIn is currently being called: constructor TGameBaseMenuScreen.Create(aOwner: TComponent); begin inherited; fKeyStates := TDictionary<Word, UInt64>.Create; fClickableRegions := TObjectList<TClickableRegion>.Create; fMenuFont := TMenuFont.Create; fMenuFont.Load; fBasicCursor := TNLCursor.Create(Min(Screen.Width div 320, Screen.Height div 200) + EXTRA_ZOOM_LEVELS); LoadBasicCursor('amiga.png'); SetBasicCursor; InitializeImage; OnKeyDown := Form_KeyDown; OnKeyUp := Form_KeyUp; OnMouseDown := Form_MouseDown; OnMouseMove := Form_MouseMove; ScreenImg.OnMouseDown := Img_MouseDown; ScreenImg.OnMouseMove := Img_MouseMove; fCalledFromClassicModeButton := False; FadeIn; end; -
Change "FadeOut" code to "FadeIn" code
Willicious replied to Willicious's topic in Delphi IDE and APIs
Thanks again. Made the change, still just getting a black screen. I'll have more time to look over it tomorrow properly, it may be because of where I'm calling the procedure from or something like that. -
Change "FadeOut" code to "FadeIn" code
Willicious replied to Willicious's topic in Delphi IDE and APIs
Thanks for the code snippet Anders, I've given it a quick try and just get a black screen. I'll investigate further later this evening or tomorrow, what you've written looks like it should work. I'll do some debugging and see if I can figure out what's going wrong. -
Change "FadeOut" code to "FadeIn" code
Willicious replied to Willicious's topic in Delphi IDE and APIs
Tried this again today. This yields the same result as always (black screen for 1000ms, then the screenimg.bitmap is drawn at full opacity). I've tried placing "Inc(i)" at various points in the loop, and have also tried using "repeat ... until i = 255" to no avail: procedure TGameBaseScreen.FadeIn; var i: Integer; RemainingTime: Integer; OldRemainingTime: Integer; EndTickCount: Cardinal; const MAX_TIME = 1000; // mS begin EndTickCount := GetTickCount + MAX_TIME; OldRemainingTime := 0; RemainingTime := MAX_TIME; ScreenImg.Bitmap.DrawMode := dmBlend; // So MasterAlpha is used to draw the bitmap while (RemainingTime >= 0) do begin if (RemainingTime <> OldRemainingTime) then begin for i := 0 to 255 do begin ScreenImg.Bitmap.MasterAlpha := i; ScreenImg.Update; end; OldRemainingTime := RemainingTime; end else Sleep(1); RemainingTime := EndTickCount - GetTickCount; Inc(i); end; Application.ProcessMessages; end; For reference, here's the FadeOut procedure as written by Anders, which works perfectly: procedure TGameBaseScreen.FadeOut; var RemainingTime: integer; OldRemainingTime: integer; EndTickCount: Cardinal; const MAX_TIME = 300; // mS begin EndTickCount := GetTickCount + MAX_TIME; OldRemainingTime := 0; RemainingTime := MAX_TIME; ScreenImg.Bitmap.DrawMode := dmBlend; // So MasterAlpha is used to draw the bitmap while (RemainingTime >= 0) do begin if (RemainingTime <> OldRemainingTime) then begin ScreenImg.Bitmap.MasterAlpha := MulDiv(255, RemainingTime, MAX_TIME); ScreenImg.Update; OldRemainingTime := RemainingTime; end else Sleep(1); RemainingTime := EndTickCount - GetTickCount; end; Application.ProcessMessages; end; Any suggestions or comments would be most welcome! -
How to obtain new 1-year licence for RAD Studio 10.4.2 CE
Willicious replied to Willicious's topic in Delphi IDE and APIs
I'm a hobbyist and can't justify paying for a Professional version given my limited use of the platform. Also, as stated in the OP, my project only works in 10.4.2 so even if someone were to gift me the latest Pro version, it would be useless to me. Does anyone know of a way to get a new serial for 10.4.2 CE? Anyone had any luck with contacting Embarcadero for help? -
How to obtain new 1-year licence for RAD Studio 10.4.2 CE
Willicious posted a topic in Delphi IDE and APIs
It's in the title. My current CE licence expires tomorrow, and all efforts I've made so far to obtain a new licence have failed. Does anyone know how I can obtain another 1-year licence for this particular edition of RAD (Sydney 10.4.2)? 10.4.2 is the only version that will successfully compile the project I'm working on, and I need to be able to seamlessly continue with it if at all possible. Both 11 and 12 run into problems when getting the project set up, so simply installing the latest version unfortunately isn't the solution. Please help! -
How to declare an entire set of numbers as a condition
Willicious replied to Willicious's topic in Delphi IDE and APIs
Apologies, I didn't explain that properly. I'm not looking for a single point to be true, but rather a number of points along a straight line. So (X = 0), (Y = 0 and 1 and 2 and 3, etc...) would draw the line required. But, the entire line needs to be drawn for the condition to be met. Yes, to be honest I do now remember asking this same question a while back. Here it is. I didn't fully understand the answer given in that topic, but now that I look at it again I can see what's being suggested. It seems that a boolean needs to be set, then each number is iterated over until one returns false (which breaks the loop). If all numbers return true, then we can run the code. That could work, and using "case ... of" could also work, again to set the bool value. Thanks everyone, I'm sure I'll figure it out. -
How to declare an entire set of numbers as a condition
Willicious posted a topic in Delphi IDE and APIs
I need to use a full set of numbers as a condition. So, for example, rather than: var i: Integer; for i := 0 to 5 do begin if PosY = Y - i then //whatever end; I need it to be: var i: {not sure what to declare i as}; i := [0..5]; if PoxY := Y - i then begin //whatever end; The code needs to execute iff all conditions are met (Y - 0 and Y - 1 and Y - 2 and Y - 3, etc) and not just if any of the possible 6 conditions are met (Y - 0 or Y - 1 or Y - 2 or Y - 3, etc). I've tried declaring i as "array of Integer;" but get the error "Incompatible types: dynamic array and set". I can't declare it as a set either, so, what do I need to declare i as in order to be able to specify all values between 0 and 5 as the condition? -
Yes, this is what I'm after. Thanks! 🙂👍
-
Apologies, I appreciate the suggestion and the time you've taken to respond, but this isn't quite what I'm looking for. I need a program that will basically "read" the entire codebase - ideally at source or within the IDE itself - and point out any areas which could be removed, simplified, or optimized to reduce performance bottlenecks. Maybe I'm dreaming and such a thing doesn't exist yet...? I just know that AQTime used to be bundled with RAD Studio but isn't any longer (and, from what I've seen, this does exactly what I'm describing, but is currently mad expensive for someone who only does small open-source projects). Also - I'm looking for somthing that will do the above, and which works straightaway with an absolute minimum of setup. If that doesn't exist, then that's fine. Maybe it will someday 😊
-
I take it VTune is the Profiler... what is the MAP2PDB for? Complete beginner here, I've been advised to Profile my project's codebase to look for permance issues. Not sure where to start. Also, isn't VTune an expensive Intel app? Ideally looking for free, or inexpensive alternatives. VTune installer says it can integrate with MS Visual Studio, but not RAD Studio - is this even a Delphi app?
-
[Delphi] Looking for a Delphi Profiler in 2023
Willicious replied to Willicious's topic in Delphi IDE and APIs
Thanks! I've replied in-topic in case anyone's watching the topic and has any suggestions. -
Replying again because I forgot to check "notify me of replies", and the site doesn't provide a way to do this after replying
-
Hi, looking for a profiler in 2023. I'm a small-project user and so don't really want to pay. I use RAD Studio 10.4.2, any suggestions?