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 [2024/11/17 10:31 (11 months ago)] – Fixes and alignment to newer orx. sausageen:guides:beginners:viewport_and_camera [2025/09/30 17:26 (12 days ago)] (current) – external edit 127.0.0.1
Line 53: Line 53:
 </code> </code>
  
-The viewport needs to be created when our game runs, so let's take a look at the MyGame.cpp code:+The viewport needs to be created when our game runs, so let's take a look at the MyGame.code (for a C++ project, look for ''MyGame::Init'' in MyGame.cpp):
  
-<code=cpp>+<code=c>
 orxSTATUS orxFASTCALL Init() orxSTATUS orxFASTCALL Init()
 { {
  
-    orxViewport_CreateFromConfig("MainViewport");+... 
 +  orxConfig_PushSection("Main"); 
 + 
 +  for(orxS32 i = 0, iCount = orxConfig_GetListCount("ViewportList"); i < iCount; i++) 
 +  { 
 +    orxViewport_CreateFromConfig(orxConfig_GetListString("ViewportList", i)); 
 +  } 
 </code> </code>
  
-Nice and simple. Our project already has this added. The Init() function runs once when your game first executes, and this is where the viewport is created.+Here the ''"ViewportList"'' refers to this section of the config file: 
 +<code ini> 
 +[Main] 
 +ViewportList    = MainViewport 
 +</code> 
 + 
 +You could also called ''orxViewport_CreateFromConfig'' on a static name: 
 +<code=c> 
 +orxSTATUS orxFASTCALL Init() 
 +
 + 
 +... 
 +   
 +    orxViewport_CreateFromConfig("MainViewport"); 
 + 
 +</code>
  
 +The Init() function runs once when your game first executes, and this is where the viewport is created.
  
 The "MainViewport" string parameter specified in that function is the same name as the ''[MainViewport]'' section in the config. The "MainViewport" string parameter specified in that function is the same name as the ''[MainViewport]'' section in the config.
en/guides/beginners/viewport_and_camera.1731839504.txt.gz · Last modified: 2025/09/30 17:26 (12 days ago) (external edit)