API Documentation
Loading...
Searching...
No Matches
GraphicsException.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Graphics
28File: GraphicsException
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
36
37namespace NDEVR
38{
40 {
41 public:
47 explicit GraphicsException(const TranslatedString& error)
48 : Exception(_t("General Graphics Error"), error)
50 {
51 setCategory(_t("Graphics Error"));
52 }
54 : Exception(_t("Graphics Error"), error)
56 {
57 setCategory(category);
58 }
64 {
65 return m_type;
66 }
68 void setMessage(const TranslatedString& message) final override
69 {
70 // User-friendly message and graphics device list is prepended to the actual message
71
72 // Build device list
73 String devices = _t("Graphics Devices").translation() +":";
75 for (const VideoCardInformation& info : graphics_device_infos)
76 {
77 devices += "\n\t" + info.video_processor;
78 }
79
80 // Build actual message
81 TranslatedString new_message = _td("graphics_exception_message", "[message]\n\n"
82 "Note, this program requires up-to-date Graphics-compatible drivers to render 3D.\n"
83 "While it may not be the cause of this issue, please ensure your detected graphics device(s) are compatible and that your graphics drivers are up-to-date.\n"
84 "[devices]");
85 new_message.replace("[devices]", devices);
86 new_message.replace("[message]", message);
87
88 Exception::setMessage(new_message);
89 }
90 };
92 {
93 public:
95 : GraphicsException(_t("General Graphics Error"), error)
96 {
98 setCategory(_t("Graphics Device Lost Error"));
99 }
101 : GraphicsException(error)
102 {
104 setCategory(category);
105 }
106 };
107}
108
#define _t(english_string)
Definition Translator.h:87
#define _td(def, english_string)
Definition Translator.h:91
static Buffer< VideoCardInformation > GetVideoCardInfo()
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsException.h:92
DeviceLostException(const TranslatedString &error)
Definition GraphicsException.h:94
DeviceLostException(const TranslatedString &error, const TranslatedString &category)
Definition GraphicsException.h:100
Definition Exception.hpp:56
void setCategory(const TranslatedString &category)
Definition Exception.hpp:115
virtual void setMessage(const TranslatedString &message)
Definition Exception.hpp:95
Definition GraphicsException.h:40
GraphicsExceptionType
Definition GraphicsException.h:43
@ e_general
Definition GraphicsException.h:44
@ e_device_lost
Definition GraphicsException.h:45
GraphicsException(const TranslatedString &error, const TranslatedString &category)
Definition GraphicsException.h:53
void setMessage(const TranslatedString &message) final override
Definition GraphicsException.h:68
GraphicsExceptionType type() const
Definition GraphicsException.h:63
void setType(GraphicsExceptionType type)
Definition GraphicsException.h:59
GraphicsException(const TranslatedString &error)
Definition GraphicsException.h:47
GraphicsExceptionType m_type
Definition GraphicsException.h:67
Definition String.h:40
Definition TranslatedString.h:9
NDEVR_BASE_API TranslatedString & replace(const String &sub_string, const TranslatedString &replacement)
Definition TranslatedString.cpp:51
Definition ACIColor.h:37
Definition ApplicationResource.h:75