Elevate Engine 1
Loading...
Searching...
No Matches
Elevate::WindowProps Struct Reference

#include <Window.h>

Public Member Functions

 WindowProps ()
 
 WindowProps (const std::string &title, unsigned int width, unsigned int height, bool vsync)
 
 WindowProps (const std::string appConfigFilePath)
 

Public Attributes

std::string Title
 
unsigned int Width
 
unsigned int Height
 
bool VSync
 

Detailed Description

Definition at line 21 of file Window.h.

Constructor & Destructor Documentation

◆ WindowProps() [1/3]

Elevate::WindowProps::WindowProps ( )
inline

Definition at line 28 of file Window.h.

28: Title("ElevateEngine Dev"), Width(1280), Height(720), VSync(false) { }
unsigned int Height
Definition Window.h:25
unsigned int Width
Definition Window.h:24
std::string Title
Definition Window.h:23

◆ WindowProps() [2/3]

Elevate::WindowProps::WindowProps ( const std::string &  title,
unsigned int  width,
unsigned int  height,
bool  vsync 
)
inline

Definition at line 30 of file Window.h.

31 : Title(title), Width(width), Height(height), VSync(vsync) { }

◆ WindowProps() [3/3]

Elevate::WindowProps::WindowProps ( const std::string  appConfigFilePath)

Definition at line 34 of file Window.cpp.

35 {
36 // TODO put this part in a util somehwerre to get the document
38 FILE* fp = fopen(appConfigFilePath.c_str(), "r");
39 char readBuffer[65536];
40 rapidjson::FileReadStream is(fp, readBuffer,
41 sizeof(readBuffer));
42 rapidjson::Document doc;
43 doc.ParseStream(is);
44 fclose(fp);
45
46 // Error handling
47 if (doc.HasParseError())
48 {
49 EE_CORE_TRACE("ERROR PARSING The WindowProps JSON");
50 }
52
53 if (doc.HasMember("title") && doc["title"].IsString())
54 {
55 this->Title = doc["title"].GetString();
56 }
57
58 if (doc.HasMember("size"))
59 {
60 const rapidjson::Value& size = doc["size"];
61 if (size.HasMember("x") && size["x"].IsInt())
62 {
63 this->Width = size["x"].GetInt();
64 }
65 if (size.HasMember("y") && size["y"].IsInt())
66 {
67 this->Height = size["y"].GetInt();
68 }
69 }
70
71 if (doc.HasMember("vsync") && doc["vsync"].IsBool())
72 {
73 this->VSync = doc["vsync"].GetBool();
74 }
75 }

Member Data Documentation

◆ Height

unsigned int Elevate::WindowProps::Height

Definition at line 25 of file Window.h.

◆ Title

std::string Elevate::WindowProps::Title

Definition at line 23 of file Window.h.

◆ VSync

bool Elevate::WindowProps::VSync

Definition at line 26 of file Window.h.

◆ Width

unsigned int Elevate::WindowProps::Width

Definition at line 24 of file Window.h.


The documentation for this struct was generated from the following files: