![]() |
Kukatz 3D
0.1
Török Attila szakdolgozata
|
00001 /* 00002 * credits.cpp - Kukatz 3D 00003 * Copyright (c) 2012 - TÖRÖK Attila (torokati44@gmail.com) 00004 * 00005 * This software is provided 'as-is', without any express or implied 00006 * warranty. In no event will the authors be held liable for any damages 00007 * arising from the use of this software. 00008 * 00009 * Permission is granted to anyone to use this software for any purpose, 00010 * including commercial applications, and to alter it and redistribute it 00011 * freely, subject to the following restrictions: 00012 * 00013 * 1. The origin of this software must not be misrepresented; you must not 00014 * claim that you wrote the original software. If you use this software 00015 * in a product, an acknowledgment in the product documentation would be 00016 * appreciated but is not required. 00017 * 00018 * 2. Altered source versions must be plainly marked as such, and must not be 00019 * misrepresented as being the original software. 00020 * 00021 * 3. This notice may not be removed or altered from any source 00022 * distribution. 00023 */ 00024 00025 #include "credits.hpp" 00026 00027 #include "guiimage.hpp" 00028 00029 Credits::Credits(unsigned int w, unsigned int h): 00030 StateBase(w, h), viewport(w, h) 00031 { 00032 resize(sf::Vector2i(w, h)); 00033 00034 gui.attach(new GUIImage("GROUND_2", 0.5f), 1, GUIElement::SCALE_MODE_BIGGER, 0.5f, 0.5f); 00035 00036 title = new GUIString(L"KREDITZ", "#44"); 00037 00038 GUIElementContainer* square = new GUIElementContainer(4.0f / 3.0f); 00039 gui.attach(square, 1.0f, GUIElement::SCALE_MODE_SMALLER, 0.5f, 0.5f); 00040 00041 square->attach(title, 0.2, GUIString::SCALE_MODE_VERTICAL, 0.5, 1); 00042 00043 string_1 = new GUIString(L"Készítette Török Attila", "#44"); 00044 string_2 = new GUIString(L"2010-2012-ig, C++ nyelven.", "#44"); 00045 square->attach(string_1, 0.07f, GUIElement::SCALE_MODE_VERTICAL, 0.5f, 0.78f); 00046 square->attach(string_2, 0.07f, GUIElement::SCALE_MODE_VERTICAL, 0.5f, 0.7f); 00047 //string_1->set_color(255, 0, 0, 255); 00048 //string_2->set_color(255, 0, 0, 255); 00049 00050 table_1 = new GUIElementContainer(1.1f); 00051 square->attach(table_1, 0.45f, GUIElement::SCALE_MODE_HORIZONTAL, 0.1f, 0.1f); 00052 00053 table_2 = new GUIElementContainer(1.1f); 00054 square->attach(table_2, 0.45f, GUIElement::SCALE_MODE_HORIZONTAL, 0.9f, 0.1f); 00055 00056 std::vector< sf::Unicode::Text > elements; 00057 00058 elements.push_back(L"Felhasznált szoftverek:"); 00059 elements.push_back(L"Blender"); 00060 elements.push_back(L"GIMP"); 00061 elements.push_back(L"BMFont"); 00062 elements.push_back(L"GCC"); 00063 elements.push_back(L"MinGW"); 00064 elements.push_back(L"CodeLite"); 00065 elements.push_back(L"Code::Blocks"); 00066 elements.push_back(L"Külön köszönet:"); 00067 elements.push_back(L"Farkas \"Z\" Gábor"); 00068 elements.push_back(L"Csapó Mátyás Dávid"); 00069 elements.push_back(L"Horváth \"Flash\" Norbert"); 00070 00071 for (unsigned int i = 0; i < elements.size(); ++i) 00072 { 00073 table_1->attach(new GUIString(elements[i], "#44"),1.0f / ((float)elements.size() - 1.0f), 00074 GUIElement::SCALE_MODE_VERTICAL, 0.0f, 1.0f - ((float)i / ((float)elements.size() - 1.0f))); 00075 } 00076 00077 ((GUIString*)(table_1->children[0]))->set_color(255, 0, 0, 255); 00078 ((GUIString*)(table_1->children[8]))->set_color(255, 0, 0, 255); 00079 00080 elements.clear(); 00081 00082 elements.push_back(L"Felhasznált könyvtárak:"); 00083 elements.push_back(L"OpenGL"); 00084 elements.push_back(L"SFML"); 00085 elements.push_back(L"(Laurent Gomila)"); 00086 elements.push_back(L"picoPNG"); 00087 elements.push_back(L"(Lode Vendevenne)"); 00088 elements.push_back(L"GLee"); 00089 elements.push_back(L"(Ben Woodhouse)"); 00090 elements.push_back(L"Snappy"); 00091 elements.push_back(L"(Google)"); 00092 elements.push_back(L"Miniball"); 00093 elements.push_back(L"(Bernd Gaertner)"); 00094 00095 for (unsigned int i = 0; i < elements.size(); ++i) 00096 { 00097 table_2->attach(new GUIString(elements[i], "#44"), 1.0f / ((float)elements.size() - 1.0f), 00098 GUIElement::SCALE_MODE_VERTICAL, 0.0f, 1.0f - ((float)i / ((float)elements.size() - 1.0f))); 00099 } 00100 ((GUIString*)(table_2->children[0]))->set_color(255, 0, 0, 255); 00101 } 00102 00103 void Credits::process_events(std::vector<sf::Event>& events) 00104 { 00105 for (unsigned int i = 0; i < events.size(); ++i) 00106 { 00107 if ( (events[i].Type == sf::Event::KeyPressed) && 00108 ((events[i].Key.Code == sf::Key::Return) || 00109 (events[i].Key.Code == sf::Key::Escape)) ) 00110 { 00111 pop(); 00112 } 00113 } 00114 } 00115 00116 void Credits::render() 00117 { 00118 viewport.look_2d(); 00119 gui.render(); 00120 } 00121 00122 void Credits::update(float) 00123 { 00124 00125 } 00126 00127 void Credits::resize(const sf::Vector2i& s) 00128 { 00129 size = s; 00130 viewport.size = s; 00131 gui.size = s; 00132 } 00133 00134 Credits::~Credits() 00135 { 00136 00137 }