SRL Archive - OSR Advanced Scripting Tutorials

Making a Form Full-Screen (Small Tutorial)


Daniel

2008-08-16 02:07:14

Making a Form Full-Screen
By Dan's The Man


Introduction:
This is a little guide to teach you how to make a SCAR Form Full-Screen. It could be used in your own games (*looks at Solemn Wishes* :p), or anything else you might want ;) So let's start.

Method:
Well, first off, you'll need to make a simple form out of the form editor, or any other way you like doing ;) After doing that, save the form and load it via the Load DFM Form option inside SCAR or Rons DFM Form parser. In the section of your form name (usually "frmDesign"), add:

FormName.BorderStyle := bsNone;
FormName.WindowState := wsMaximized;
While replacing FormName with the variable name of your form ;) That will make it maximized, but without covering the taskbar. To cover your taskbar, You'll need to replace:

FormName.Left := blah;
FormName.Top := blah;
FormName.Width := blah;
FormName.Height := blah;
with

FormName.SetBounds(TR.Left, TR.Top, TR.Right-TR.Left, TR.Bottom-TR.Top);
whilst adding this variable as a local variable:

var
TR: TRect;
Remember to replace FormName with the variable name of your form. Now just continue on with the normal form development, such as adding loading procedures and stuff (TVariantArrays etc). SetBounds is another way of doing:

FormName.Left := blah1;
FormName.Top := blah2;
FormName.Width := blah3;
FormName.Height := blah4;
So, you'll do this with SetBounds instead (much shorter ;)):

FormName.SetBounds(blah1, blah2, blah3, blah4);[scar]
See? Much, MUCH shorter ;)

Ok, that hopefully concludes my tutorial for today. If you require any more help, please reply to this thread ;)

ShowerThoughts

2008-08-16 05:14:07

<3 Dan's The Man

Daniel

2008-08-16 05:20:30

From: Hermpie
<3 Dan's The Man

<3 Hermpie :D

ShowerThoughts

2008-08-16 05:28:55

[QUOTE=Dan's The Man;449627]<3 Hermpie :D[/QUOTE]

EEEEEWWWWW, GAY!

Daniel

2008-08-16 05:30:00

From: Hermpie
EEEEEWWWWW, GAY!

Right :rolleyes: Looks back at your post :p

WhoCares357

2008-08-16 18:46:32

Is there a tutorial on rendering bitmaps on the screen with SCAR? I'm asking because I wanted to try make a game with SCAR but don't know enough to do it.

Daniel

2008-08-16 21:18:09

From: WhoCares357
Is there a tutorial on rendering bitmaps on the screen with SCAR? I'm asking because I wanted to try make a game with SCAR but don't know enough to do it.

If i think you mean something that has a transparent background, then i'm not sure, sorry.

WhoCares357

2008-08-16 22:27:20

[QUOTE=Dan's The Man;450055]If i think you mean something that has a transparent background, then i'm not sure, sorry.

Not necessarily. I just want to draw the bitmap in a window. I'd refresh the screen on user input. I've looked in the SCAR help files and there are a few functions dealing with drawing with bitmaps. Still, I don't know how to complete the whole process. I'll have to experiment quite a bit.

So it would really help if there was a tutorial showing me how to do this. Even a previously made game would be good (the source code, I mean).

skilld u

2008-08-16 22:35:50

Solemn wishes made a tut in the advanced section on making games, its very good.

WhoCares357

2008-08-16 23:19:19

From: skilld u
Solemn wishes made a tut in the advanced section on making games, its very good.


Thanks. I'll check it out.

Daniel

2008-08-18 07:28:38

From: WhoCares357
Thanks. I'll check it out.

Glad you found what you were looking for ;)

Dan Cardin

2008-08-18 08:43:59

hmm. i didnt know that it had to do with the variables being set as other variables. Afew days ago i was playing around with this and it got it to work by just re-arranging my variables.

Also if you make it fullscreen after your init procedure (after clicking a button maybe?) you dont have to muck around with that. just y=type in


FormName.BorderStyle := bsNone;
FormName.WindowState := wsMaximized;

Daniel

2008-08-19 02:30:33

From: Dan Cardin
hmm. i didnt know that it had to do with the variables being set as other variables. Afew days ago i was playing around with this and it got it to work by just re-arranging my variables.

Also if you make it fullscreen after your init procedure (after clicking a button maybe?) you dont have to muck around with that. just y=type in


FormName.BorderStyle := bsNone;
FormName.WindowState := wsMaximized;

I mean, when a form starts up and it's full screen ;)

Dan Cardin

2008-08-19 09:40:19

i know, i was just saying. no need to go all ";)" on me.

Daniel

2008-08-22 05:49:01

From: Dan Cardin
i know, i was just saying. no need to go all ";)" on me.

Huh???

sink998

2008-08-24 19:44:47

Thanks much help!

Widget

2008-09-17 23:17:04

MoveMouse(-100000,-100000);
GetMousePos(x1, y1);
MoveMouse(100000,100000);
GetMousePos(x2, y2);
Form.SetBounds(0, 0, x2 - x1, y2 - y1);
There's your screen size :D

Also, you can copy bitmaps to TImages with SafeCopyCanvas with a transparent background but it's complicatedish. Maybe I'll write some form tuts if I ever finish my game for the Form competition :)

Edit: Partial gravedig. Stupid fixed order :p

Daniel

2008-09-27 22:04:49

From: Widget
MoveMouse(-100000,-100000);
GetMousePos(x1, y1);
MoveMouse(100000,100000);
GetMousePos(x2, y2);
Form.SetBounds(0, 0, x2 - x1, y2 - y1);
There's your screen size :D

Also, you can copy bitmaps to TImages with SafeCopyCanvas with a transparent background but it's complicatedish. Maybe I'll write some form tuts if I ever finish my game for the Form competition :)

Edit: Partial gravedig. Stupid fixed order :p


Yay for Widget gravedigging my post :D

CopyCanvas and SafeCopyCanvas isn't complicated…

Tootoot222

2008-10-13 11:30:50

you know, you could just do this:

var
W, H: Integer;
begin
SetDesktopAsClient;
GetClientDimensions(W, H);
Form.SetBounds(0, 0, W, H);
end;

…quite simple really…

Daniel

2008-10-17 22:35:46

From: tootoot222
you know, you could just do this:

var
W, H: Integer;
begin
SetDesktopAsClient;
GetClientDimensions(W, H);
Form.SetBounds(0, 0, W, H);
end;

…quite simple really…

That wouldn't cover the taskbar ;) Also, just using a TRect and SetBounds is faster than that ;)