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.

Messages - Dig

Pages: [1] 2 3
General / Scrolling Enemy with map
« on: August 24, 2010, 05:42:15 am »
Unless I'm confused about what you are using Mappy for it all should play nicely with Views I'm sure.

We use Mappy just as a tool to make the levels, saving them out in a text format that is then read by the engine.  It should be your game that manages culling on and off screen tiles.  I've noticed there are 'playback' libraries for Mappy, maybe thats what you are used to for allegro?

I'd suggest loading the map data into your SFML game and managing loading and displaying sprites from there are you would get to use views.  Views are the best solution for what you are wanting to do.

If you have to change the position of everything everytime the screen scrolls you'll have lots of problems later on managing the locations of things.

General / Adding GetX and GetY to drawable
« on: August 14, 2010, 01:03:43 pm »
The main reason I'm not using luabind is that it would be the only part of my engine that requires boost.  

I'll add properties using external functions similar to what you are suggesting.

Hopefully I'll dream up something clever so I can access (read / write) position as a property I like the idea now:

Code: [Select]
mySprite.position.x = 200
otherX = mySprite.position.x
mySprite.scale.x = 2.0
otherScaleX = mySprite.scale.x


General / Adding GetX and GetY to drawable
« on: August 14, 2010, 12:04:30 am »

Anyway, I'm not going to add two functions just to suit your needs Wink

Wouldn't expect you to this is why its not a feature request.

I'm using lua and tolua++

What I'm wanting to achieve is something like:
Code: [Select]
if mySprite.x < 200 then

Or whatever, with the SetX() method you can do assignment (and map the property to the SetX() method so that works).  

Code: [Select]
mySprite.x = 200

But with no GetX method then I can't read the x position without using:

Code: [Select]
if mySprite:GetPosition().x  < 200 then

The problem is more the symmetry of it I guess.  And one of the reasons for adding a scripting layer is to be able to access SFML and my engine specific code with a simplified syntax.  Get a vector if I want a vector, get a single axis if I only want a single axis.  sf::Drawable already has this to some extent (SetPosition, SetScale takes a vector or two floats, and there are SetX and SetY, SetScaleX and SetScaleY methods).  But stops short for some reason (no GetX or GetY, no GetScaleX or GetScaleY  methods).

I'm sure there is a good reason for it, everything in SFML is clear, concise and well thought out, however I'd like those accessor functions.

I can of course hand code some helper functions at the binding level to make the position directly readable but was wondering if there is a way to 'hook' into a class at that level and add methods...

Maybe its more a C++ archeture questions than a SFML specific question.

Or maybe its too early on a Saturday for me  :roll:

NOTE - After writing all of this I realised could bind it so that we have:

Code: [Select]

for getting and setting using the existing methods and that would actually suit me fine.  I'd still be curious for an approach to add methods to a base class (its probably not possible) but I can work with how things are for now.

General / Adding GetX and GetY to drawable
« on: August 13, 2010, 10:35:11 pm »
I haven't put this as a feature request because I don't know how important it is to anyone else.

I'd like to have GetX() and GetY() methods in drawable because it then provides symmetry with the SetX() and SetY() methods which then can translate to properties in my scripting language (does that make any sense)

If I subclass drawable to add these then that won't work for Sprite, Text, Shape as of course they inherit from Drawable not my new Drawable.

Is there a sensible way to do this without modifying the SFML source?  Or is adding these methods to sf::Drawable directly the only real way to do it.

Any pointers on this would be great.


Window / Clear the Input
« on: August 13, 2010, 10:10:50 pm »
sf::String is now sf::Text I believe (which is a much better name).

General / How to link SFML statically (GCC/MinGW)?
« on: August 13, 2010, 03:58:13 am »
the static libraries have -s at the end of their name,

so maybe:

Code: [Select]
g++ main.cpp -o test.exe -lsfml-window-s -lsfml-system-s

would work?

Graphics / SFML Graphics, or Box2D
« on: August 04, 2010, 10:24:44 am »
It might not be the framerate but it seems the most likely culprit.

There is no way SFML can make enforce a FASTER frame rate than your computer can render so setting the frame rate caps it.  You don't want to set the timing of your game based on framerate or vertical sync.

Actually right here in the SFML tutorials is a useful article on this:


I've been away from SFML too long :)[/code]

Graphics / SFML Graphics, or Box2D
« on: August 04, 2010, 02:10:34 am »
This can't be the full listing as ball isn't defined anywhere.

My guess would be that the ball is moving a set amount each call to ball.move().  As this is called in your drawing loop then your ball's speed will vary with frame rate.

simple fix is pass a frame rate to move and adjust how much you move accordingly.  Better fix is to update based on frame rate and draw at a fixed rate:

This might help

General / Trouble with the collision code from the wiki
« on: July 31, 2010, 04:25:30 am »
Hard to tell without seeing what you mean by 'slightly'.  Both collision tests return true when the box or pixels actually overlap.  So if you mean intersect 'slightly' by 1 pixel then that is the collision you are looking for.

Also in my code the pixel perfect test takes three parameters, the thrid being the alpha limit to register a hit, if your sprites have antialiasing its worth tweaking this to get the result you are looking for.

Hope that helps, post some more code or some screenshots to help illustrate the problem further if you need.

General / Errors on exit with SFML2 examples
« on: May 11, 2010, 12:04:08 am »
Yes indeed, sorry should've mentioned that, 64-bit Windows 7, 32-bit windows XP.

Executable builds on both machines and runs on both (i.e., the windows 7 executable runs on the windows xp machine fine and vice versa).

Error only occurs when its built and run on windows 7 and occurs in any app that opens a window.


General / Errors on exit with SFML2 examples
« on: May 10, 2010, 09:07:44 am »
Hmm... Something very strange is happening.

I built it all again from today's svn trunk on windows XP (Code::Blocks, MinGW) and it works without error.  The executable can be run on my Windows 7 machine without error as well.

But the executable built on Windows 7 has the error.  

For some reason I can't build the current trunk on the Window 7 machine.

My suspicion is I have a dodgy configuration somewhere along the line.  If I can pinpoint it further I'll update you all.

Got it built on Windows 7 and it has an error on close, the minimal code is just:
Code: [Select]
int main()
    // Create the main window
    sf::Window App(sf::VideoMode(640, 480, 32), "SFML Window");

    return EXIT_SUCCESS;

Window opens and closes immediately with an error.  Copying the same executable to my Windows XP machine the window opens and immediately closes with NO error.  Same program built on Windows XP has no error on either machine.

I'll keep investigating...

General / Errors on exit with SFML2 examples
« on: May 08, 2010, 11:18:02 am »
It happens with all the graphic samples built without modification from the Code::Blocks project (SFML2).

Doesn't happen with the console samples (voip, networking etc.,).

I'll play around further in the morning and see if I can get a minimal example together.  I'm on a different computer at the moment and don't want to install Code::Blocks (and I haven't made and contributed MinGW makefiles yet :) ).


General / Errors on exit with SFML2 examples
« on: May 02, 2010, 11:44:10 pm »
I've built the SFML2 libraries and examples from the code::blocks project (why can't we have MinGW makefiles??).  They run fine but have errors on exit (this program needs to be closed etc.,).  

This looks like a return of the bad old default font error that I thought I read was fixed.  Is there something I'm doing wrong here, or has it returned and will be fixed before the official release of SFML2?

Running Windows 7 if that makes a difference.


Network / SocketUDP::Receive Buffer
« on: June 16, 2009, 09:27:02 am »
Can't you send your data from Lua to a C++ function, and build/send your sf::Packet from there?

In my initial attempts about six months ago it was difficult to be generic enough with this approach, but I might be wiser now so I'll give it another go.  I'd prefer it to use sf::Packet.

Your other information certainly helps sort things out, I'll keep plugging away with it all.


Network / SocketUDP::Receive Buffer
« on: June 09, 2009, 11:57:39 pm »
Being new to this low level network programming there is something I'm not 100% clear on here and I have an inkling its causing me big performance problems.

I can't use the sfml Packet because all the SFML functions in my engine are wrapped in Lua and Lua doesn't have a suitable method of packing data into a Packet, so I've written my own lua equivalent and then use the raw reads and write to send it.  It works but its very slow and unreliable even on a LAN.

ANYWAYS, because I don't know how big the received data is I've made a buffer that is bigger than I'd ever expect it to be (4k!!) and then called receive as usual:

Code: [Select]
Socket.Receive(Buffer, sizeof(Buffer), Received, Sender, Port

Is there a performance hit by using large buffers even if the packet are  the same size (about 20 bytes, rather than 4096 that is the size of the buffer)?    Is the rest of the buffer filled with undetermined data or does it wait until the buffer is filled before returning a full 4096 bytes worth of data?  Is it automatically a null terminated char array thats received or should the sender ensure that a null character is added?  is the null character even taken into account?

I'm lost and confused.


Pages: [1] 2 3