User Tools

Site Tools


en:tutorials:community:sergeig:scroll0

This is an old revision of the document!


Empty Scroll Project

Don't skip on An Introduction to Scroll.

The following code represents minimalistic Scroll based application that can be used as a template.

main.cpp must have __SCROLL_IMPL__ defined in main.cpp. If it is defined outside of main.cpp, then XCode generates linker errors.

main.cpp:

#define __SCROLL_IMPL__
#include "OrxScroll.h"
#undef __SCROLL_IMPL__
 
int main (int argc, char **argv)
{
    // Executes game
    OrxScroll::GetInstance().Execute (argc, argv);
 
    // Done!
    return EXIT_SUCCESS;
}
 
#ifdef __orxWINDOWS__
 
#include "windows.h"
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    // Executes game
    OrxScroll::GetInstance ().Execute ();
 
    // Done!
    return EXIT_SUCCESS;
}
 
#endif // __orxWINDOWS__

OrxScroll.h must have Init and Run methods:

#ifndef __GameName__OrxScroll__
#define __GameName__OrxScroll__
 
#define __NO_SCROLLED__
#include "Scroll.h"
 
class OrxScroll : public Scroll<OrxScroll>
{
private:
    //! Initialize the program
    virtual orxSTATUS Init ();
    //! Callback called every frame
    virtual orxSTATUS Run ();
 
};
 
#endif /* defined(__GameName__OrxScroll__) */

OrxScroll.cpp:

#include "OrxScroll.h"
 
orxSTATUS OrxScroll::Init ()
{
    orxSTATUS result = orxSTATUS_SUCCESS;    
    return result;
}
 
orxSTATUS OrxScroll::Run ()
{
    orxSTATUS result = orxSTATUS_SUCCESS;
    return result;
}

INI file must have MainViewport section:

[Display]
ScreenWidth   = 1024
ScreenHeight  = 768
Title         = Game Name
 
[Input]
SetList = MainInput
 
[MainInput]
KEY_ESCAPE = Quit
 
[MainViewport]
Camera            = Camera
 
[Camera]
; We use the same size for the camera than our display on screen so as to obtain a 1:1 ratio
FrustumWidth  = @Display.ScreenWidth
FrustumHeight = @Display.ScreenHeight
FrustumFar    = 1.0
FrustumNear  = 0.0
Position      = (0.0, 0.0, -1.0)

XCode 4 Build Configuration

If all ORX projects are at the same level in the directory tree

./orx/ contains orx clone
./scroll/ contains Scroll clone

then the following search paths have to be set:

1. Header Search Paths (HEADER_SEARCH_PATHS):

../scroll/include/Scroll
../orx/code/include

2. Library search paths (LIBRARY_SEARCH_PATHS):

$(inherited)
"$(SRCROOT)/../orx/code/lib/dynamic"
en/tutorials/community/sergeig/scroll0.1369297298.txt.gz · Last modified: 2017/05/30 04:50 (23 months ago) (external edit)