[4554] | 1 | /* |
---|
[4333] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Benjamin Grauer |
---|
| 13 | co-programmer: ... |
---|
| 14 | |
---|
| 15 | this file extends the framework file, so it renders what i want. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #include "framework.h" |
---|
| 19 | |
---|
[4343] | 20 | #include "light.h" |
---|
[4333] | 21 | |
---|
[4343] | 22 | #include "objModel.h" |
---|
| 23 | #include "primitive_model.h" |
---|
[6003] | 24 | #include "media_container.h" |
---|
[4343] | 25 | #include <stdlib.h> |
---|
[4333] | 26 | |
---|
[4649] | 27 | #include "resource_manager.h" |
---|
[4343] | 28 | |
---|
| 29 | Model* obj; |
---|
[6057] | 30 | MediaContainer* movie; |
---|
[4343] | 31 | |
---|
| 32 | void Framework::moduleInit(int argc, char** argv) |
---|
[4333] | 33 | { |
---|
[6003] | 34 | |
---|
[6057] | 35 | movie = new MediaContainer(argv[1]); |
---|
[6003] | 36 | |
---|
[6057] | 37 | // print information about the media file |
---|
| 38 | movie->printMediaInformation(); |
---|
| 39 | |
---|
| 40 | /* |
---|
[4649] | 41 | ResourceManager::getInstance()->addImageDir("./"); |
---|
| 42 | |
---|
[4653] | 43 | for (int i = 0; i < argc; i++) |
---|
| 44 | { |
---|
| 45 | printf("%s\n", argv[i]); |
---|
| 46 | } |
---|
| 47 | ResourceManager::getInstance()->addImageDir(""); |
---|
| 48 | |
---|
| 49 | |
---|
[4343] | 50 | if (argc>=3) |
---|
| 51 | obj = new OBJModel (argv[1], atof(argv[2])); |
---|
| 52 | else if (argc>=2) |
---|
| 53 | obj = new OBJModel(argv[1]); |
---|
[4554] | 54 | else |
---|
[4492] | 55 | obj = new PrimitiveModel(PRIM_CYLINDER); |
---|
[4333] | 56 | |
---|
[4653] | 57 | ResourceManager::getInstance()->debug(); |
---|
| 58 | |
---|
[4343] | 59 | LightManager* lightMan = LightManager::getInstance(); |
---|
| 60 | lightMan->setAmbientColor(.1,.1,.1); |
---|
[4741] | 61 | (new Light())->setAbsCoor(5.0, 10.0, 40.0); |
---|
[6057] | 62 | (new Light())->setAbsCoor(-10, -20, -100);*/ |
---|
[4333] | 63 | } |
---|
| 64 | |
---|
[4334] | 65 | void Framework::moduleEventHandler(SDL_Event* event) |
---|
| 66 | { |
---|
| 67 | switch (event->type) |
---|
| 68 | { |
---|
| 69 | case SDL_KEYDOWN: |
---|
| 70 | switch (event->key.keysym.sym) |
---|
[4554] | 71 | { |
---|
| 72 | case SDLK_i: |
---|
| 73 | break; |
---|
| 74 | } |
---|
[4334] | 75 | } |
---|
[4333] | 76 | } |
---|
| 77 | |
---|
| 78 | void Framework::moduleTick(float dt) |
---|
| 79 | { |
---|
[6057] | 80 | if(movie->framesLeft()) |
---|
| 81 | movie->getNextFrame(); |
---|
[4333] | 82 | } |
---|
| 83 | |
---|
[4349] | 84 | void Framework::moduleDraw(void) const |
---|
[4334] | 85 | { |
---|
[6057] | 86 | //obj->draw(); |
---|
[4343] | 87 | |
---|
[6057] | 88 | //LightManager::getInstance()->draw(); |
---|
[4334] | 89 | } |
---|
[4333] | 90 | |
---|
[4334] | 91 | |
---|
[4333] | 92 | void Framework::moduleHelp(void) const |
---|
| 93 | { |
---|
[4554] | 94 | |
---|
[4333] | 95 | } |
---|