Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »xardias« (03.08.2011, 20:04)
Ja, geplant ist das schon .Zitat
Was ist das denn hier wieder für ein Kindergarten? Jemand wird kritisiert, dass er seine Freizeit, Bemühungen und sein Know-How in ein Open Source Projekt steckt, welches nach Ansicht einiger Leute hier anscheinend nicht richtig ist. WTF?! Wenn jemand Open Source entwickeln will, dann ist das gut und es dient außerdem einem Zweck. Es fördert Open Source, Know-How und Kommunikation zwischen Entwicklern weltweit. Wie man dagegen sein kann, verstehe ich nicht. Muss ich ja zum Glück auch nicht, da hier ja Meinungsfreiheit herrscht.
Zum Thema: Wirklich eine sehr nette Engine! Habe etwas durch den Code geidlelt und finde ihn soweit doch recht gut. Die Engine hat wirklich viele gute Seiten, OpenGL 3-Support ist aus meiner Sicht auch eher was außergewöhnliches. Planst du "Advanced"-Features wie Beleuchtung einzubauen?
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
/* Project CodeName NightLight Copyright 2011 NightLight Team This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "NLSandBox.hpp" #include "NLApplication.hpp" #include <boost/bind.hpp> const NLWindowSettings g_fullscreen(1680, 1050, true, 32, 2, true); const NLWindowSettings g_windowed(1280,800, false, 32, 2, false); const bool g_framelimit = false; NLApplication::NLApplication() : m_controller(NLSystemController::getInstance()), m_text(NULL) { // Those names are important for the appdata-folder.. m_controller.setVendorName("Scorched Productions"); m_controller.setAppName("NLSandBox"); // Check for User-Directory. if (!m_controller.userDataDirExists()){ m_controller.createUserDataDir(); } // Create HTML-Log m_controller.createLog(m_controller.getUserDataDir() + std::string("/") + std::string("NightLight.html"), LL_VERBOSE, new NLHtmlWriter()); } NLApplication::~NLApplication() { NLMessage("[Client] Resources (hopefully) freed. Client exits."); } void NLApplication::run() { NLScriptManager mgr; NLScript* script = mgr.loadScript("../scripts/test.cxx", "void main()"); if ( script) { script->execute(); delete script; } // ---------------------------------------- // Construct Window // ---------------------------------------- NLIPlatformWindow& window = (*m_controller.createWindow(g_windowed)); window.center(); m_controller.getOpenGLContext()->setClearColor(NLColor4f(0.7f,0.7f,0.7f,1.0f)); m_controller.getOpenGLContext()->dumpOpenGLInfos(false); // ---------------------------------------- // Load // ---------------------------------------- m_controller.getResourceManager().loadResourceFile("../xml/examples.xml"); NLShader* TexturedWithAlphaTest = m_controller.getResourceManager().getShader("TexturedWithAlphaTest"); NLShader* TexturedWithAlphaTestAdditiveColor = m_controller.getResourceManager().getShader("TexturedWithAlphaTestAdditiveColor"); NLSpriteSheet* sheet = m_controller.getResourceManager().getSpriteSheet("SpriteSheet"); NLFont* fnt = m_controller.getResourceManager().getFont("NormalFont"); // ---------------------------------------- // Create Batcher // ---------------------------------------- m_batcher = new NLSpriteBatcher(TexturedWithAlphaTest, sheet->getTexture()); // ---------------------------------------- // Create Animation // ---------------------------------------- m_animation = new NLAnimatedSprite("../xml/animation.xml", glm::vec3(100,100, NLLayerConstants::BACKGROUND_LAYER1), glm::vec2(64,64), "AnimationTest"); m_batcher->insert(m_animation); m_animation->play(); // ---------------------------------------- // Static Text // ---------------------------------------- m_s_text = new NLStaticText(fnt, glm::vec3(10,300, NLLayerConstants::GUI_TEXT), TexturedWithAlphaTest, NLCOLOR4F_BLUE, "I am a static text rendered on a texture"); // ---------------------------------------- // Create Sprites // ---------------------------------------- NLTextureCoords* bohne = sheet->getTexCoordsByName("bohne_64"); for ( int i=0; i <= 1500; i++) { f32 x = SystemController().getRandomReal(10, window.getSettings().width-32); f32 y = SystemController().getRandomReal(10, window.getSettings().height-32); f32 rot = SystemController().getRandomReal(0.0f, 360.0f); MySprite* s = new MySprite(glm::vec2(32,32), glm::vec3(x, y, NLLayerConstants::DYNAMIC_LAYER2), bohne); s->rotateAroundCenter(rot); m_batcher->insert(s); } m_batcher->createBatch(); // ---------------------------------------- // Create dynamic Text // ---------------------------------------- std::stringstream ss; ss << "FPS: " << window.getFrameCounter().getFPS() << "\nsprites:" << m_batcher->getList().size()-1; m_text = new NLDynamicText(fnt, glm::vec3(0,0, NLLayerConstants::GUI_TEXT), TexturedWithAlphaTestAdditiveColor, glm::vec4(0.7f, 0.0, 0.0, 0.0f), ss.str()); // ---------------------------------------- // Init done -> connect events // ---------------------------------------- window.connectSignalKey(NLBindKeySlot(NLApplication, onKey)); window.connectSignalQuit(NLBindQuitSlot(NLApplication, onQuit)); window.connectSignalMouse(NLBindMouseSlot(NLApplication, onMouse)); m_controller.connectSignalRender(NLBindRenderSlot(NLApplication, onRender)); m_controller.getTimerController().connectSignalLogicUpdate(NLBindUpdateLogicSlot(NLApplication, onUpdate)); // ---------------------------------------- // Hide Mouse and enter EventLoop // ---------------------------------------- SystemController().enterLoop(); } void NLApplication::onRender(u32 delta, u32 time) { m_batcher->renderObject(); m_text->renderObject(); m_s_text->renderObject(delta, time); } void NLApplication::onUpdate(u32 delta, u32 time) { std::stringstream ss; ss << "FPS: " << SystemController().getWindow()->getFrameCounter().getFPS() << "\nsprites:" << m_batcher->getList().size()-1; m_text->setText(ss.str()); m_batcher->update(delta, time); } void NLApplication::onKey(const int key, const bool down) { if ( down == true ) { switch(key) { case Key::F12: { m_controller.doScreenshot(m_controller.getUserDataDir() + std::string("/") + std::string("screenshot.png")); break; } case Key::Q: { if (m_controller.getWindow()->ctrl() && down ) { m_controller.getWindow()->closeWindow(); } break; } } } } bool NLApplication::onQuit() { std::stringstream ss; ss << "Highest FPS: " << SystemController().getWindow()->getFrameCounter().getHighestFPS(); SystemController().printToLog(LL_MESSAGE, ss.str()); delete m_s_text; delete m_batcher; delete m_text; return true; } void NLApplication::onMouse( u32 x, u32 y, int key, bool down ) { } |
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Nico« (03.08.2011, 20:08)
Du hast die Exiszenz des Produkt als solches in Frage gestellt und das ist einfach Unfug. Denn mit Deiner Argumentation kann man jedes Produkt in Frage stellen, auch Brot.Du musst dich nicht rechtfertigen. Du kannst programmieren was auch immer du willst. Doch du hast hier geposted um Helfer für dein Projekt zu finden, wenn du deinen potentiellen Helfern diese Fragen nicht beantworten möchtest, wirst du auf der Suche sehr viele Probleme haben.
Du hast die Exiszenz des Produkt als solches in Frage gestellt und das ist einfach Unfug. Denn mit Deiner Argumentation kann man jedes Produkt in Frage stellen, auch Brot.Du musst dich nicht rechtfertigen. Du kannst programmieren was auch immer du willst. Doch du hast hier geposted um Helfer für dein Projekt zu finden, wenn du deinen potentiellen Helfern diese Fragen nicht beantworten möchtest, wirst du auf der Suche sehr viele Probleme haben.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »xardias« (03.08.2011, 20:19)
Okay ich glaube jetzt weiß ich was du kreiren willst:
Eine freie Engine zur Contentproduktion.
Es gibt frei oder Contentproduktion aber nicht beides.
Also ich sagte ja bereits, es ist/wird eine Engine nach dem Vorbild von Unreal oder Unity. Allerdings für 2D. Den Workflow von Torque2D kenne ich nicht.Du hast die Exiszenz des Produkt als solches in Frage gestellt und das ist einfach Unfug. Denn mit Deiner Argumentation kann man jedes Produkt in Frage stellen, auch Brot.Du musst dich nicht rechtfertigen. Du kannst programmieren was auch immer du willst. Doch du hast hier geposted um Helfer für dein Projekt zu finden, wenn du deinen potentiellen Helfern diese Fragen nicht beantworten möchtest, wirst du auf der Suche sehr viele Probleme haben.
Das ist richtig, mit der Argumentation lässt sich jedes Produkt in Frage stellen. Und eigentlich alle erfolgreichen Produkte haben eine sehr gute Antwort auf diese Frage.
Und genau diese Antwort habe ich von dir erfahren wollen. Warum glaubst du hat dein Projekt eine Existenzberechtigung?
Ich wollte damit deinem Projekt nicht die Existenzberechtigung absprechen, ich wollte lediglich wissen was diese Existenzberechtigung ist. Es tut mir Leid wenn du dies als Angriff gesehen hast, so war es nicht gemeint.
Supreme: Ich habe doch gesagt er muss sich nicht rechtfertigen.
Werbeanzeige