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
C-/C++-Quelltext |
|
1 |
App->SetResolution(); |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
int* Application::SetResolution() { if((ScreenWidthValue == 0)||(ScreenHeightValue==0)) { int ResolutionArry[2] = {800, 600}; return ResolutionArry; } else { int ResolutionArry[2] = {ScreenWidthValue, ScreenHeightValue}; return ResolutionArry; } } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
#ifndef _app_H_ #define _app_H_ class Application { public: int* Application::SetResolution(); private: }; #endif // _app_H_ |
C-/C++-Quelltext |
|
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 |
#include <GLFW/glfw3.h> #include <string> #include "App.h" using namespace std; static Application *App; int main(int argc, char** argv) { GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) exit(EXIT_FAILURE); if(!App -> InitEngineData(gContentPath)) printf("Faild to Initialize the Engine Data! \n"); App->SetResolution(); printf("%d \n", App->SetResolution()); /* Create a window and its OpenGL context */ if(!App->SetScreenMode()) window = glfwCreateWindow(640, 480, "", NULL, NULL); else window = glfwCreateWindow(640, 480, "", glfwGetPrimaryMonitor(), NULL); glfwSetWindowTitle(window, ""); if (!window) { glfwTerminate(); return -1; } /* Make the window's context current */ glfwMakeContextCurrent(window); // Initialize Render Engine App -> InitRenderEngine(); /* Loop until the user closes the window */ while (!glfwWindowShouldClose(window)) { /* Render here */ /* Swap front and back buffers */ glfwSwapBuffers(window); /* Poll for and process events */ glfwPollEvents(); } glfwTerminate(); return 0; } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C-/C++-Quelltext |
|
1 |
int ResolutionArry* = new int[] {800, 600}; |
C-/C++-Quelltext |
|
1 2 3 4 |
struct SResolution { int w, h; } resolution; |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C-/C++-Quelltext |
|
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 |
#ifndef _app_H_ #define _app_H_ #include <string> struct SResolution { int w; int h; }; extern struct SResolution resolution; using namespace std; extern string gContentPath; class Application { public: bool Application::InitEngineData(string gContentPath); bool Application::InitRenderEngine(); void Application::release(); bool Application::SetWindowTitle(); bool Application::SetScreenMode(); void Application::SetResolution(); private: }; #endif // _app_H_ |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include "app.h" #include "XmlPraser\pugixml.hpp" #include <string> #include <iostream> using namespace std; void Application::SetResolution() { if((ScreenHeightValue == 0)||(ScreenWidthValue == 0)) { struct SResolution resolution = { 800, 600 }; } else { struct SResolution resolution = { ScreenWidthValue, ScreenHeightValue }; } } |
C-/C++-Quelltext |
|
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 |
#include <GLFW/glfw3.h> #include <string> #include "App.h" using namespace std; static Application *App; // trims the app path and navigates to content folder string getContentPath( char *fullPath ) { string s( fullPath ); if( s.find( "/" ) != string::npos ) s = s.substr( 0, s.rfind( "/" ) ); else if( s.find( "\\" ) != string::npos ) s = s.substr( 0, s.rfind( "\\" )); s.append("\\..\\res"); // Change this when content is located on a different location! Path is always relative return s; } int main(int argc, char** argv) { string gContentPath = getContentPath(argv[0]); GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) exit(EXIT_FAILURE); if(!App -> InitEngineData(gContentPath)) printf("Faild to Initialize the Engine Data! \n"); App->SetResolution(); /* Create a window and its OpenGL context */ if(!App->SetScreenMode()) window = glfwCreateWindow(640, 480, "", NULL, NULL); else window = glfwCreateWindow(640, 480, "", glfwGetPrimaryMonitor(), NULL); glfwSetWindowTitle(window, ""); if (!window) { glfwTerminate(); return -1; } /* Make the window's context current */ glfwMakeContextCurrent(window); // Initialize Render Engine App -> InitRenderEngine(); /* Loop until the user closes the window */ while (!glfwWindowShouldClose(window)) { /* Render here */ printf("%d\n", resolution.h); printf("%d\n", resolution.w); /* Swap front and back buffers */ glfwSwapBuffers(window); /* Poll for and process events */ glfwPollEvents(); } glfwTerminate(); return 0; } |
Quellcode |
|
1 2 |
Fehler 7 error LNK1120: 1 nicht aufgel÷ste Externe E:\Projekte\C++ Projekts\Client\Debug\Client.exe 1 1 Client Fehler 6 error LNK2001: Nicht aufgel÷stes externes Symbol ""struct SResolution resolution" (?resolution@@3USResolution@@A)". E:\Projekte\C++ Projekts\Client\Client\MainFramework.obj Client |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »BlueCobold« (09.06.2014, 20:13)
C-/C++-Quelltext |
|
1 2 3 4 5 6 |
class Application { public: bool Application::InitEngineData(string gContentPath); ... } ; |
Werbeanzeige