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 - Joshua Flynn

Pages: [1] 2
1
In regularly using SFML, I often encounter a class where I want to expand it's basic functionality (a term for this is extensibility), but I'm unable to do so as it's contents and functions are declared private, which means only members of that class and friend classes can access it.

A prime example would be adding pause functionality to the sf::Clock.

Often, the individual is faced with a choice: either write their own class from scratch to address what is usually only a few additional functional add-ons, or port the SFML source code, make modifications at the low-level and then compile a new library, which then often makes any code reliant on it incompatible with the active version of SFML (and thus requires all future additions of SFML be modified in the same way, a time consuming process!).


A very simple solution, which comes at no cost to SFML and greatly increases it's functionality, is for SFML classes to change their private contents and functions, to protected, which allows a subclass to inherit and access both the functions and the contents, which would allow people to readily extend SFML whilst solving problems such as allowing people to add pause functionality.

It might be argued that private is there as a form of protection, however, given the user is forced into  implementing their own (dodgy!) design (either their own standalone class or modifying the library), it's safer if they're allowed to simply expand a pre-existing stable class.


For example, right now (ignoring the Pause example for sf::Clock) I'd love to implement my own append and get split channel style function for sf::Buffer, but it's looking like I will have to copy out sf::Buffer's contents, modify it, and then put it back in, which is pretty messy and would look neater as an expanded sub-class of sf::Buffer, but without direct access to it's internalised vector, will require I declare duplicate space (a big overhead on large sound files) to do things like append operations - noting that std::vector directly supports appending (where I can simply 'attach on' a sound file without duplicating sf:Buffer's contents).

I know the idea of shifting it from private to protected will get stick from those in-favour of the status quo, but my classes in my library use protected de facto to allow extensibility *unless* I can justify the usage of private (IE a function call must only be called in specific states that only the class itself knows).

2
General / Static Link Errors
« on: November 22, 2013, 01:10:38 pm »
I've got Code::Blocks running GCC, and for some time now, the system has been figured to work dynamically (notably the SFML files were copied into the /include directory of the given compiler).

However, I've encountered an error (I'm operating an earlier revision of SFML, 1.6, and the code presently relies on it, and I have a week to deploy a demonstration program so I can't risk dev environment change to another version) in attempting to link statically.

For some strange reason, my development environment doesn't require I include the SFML linker settings under project build settings for the dynamic system - it just works (I believe this is crucial point to make in order to solve the problem).


If I add in the following linker settings to make it static:

-lsfml-network-s
-lsfml-audio-s
-lsfml-graphics-s
-lsfml-window-s
-lsfml-system-s

The code refuses to compile and throws up a series of errors, similar to this:

Code: [Select]
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| multiple definition of `sf::Sprite::Sprite()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000127.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| multiple definition of `sf::Sprite::SetImage(sf::Image const&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000125.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| multiple definition of `sf::Image::Image()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000075.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| multiple definition of `sf::Image::~Image()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000080.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| multiple definition of `sf::Image::LoadFromFile(std::string const&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000060.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Color.o):Color.cpp|| multiple definition of `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000053.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Drawable.o):Drawable.cpp|| multiple definition of `sf::Drawable::~Drawable()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000162.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Drawable.o):Drawable.cpp|| multiple definition of `sf::Drawable::SetColor(sf::Color const&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics.a(d000151.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::Close()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000016.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::IsOpened() const'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000059.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::GetEvent(sf::Event&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000023.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| multiple definition of `sf::Window::Display()'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000019.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(VideoMode.o):VideoMode.cpp|| multiple definition of `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window.a(d000045.o)|| first defined here|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp:(.text$_ZN2sf6SpriteD0Ev[sf::Sprite::~Sprite()]+0x15d)||undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Sprite.o):Sprite.cpp:(.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp|| more undefined references to `_Unwind_Resume' follow|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Image.o):Image.cpp:(.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(Drawable.o):Drawable.cpp:(.eh_frame+0x11)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp|| more undefined references to `_Unwind_Resume' follow|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(ImageLoader.o):ImageLoader.cpp:(.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-graphics-s.a(GraphicsContext.o):GraphicsContext.cpp:(.eh_frame+0x11)||undefined reference to `__gxx_personality_v0'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libsfml-window-s.a(Window.o):Window.cpp|| undefined reference to `_Unwind_Resume'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Complaining of 'multiple definitions'.

Somehow, I suspect there's a conflict between the dynamic libraries and the static libraries, IE the dynamic library is already available by default (but I don't know how, as there's no configured settings for it: it's just added to the compiler /include folder etc etc) and the static tries to redefine the pre-existing definitions.

How on earth do I solve this problem and get it to link this specific project statically (without changing the entire dev environment and thus ruining the other dynamically linked projects)?

3
Graphics / Fade out image
« on: November 21, 2013, 05:08:49 pm »
I've got a loaded .png intro image. What's the easiest way to make it fade out to black using timers?

I want to try to avoid real-time image manipulation if possible as I find it resource intensive.

4
Audio / Question on how audio is stored in SoundBuffer
« on: October 29, 2013, 12:44:29 am »
This assumes a SoundBuffer set with a channel count of 2 and a sample rate of 44100.

I'm trying to understand how audio is stored in SoundBuffer. So how are the numbers interpreted?

For example, if I had a sample array that contained 1000 Int16s, how do I know which is pitch, volume, channel, etc?

5
Graphics / Is there a way to take a screenshot of the entire screen?
« on: October 30, 2012, 03:51:35 pm »
What functions, etc would I be looking at?

6
Graphics / SFML 1.6 Colour Issue?
« on: September 01, 2012, 02:07:24 am »
I have a sprite that loads from the image MapLayout, but on display in SFML it takes on a noticeably green tinge:





Why is SFML displaying it as green rather than yellow?

7
General / SFML 1.6 Mouse Coords Conversion
« on: August 31, 2012, 01:21:52 am »
I know 1.6 is 'old school', no worries. I'm aware there are some conversion issues between render window and the mouse coords if render window is resized.

Let's say I have an (invisible to the user) square/rectangular area within the screen, where if the user clicks within the area something happens. What is the best way to implement this so that, if a user resizes the screen, the area checking between both the square/rectangular area and the mouses coords is consistent regardless of how the window is resized? What SFML classes should I use for this?

8
Audio / How do I seamlessly loop recorded sounds?
« on: August 29, 2012, 09:16:43 pm »
I've built a class on sf::SoundBufferRecorder, and it automates the recording, buffering and sound creation process. I want to then be able to play the sounds that it records in a seamless loop. .SetLoop(true) does not give seamless looping. How would I go about doing this?

9
Graphics / Displaying sub-images?
« on: August 23, 2012, 08:13:17 pm »
I have an image file where there is more than one 'sub-image' in the file (like a reel of sub-images). Is it possible in SFML, to load up the image file and only display the individual parts of the image? Is so, how do I do that?

10
Feature requests / IsSocketReady or similar stand alone function
« on: May 27, 2012, 08:28:20 am »
Whilst I know the idea is a bit C-ish, after using sockets on SFML, I've had numerous instances where I wanted to poll whether or not the socket is ready, but without causing a block. As noted, there have been problems with connect, receive in non-blocking which I've discussed previously with Laurent - a call to select or similar is still required for connecting non-blocking sockets (according to MSDN), which is how you poll if a socket is ready or not.

Whilst there is the Selector class with it's wait function - the Selector class is really for multiple sockets, and incurs unnecessary overheads - Adding and Removing sockets, notably. Where-as IsSocketReady (or similar) could easily be a single, direct call to wait that returns a simple boolean. Any element of efficiency is an improvement, and I feel an 'IsSocketReady' (or similarly named function) could be useful inside SFML itself (I've noticed sf:Http's SendRequest might block indefinitely on receive - and polling the socket with a timeout would be a way to solve the problem - but I don't want to incur Selector's overhead).


The function would be simple to implement - it would be a modified version of Selector's 'wait' function designed to take the first argument as a single socket, and the second argument as a timeout value, which returns a boolean value as to whether or not it's ready (returning false if it times out).


Thoughts?

11
Network / HTML etc crashes program when no internet connection present
« on: April 24, 2012, 10:51:21 pm »
I would have assumed that the HTML side of SFML would have a fail-safe (I.E. return NULL string, error state, etc) for not being connected to the internet (given this could easily occur) or when a website is not available (which can also easily occur during downtime).

Given I am trying to run an automated program to automatically download data from a website that doesn't archive data (and both the internet connect and the website can fail)...

How do you check for the lack of an internet connection, and how do you check for whether or not the website is there, without SFML crashing the program? Surely this was a consideration?

12
I am just in the design phase of an improved template dynamic list for use in combination with SFML classes, and I want people's opinion of what they imagine or expect (I want to make it instinctive and more user-friendly):

//What do you imagine these do, and what do you imagine they return?
TemplateList++;
TemplateList--;
--TemplateList;
++TemplateList;
TemplateList = Item;

//What do you imagine this should return?
(!TemplateList)

I have my own ideas of what the functions should do, but I want to see what others think.

Thank you for any feedback.

13
Graphics / Save and load images as animated GIFs
« on: September 01, 2011, 12:10:32 pm »
Is this possible with SFML? If so, how?

Thank you.

14
General / List of 'How do I' questions...
« on: August 23, 2011, 07:05:41 pm »
Although I can't find an FAQ for this sort of thing, maybe there should be a quick-reference FAQ somewhere for this sort of thing. I've got numerous questions and anyone can answer whichever they want:

Graphical:

1. How do I lock an SFML window so it cannot be resized?

2. Is it possible to lock an SFML window so it can be resized, but only diagonally, or within certain limits (EG no bigger than 800x600 and no smaller than 400x500)? If so, how?

3. If I do make an SFML window that is resizeable, what considerations must I take into account? How do I compensate?

4. Can I load models in SFML OpenGL?
4a. What kind of models?
4aa. What tool do I use to create said models?
4b. What function(s)/code would I use to do this?

5. Can SFML OpenGL save/create models? If so, how?

6. How do I find the maximum (current) resolution of the user's screen?

7. Why is there an image resolution limit, if programs like paint, for example, can have larger (and stupidly large) resolutions than that?

Sound

1. Can SFML convert/save between different formats?

Networking:

1. In simplistic terms, what is the 'nagle' problem?

2. Is it possible to send files to other people using SFML?
2a. If so, how?
2b. What considerations do I need to take into account?

Licence:

1. Is SFML (and the various systems it uses) permitted in it's licence to be sold commercially (as part of a software program)?

2. Does it require any modifications be made public or openly available?

Misc.

1. Can SFML compress files?

2. Does SFML have any in-built AI or anything similar?


Thank you for any answers. If I think of any more I'll post them.

15
Network / Help with making a POST request
« on: July 18, 2011, 12:06:36 pm »
I am unfamiliar with the processes behind making a POST request to a website. I get that you need to use SetField, but I am unsure how to particularly use it.

I want to be able to use it with this site here:
http://jobseekers.direct.gov.uk/

To submit a request to search for particular jobs in a particular area [the two fields at the top] (if it's possible to set the other options too I'd love to know how).

Presently, the program I've built will automatically parse the website, grab the re-direct, change the HTML code into characters, and connect to the re-direct but presently I can't get my program to send a POST request to begin the search. So any help on how would be greatly appreciated.

Thank you.

Pages: [1] 2
anything