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 - acrin1

Pages: [1]
Graphics / Combining image components into single image
« on: September 25, 2011, 02:54:09 pm »

I'm writing a RPG style game that has an on screen list of statistics in rows and columns and an onscreen auto-map. I'm building both of these screen components from an image file using the subRect command - one image contains a bitmap font, the other small map symbols to build a map. I'm rebuilding both of these display elements every frame along with a 3D view created using OpenGL. I've noticed this is starting to slow down the 3D view a bit.

My question is whether I can combine these small image elements into another image before displaying it on the screen as a sprite. As currently  I'm rebuilding the stats and map displays every frame when I know the information won't be changing that frequently. Apologies if I'm missing something obvious.


SFML projects / Alternate Reality - Remake Project
« on: June 20, 2008, 01:42:57 pm »

I'm currently working on a remake of the 1980s CRPG Alternate Reality using SFML and C++. Originally planned as a series of 7 scenarios only the first two were ever created - The City and The Dungeon.

I'd previously started a remake using SDL but have recently switched over to SFML which has made a number of things much easier for me. Currently I'm concentrating on just putting basic functionality in place and the original Atari 8bit graphics are being used but eventually there will be a choice of enhanced graphics and sounds as well.

I've put up a brief page which contains a basic download at:


This is really only a brief demo of walking around the first level of the Dungeon scenario but I'll be adding other features shortly such as combat and special locations.

If anyone can suggest how I might fix the Open GL issue of a border line for transparent arches showing up please let me know.



Audio / Delays / program locks after playing sounds
« on: June 04, 2008, 12:14:23 am »
I recently added some sounds to my current project and noticed that there were some very brief delays in my display and then several seconds later a much longer pause  - basically the program locks up for a few seconds. It was very noticeable as it's a scrolling 3D view drawn with OpenGL. I'm tried WAV and OGG files and the result is the same. The sounds themselves seem to play fine.

I've tried adding a simple sound to play in the SFML OpenGL example of the white cube and got the same results. I added these lines just before the start game loop:

sf::SoundBuffer doorBuffer;
sf::Sound doorSound;

I'm using Windows XP, the latest SVN and Visual Studio. I haven't had the chance to test this on another PC yet.


Graphics / Using GetRect and GetWidth to find string pixel width
« on: May 24, 2008, 05:27:01 pm »

Could somebody provide me with a simple example of how I can obtain the pixel width of a sf:string object please? I see that there is a string GetRect method which I'm guessing can be used (with the Rect GetWidth method) to achieve this.

I'd like to use these to centre some text and menus.

Many thanks.

Graphics / RenderWindow not showing OpenGL elements
« on: May 17, 2008, 05:17:07 pm »
#include <SFML/Graphics.hpp>
#include "display.h"

sf::RenderWindow App(sf::VideoMode(800, 600), "SFML OpenGL");

void mainLoop()
   ...my code...

Defining my RenderWindow outside my functions as above is causing me a problem - only my 2D SFML drawing is working (fonts, images). My OpenGL stuff doesn't show up. I'm wanting to be able to refer to App from numerous different functions.

Am I doing something wrong?


Graphics / OpenGL and SFML 1.2
« on: January 18, 2008, 03:11:17 pm »

I'm wanting to setup an OpenGL viewport within my game of say a quarter of the screen and use SFMLs graphics features to be able to draw on top of this area and within the rest of the game window

In SFML 1.1 this worked just the way I've described but I've noticed with 1.2 that any images or text I display are scaled down and drawn within the OpenGL viewport.

Is this by design?

Oh and the improvements to fonts look great!


Window / Reading key presses into a String
« on: November 25, 2007, 04:09:59 pm »

I'm wanting to read in single key presses, do some error / special key checking and add the valid key presses to a c++ string. The string would be a mixture of upper and lower case letters and other symbols. Is there a simple way to do this rather than me having to check explicitly for every unique key like so?

if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::L)) myString = myString+"L"

I've looked in the documentation but it wasn't obvious to me how to do this.

In SDL I've been able to do the following in the past:

if ( event.type == SDL_KEYDOWN )
 if (( event.key.keysym.unicode < 0x80 ) &&
( event.key.keysym.unicode > 0 )) // it's printable
 keyString = (char)event.key.keysym.unicode, 1;
I also noticed that only there only seem to be lower case letters defined currently. Does this mean I can't differentiate between upper and lower case input?


Window / Reading single key presses
« on: October 21, 2007, 11:01:22 am »
I'm reading the keyboard like so:

if (App.GetInput().IsKeyDown(sf::Key::F11)) ToggleInsMode();
if (App.GetInput().IsKeyDown(sf::Key::F10)) ToggleItemMode();

This is working ok but this method is reading the key continuously until the key is released. What's the best way to read a single keypress or turn off the continuous reading of keys?


SFML projects / Demon's Eye
« on: October 13, 2007, 06:35:51 pm »

I've been a big fan of the old tile based style RPGs for a number of years and finally decided to have a go at creating one myself using SFML.  So far I've just started working on a map editor so the design is still at a very early stage and many things are likely to change over the coming months. There are screenshots and a record of my efforts to date here:


So far using SFML has been a very pleasant experience. I've been surprised by how few SFML problems I've actually had. Hopefully in the next month or two I might have an early demo version available. Any feedback or suggestions welcome in the meantime.

Window / Disabling anti-aliasing
« on: September 19, 2007, 08:22:25 pm »

I've noticed that by default anti-aliasing seems to be turned on. I looked in the documentation and thought that setting the renderwindow aliasing value to 0 would disable it.

sf::RenderWindow App(sf::VideoMode(800, 600), "RPG", sf::Window::Fixed, 0 );

Am I misreading the documentation? The reason I'm asking is because I'm using small tiles (32x32) and they look better without any smoothing.


Graphics / OpenGL and SFML Graphics in a single window
« on: August 30, 2007, 02:03:06 pm »

Apologies if this is a silly question. Is is possible to draw an OpenGL 3D view in an SFML window but use SMFLs 2D graphics functions in the same window? E.g. for displaying text or overlaying sprites.


Graphics / Font Tutorial Problems
« on: August 28, 2007, 03:12:17 pm »

I'm really interested in SFML but I've been having some problems getting some of the tutorials to work. I'm using Visual Studio 2005 Professional. For example with the font tutorial I've a few questions.

What libraries should I be specifying in the Linker/Input settings and in what order?
Does the arial.ttf file need to be in the same folder as the .exe?

I can get the program to compile ok but it won't run - see below.


1>------ Rebuild All started: Project: sftest2, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'sftest2', configuration 'Debug|Win32'
1>Compiling manifest to resources...
1>sfml-graphics.lib(RenderWindow.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Generating code
1>Finished generating code
1>Embedding manifest...
1>sfml-graphics.lib(RenderWindow.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Generating code
1>Finished generating code
1>Build log was saved at "file://c:\Files\sftest2\sftest2\sftest2\Debug\BuildLog.htm"
1>sftest2 - 0 error(s), 4 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Are these warnings anything to worry about?

If I try to run the compiled program without debugging I get a sftest.exe failed to run / encountered an error style Windows message.

If I run it in debug mode I get an unhandled exception and memcpy.asm appears along with call stack information.

Unhandled exception at 0x10232014 (msvcr80d.dll) in sftest2.exe: 0xC0000005: Access violation writing location 0xcccccc00.

Sorry for all the questions but I'm not that familiar with VS2005 either but I seem to be able to use it with SDL/OpenGL without any major problems and I'm keen to try SFML properly.


Pages: [1]