Browse Source

Completed an unfinished method in DsrWindow and made API calls for accessing the window title.

David Piuva 2 years ago
parent
commit
8408a133f0
3 changed files with 20 additions and 1 deletions
  1. 10 0
      Source/DFPSR/api/guiAPI.cpp
  2. 9 1
      Source/DFPSR/api/guiAPI.h
  3. 1 0
      Source/DFPSR/gui/DsrWindow.cpp

+ 10 - 0
Source/DFPSR/api/guiAPI.cpp

@@ -498,3 +498,13 @@ void dsr::window_applyTheme(const Window& window, const VisualTheme& theme) {
 	MUST_EXIST(theme, window_applyTheme);
 	MUST_EXIST(theme, window_applyTheme);
 	window->applyTheme(theme);
 	window->applyTheme(theme);
 }
 }
+
+void dsr::window_setTitle(Window& window, const dsr::String& title) {
+	MUST_EXIST(window, window_setTitle);
+	window->backend->setTitle(title);
+}
+
+String dsr::window_getTitle(Window& window) {
+	MUST_EXIST(window, window_getTitle);
+	return window->backend->getTitle();
+}

+ 9 - 1
Source/DFPSR/api/guiAPI.h

@@ -46,9 +46,15 @@ namespace dsr {
 	// If the game starts in full screen, this constructor should be used instead.
 	// If the game starts in full screen, this constructor should be used instead.
 	//   Otherwise the canvas may ask for the window's dimensions while the system still keeps the old dimensions due to delays.
 	//   Otherwise the canvas may ask for the window's dimensions while the system still keeps the old dimensions due to delays.
 	Window window_create_fullscreen(const dsr::String& title);
 	Window window_create_fullscreen(const dsr::String& title);
-	// Returns true iff the window exists
+	// Returns true iff the window exists.
 	bool window_exists(const Window& window);
 	bool window_exists(const Window& window);
 
 
+// Set window title
+	// Assigns the window's title.
+	void window_setTitle(Window& window, const dsr::String& title);
+	// Returns the window's title.
+	String window_getTitle(Window& window);
+
 // Layout files
 // Layout files
 	// Loading an interface by parsing a layout file's content, with any external resources loaded relative to fromPath.
 	// Loading an interface by parsing a layout file's content, with any external resources loaded relative to fromPath.
 	//   Embedded images do not count as external resources, but file paths need fromPath in order to know from where they will be loaded.
 	//   Embedded images do not count as external resources, but file paths need fromPath in order to know from where they will be loaded.
@@ -126,6 +132,8 @@ namespace dsr {
 	//   Just like when handling a window resize, this will replace the canvas and depth buffer.
 	//   Just like when handling a window resize, this will replace the canvas and depth buffer.
 	//     Any old handles to canvas and depth buffer will become useless, so fetch new image handles from the window to avoid black flickering.
 	//     Any old handles to canvas and depth buffer will become useless, so fetch new image handles from the window to avoid black flickering.
 	void window_setPixelScale(const Window& window, int scale);
 	void window_setPixelScale(const Window& window, int scale);
+
+// Cursor
 	// Sets the cursor visibility for window, hiding if visible is false and showing if visible is true.
 	// Sets the cursor visibility for window, hiding if visible is false and showing if visible is true.
 	// Returns true on success and false on failure.
 	// Returns true on success and false on failure.
 	bool window_setCursorVisibility(const Window& window, bool visible);
 	bool window_setCursorVisibility(const Window& window, bool visible);

+ 1 - 0
Source/DFPSR/gui/DsrWindow.cpp

@@ -268,6 +268,7 @@ String DsrWindow::getTitle() {
 }
 }
 
 
 void DsrWindow::setTitle(const String &newTitle) {
 void DsrWindow::setTitle(const String &newTitle) {
+	return this->backend->setTitle(newTitle);
 }
 }
 
 
 void DsrWindow::applyTheme(VisualTheme theme) {
 void DsrWindow::applyTheme(VisualTheme theme) {