So I guess you calculate the render area in application and then pass parameters down to the platform-function. Can you post some code-snippets showing how you've tried to solve it? The screen shot looks nice!
Yes it would be cool if the zge-runtime only included the components needed for the current game in ZDesigner. That would make it easier to have more components and not bother about every components kb-size. I have an idea how that can be achieved but I haven't had the time to see if it is realistic yet. That topic needs a separate investigation-thread in the future.
The calculations where actually done in Renderer.pas, but I probably need to move them to ZApplication.pas in order to get everything to frmEditor.pas as well ( this is where I'm having most difficulties ). Anyway, here's the Init snippet.
procedure InitRenderer(Width,Height : integer; Ratio : single);
var
ViewportX : integer;
ViewportY : integer;
ViewportWidth : integer;
ViewportHeight : integer;
begin
if(Width/Height > Ratio)then
begin
ViewportWidth := Trunc(Height*Ratio);
ViewportHeight := Height;
ViewportX := Trunc((Width-Height*Ratio)/2);
ViewportY := 0;
end
else
begin
ViewportWidth := Width;
ViewportHeight := Trunc(Width/Ratio);
ViewportX := 0;
ViewportY := Trunc((Height-Width/Ratio)/2);
end;
glViewport(ViewportX, ViewportY, ViewportWidth, ViewportHeight);
end;
As far as modular development concerned, I only get as far as thinking you'd need a component register, and a "mother" component object you can extend individual component classes from ( moved from their catagory.pas to individual files ). Then you'd either need to parse through a project to see what methods are used, or let the user consciously enable / disable individual components before making them available for use in the Editor.
But perhaps ViewportRatio or CameraRatio would be better then just Ratio. And I could insert a if Ratio == 0 then just use the full window / screen resolution.
Kjell wrote:But perhaps ViewportRatio or CameraRatio would be better then just Ratio. And I could insert a if Ratio == 0 then just use the full window / screen resolution.K
"ViewportRatio" sounds good. Or is there another term for this? I want to be sure we use the correct terminology and minimize the risk of confusion with other "ratios".
And a zero value (which should be default for backwards compatibility) for the old behavior is good too!
hay that looks sweet! this will allow for some interesting arty type creations.., panorama looks great for the cinematic panovision effect that will work quite well on all these new fangle widescreen displays,. thanks for this!
The main reason for implementing this is that no matter what ScreenRatio you'll run a application in, that the active rendering region ( Viewport ) can always be the same ratio. Right now ( 1.9.0 ) the extremes lie at 4/3 and 1.6, which means that the person running in a ScreenRatio of 1.6 can see a significantly wider portion of your game compared to 4/3 .. and with that maybe even stuff that you never meant to have visible to begin with.
This will probably make it a little easier to understand what these properties do. And thanks for offering to make these changes. Now I can continue on implementing Joystick support indeed
Updated this again now so that only the active viewport region is cleared with the clearcolor, using glScissor-function. This gives the letterbox effect with black area above and below the view region when using HD ratio on a non-HD display.
You are right it could be useful to select the border color as well. I just found it hard to see that the viewport actually changed when the border was the same color. Perhaps a separate BorderColor property then, we'll see.