Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Kestis

Pages: [1]
1
Window / Questions about handling a window
« on: January 17, 2018, 04:29:50 pm »
I looked through the documentation of sf::window and it seems to be impossible, but I'm asking just to be sure.

Is it possible to make a window which is resizable by grabbing its edge but which does not have a title bar? Also can I maximize or minimize or float the window from code?

2
General / Declaring sf::Font and sf::Color in a header
« on: January 15, 2018, 10:07:37 pm »
I needed a way to easily use same font and colors throughout my UI. Every UI component like button or textbox has its own class with render function. At first I made the fonts and colors as parameters of the render function but it seemed stupid to include them in every single one function call. Therefore I made a header which declares them:
#pragma once
#include <SFML\Graphics.hpp>

extern sf::Color baseColor;
extern sf::Color darkAccent;
extern sf::Color lightAccent;
extern sf::Color colorAccent;

extern sf::Font baseUiFont;
The header is included in every .cpp file that needs the variables.

Then I define them in the beginning of my main() like so:
sf::Color baseColor(50, 50, 50);
sf::Color darkAccent(30, 30, 30);
sf::Color lighAccent(70, 70, 70);
sf::Color colorAccent(255, 140, 0);

sf::Font baseUiFont;
baseUiFont.loadFromFile("Resources/OpenSans-Regular.ttf");
The problem is that this does not work. I get two errors:
Error   LNK2001 unresolved external symbol "class sf::Color baseColor" (?baseColor@@3VColor@sf@@A)
Error   LNK1120 1 unresolved externals
I tested similar declaration and definition of a simple int variable and it did work. Therefore I think that the problem is in the way SFML works. Is there a solution to this? All I need is a simple way to pass these variables to every object that needs them.

Pages: [1]
anything