User Tools

Site Tools


en:guides:beginners:viewport_and_camera

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:guides:beginners:viewport_and_camera [2018/06/27 04:55 (6 years ago)] – Rejigged to match init projects sausageen:guides:beginners:viewport_and_camera [2020/08/19 12:15 (4 years ago)] (current) – Viewport -> MainViewport to match the changes in init's template iarwain
Line 5: Line 5:
 A viewport is the rectangle that we can view the game world through. And a camera allows us to see all or part of that world at a time. A viewport is the rectangle that we can view the game world through. And a camera allows us to see all or part of that world at a time.
  
-Take a look at your MyGame.ini and you'll see that a ''[Viewport]'' section has already been specified for you.+Take a look at your MyGame.ini and you'll see that a ''[MainViewport]'' section has already been specified for you.
  
 <code=ini> <code=ini>
-[Viewport]+[MainViewport]
 Camera             = MainCamera Camera             = MainCamera
 </code> </code>
Line 15: Line 15:
  
 <code=ini> <code=ini>
-[Viewport]+[MainViewport]
 Camera            = MainCamera Camera            = MainCamera
 BackgroundColor   = (0, 180, 255) BackgroundColor   = (0, 180, 255)
Line 50: Line 50:
 ScreenWidth     = @MainCamera.FrustumWidth ScreenWidth     = @MainCamera.FrustumWidth
 ScreenHeight    = @MainCamera.FrustumHeight ScreenHeight    = @MainCamera.FrustumHeight
 +...
 </code> </code>
  
Line 58: Line 59:
 { {
  
-    orxViewport_CreateFromConfig("Viewport");+    orxViewport_CreateFromConfig("MainViewport");
 </code> </code>
  
Line 64: Line 65:
  
  
-The "Viewport" string parameter specified in that function is the same name as the ''[Viewport]'' section in the config.+The "MainViewport" string parameter specified in that function is the same name as the ''[MainViewport]'' section in the config.
  
-Because the camera was specified in the ''[Viewport]'' section, we do not need to create a camera in code.+Because the camera was specified in the ''[MainViewport]'' section, we do not need to create a camera in code.
  
-Final thing for this step is to name our game. This name will show in the window title. Set this with the Title property in the ''[Display]'' section:+Final thing for this step is to name our game. This name will show in the window title. Set this with the ''Title'' property in the ''[Display]'' section. Also while you are here, set the ''Smoothing'' to false:
  
 <code=ini> <code=ini>
Line 76: Line 77:
 Title           = Platform Hero Title           = Platform Hero
 FullScreen      = false FullScreen      = false
-Smoothing       true+Smoothing       false
 VSync           = true VSync           = true
 +</code>
 +
 +This will change the name in the window title, but only if you are compiling in Release mode. You'll most likely be compiling in Debug mode right now. So you'll also need to change the title in the ''MyGamed.ini'' file:
 +
 +<code ini>
 +[Display]
 +Title           = Platform Hero (Debug)
 +ShowFPS         = true
 </code> </code>
  
en/guides/beginners/viewport_and_camera.1530100508.txt.gz · Last modified: 2018/06/27 07:55 (6 years ago) (external edit)