User Tools

Site Tools


en:tutorials:objects:object

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:orx:tutorials:object [2009/07/27 04:46 (15 years ago)] iarwainen:tutorials:objects:object [2020/08/31 05:28 (4 years ago)] (current) – ↷ Links adapted because of a move operation sausage
Line 3: Line 3:
 ===== Summary ===== ===== Summary =====
  
-As orx is data driven, here we only need two lines of code to create a viewport and an object. All their properties are defined in the config file ([[http://orx.svn.sourceforge.net/svnroot/orx/trunk/tutorial/bin/01_Object.ini|01_Object.ini]]).+As orx is data driven, here we only need two lines of code to create a viewport and an object. All their properties are defined in the config file ([[https://github.com/orx/orx/blob/master/tutorial/bin/01_Object.ini|01_Object.ini]]).
  
 The viewport is associated with a camera which is implicitly created from the info given in the config file. The viewport is associated with a camera which is implicitly created from the info given in the config file.
Line 11: Line 11:
 In a later tutorial we'll see how to generate complex object hierarchies or even a whole scene (all background and landscape objects for example) with only a single line of code. In a later tutorial we'll see how to generate complex object hierarchies or even a whole scene (all background and landscape objects for example) with only a single line of code.
  
-For now, you can try to uncomment some of the lines of [[http://orx.svn.sourceforge.net/svnroot/orx/trunk/tutorial/bin/01_Object.ini|01_Object.ini]], play with them, then relaunch this tutorial. For an exhaustive list of options, please have a look at [[http://orx.svn.sourceforge.net/svnroot/orx/trunk/tutorial/bin/CreationTemplate.ini|CreationTemplate.ini]]. +For now, you can try to uncomment some of the lines of [[https://github.com/orx/orx/blob/master/tutorial/bin/01_Object.ini|01_Object.ini]], play with them, then relaunch this tutorial. For an exhaustive list of options, please have a look at [[https://github.com/orx/orx/blob/master/tutorial/bin/CreationTemplate.ini|CreationTemplate.ini]].
 ===== Details ===== ===== Details =====
    
Line 20: Line 19:
 Don't panic! All this is really easy. :-) Don't panic! All this is really easy. :-)
  
-In this tutorial, we are loading a config file which is in our parent directory. +In this tutorial, a config file which is in our parent directory is getting loaded
-As you may see, in this case, all the executables are in their own child directory, depending on their build type (mingw, msvs2005msvs2008, etc...) and we didn't want to duplicate the corresponding config files everywhere. ((However, if your config file name matches your executable and is in the same folder, it'll be loaded automatically.)) +As you may see, in this case, all the executables are in their own child directory, depending on their build type (mingw, vs2005vs2008, etc...) and we didn't want to duplicate the corresponding config files everywhere. ((However, if your config file name matches your executable and is in the same folder, it'll be loaded automatically.))
- +
-In our case, loading the config file is done like with this line: +
- +
-<code c>orxConfig_Load("../01_Object.ini");</code>+
  
 We then create our viewport. Note that the camera creation is automatically done given the config information stored for this viewport. We then create our viewport. Note that the camera creation is automatically done given the config information stored for this viewport.
Line 37: Line 32:
 That's it! The object has been created and will be displayed as long as it is in the frustum of our camera. That's it! The object has been created and will be displayed as long as it is in the frustum of our camera.
  
-Now, as we're using Orx's default launcher, we need to declare our plugin entry point (here our ''Init'' function). This is easily done with a macro.+Now, we need to declare our "entry" points (here our ''Init'', ''Run'' and ''Exit'' functions).
  
-<code c>orxSTATUS Init(){...}+We then need run orx and let it know about those functions as well as the command line parameters. All this is done with a single line of code:
  
-orxPLUGIN_DECLARE_ENTRY_POINT(Init);</code>+<code c>int main(int argc, char **argv) 
 +
 +  orx_Execute(argc, argv, Init, Run, Exit); 
 + 
 +  return EXIT_SUCCESS; 
 +}</code> 
 + 
 +//Calling ''orx_Execute()'' will also make sure the clock module is constantly ticked (as it's part of orx's core) and that we exit if the orxSYSTEM_EVENT_CLOSE event is sent.\\ 
 +This event is sent when closing the windows, for example, but it can also be sent under your own criteria (escape key pressed, for example).//((more details on this and the whole game loop in the [[..:localization:locale|C++/localization tutorial]]))
  
 As orx is data driven, we don't need to manually load any data, such as a sprites. As orx is data driven, we don't need to manually load any data, such as a sprites.
-Everything is handeld for us, with a data manager that will make sure sprites won't be duplicated in memory and freed when not used anymore.+Everything is handled for us by a data manager that will make sure sprites won't be duplicated in memory and freed when not used anymore.
  
-If you look at the config file, in the [Object] section, you'll see that you can specify all the object's properties, such as: graphic (sprite), pivot, color, alpha, physics properties, position, rotation, scale, tiling (repeat), animation, visual FX, etc...+If you look at the config file, in the [Object] section, you'll see that you can specify all the object's properties, such as: graphic (sprite), pivot, color, alpha, physics properties, position, rotation, scale, tiling (repeat), animation, visual FX, shader, etc...
  
 Don't worry, all this will be covered in further tutorials. Don't worry, all this will be covered in further tutorials.
  
-Now we have an object, we need to learn how to interact with it. This brings us to our second tutorial: [[Tutorials:Clock]].+Now we have an object, we need to learn how to interact with it. This brings us to our second tutorial: [[..:clocks:clock]].
  
 ===== Resources ===== ===== Resources =====
  
-Source code: [[https://orx.svn.sourceforge.net/svnroot/orx/trunk/tutorial/src/01_Object/01_Object.c|01_Object.c]] +Source code: [[https://github.com/orx/orx/blob/master/tutorial/src/01_Object.c|01_Object.c]]
- +
-Config file: [[https://orx.svn.sourceforge.net/svnroot/orx/trunk/tutorial/bin/01_Object.ini|01_Object.ini]]+
  
 +Config file: [[https://github.com/orx/orx/blob/master/tutorial/bin/01_Object.ini|01_Object.ini]]
en/tutorials/objects/object.1248695215.txt.gz · Last modified: 2017/05/30 00:50 (7 years ago) (external edit)