This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:community:sergeig:scroll0 [2017/12/17 16:50 (6 years ago)] – [MyOrxScrollGame.cpp] sausage | en:tutorials:community:sergeig:empty-scroll-project [2020/08/31 07:00 (4 years ago)] (current) – ↷ Page name changed from en:tutorials:community:sergeig:scroll0 to en:tutorials:community:sergeig:empty-scroll-project sausage | ||
---|---|---|---|
Line 2: | Line 2: | ||
<WRAP center round box 60%> | <WRAP center round box 60%> | ||
- | Please note that soon, the [[tutorials: | + | No longer required.The |
</ | </ | ||
- | |||
- | |||
- | Don't skip on [[tutorials: | ||
- | |||
- | The following code represents minimalistic Scroll based application that can be used as a template. | ||
- | |||
- | ===== MyOrxScrollGame.h ===== | ||
- | |||
- | MyOrxScrollGame.h must have Init and Run methods: | ||
- | |||
- | <code cpp> | ||
- | #ifndef __GameName__OrxScroll__ | ||
- | #define __GameName__OrxScroll__ | ||
- | |||
- | #define __NO_SCROLLED__ | ||
- | #include " | ||
- | |||
- | class MyOrxScrollGame : public Scroll< | ||
- | { | ||
- | private: | ||
- | //! Initialize the program | ||
- | virtual orxSTATUS Init (); | ||
- | //! Callback called every frame | ||
- | virtual orxSTATUS Run (); | ||
- | |||
- | }; | ||
- | |||
- | #endif /* defined(__GameName__OrxScroll__) */ | ||
- | </ | ||
- | |||
- | ===== MyOrxScrollGame.cpp ===== | ||
- | |||
- | Due to inline code in headers, it is difficult to separate main function into its own file. So it is part of MyOrxScrollGame.cpp. | ||
- | |||
- | <code cpp> | ||
- | #define __SCROLL_IMPL__ | ||
- | #include " | ||
- | #undef __SCROLL_IMPL__ | ||
- | |||
- | orxSTATUS MyOrxScrollGame:: | ||
- | { | ||
- | orxSTATUS result = orxSTATUS_SUCCESS; | ||
- | return result; | ||
- | } | ||
- | |||
- | orxSTATUS MyOrxScrollGame:: | ||
- | { | ||
- | orxSTATUS result = orxSTATUS_SUCCESS; | ||
- | | ||
- | return result; | ||
- | } | ||
- | |||
- | int main (int argc, char **argv) | ||
- | { | ||
- | // Executes game | ||
- | MyOrxScrollGame:: | ||
- | | ||
- | // Done! | ||
- | return EXIT_SUCCESS; | ||
- | } | ||
- | |||
- | #ifdef __orxWINDOWS__ | ||
- | |||
- | #include " | ||
- | |||
- | int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, | ||
- | { | ||
- | // Executes game | ||
- | MyOrxScrollGame:: | ||
- | | ||
- | // Done! | ||
- | return EXIT_SUCCESS; | ||
- | } | ||
- | |||
- | #endif // __orxWINDOWS__ | ||
- | </ | ||
- | |||
- | ===== INI File ===== | ||
- | |||
- | INI file must have MainViewport section: | ||
- | |||
- | <code ini> | ||
- | [Display] | ||
- | ScreenWidth | ||
- | ScreenHeight | ||
- | Title = Game Name | ||
- | |||
- | [Input] | ||
- | SetList = MainInput | ||
- | |||
- | [MainInput] | ||
- | KEY_ESCAPE = Quit | ||
- | |||
- | [MainViewport] | ||
- | Camera | ||
- | |||
- | [Camera] | ||
- | ; We use the same size for the camera than our display on screen so as to obtain a 1:1 ratio | ||
- | FrustumWidth | ||
- | FrustumHeight = @Display.ScreenHeight | ||
- | FrustumFar | ||
- | FrustumNear | ||
- | Position | ||
- | </ | ||
- | |||
- | ===== Additional Information ===== | ||
- | |||
- | See [[tutorials: |