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

Pages: [1]
1
General / Zoom to Point with SFML
« on: August 22, 2011, 07:32:00 pm »
Hello, I have managed to succesfuly implement a zoom to point mechanism using matrix transforms scale and translate. While this all works very well I would like to implement it using SFML methods, because my current technique works from outside of SFML itself and then copies the transformed points back into the shapes that im rendering. The problem with this is that it doesnt integrate well with SFML and can cause some confusing and mostly unneccesary data processing down the line of development.

How it is done:
I create a matrix, translate it to the chosen point of zoom ( in this case the mouse cursor ) so then the cursor becomes the origin, scale from this point and then translate again back to the original position creating desired view matrix, I then extract the points from each shape individually and apply the transformation outside of the class, once the transform has been applied I then reintegrate the points backinto the shape class.

Pseudo/C# code:
Matrix viewMatrix = Identity;
viewMatrix.Translate( mouse.x, mouse.y )
viewMatrix.Scale( zoomFactor, zoomFactor )
viewMatrix.Translate( -mouse.x, -mouse.y )

foreach ( shape in i )
   Transform( i, viewMatrix )


Doing it this way stops me from using the positioning/scaling/rotating properties of the shape class (and I would imagine, though untested the image class (can you even access the points of the texture quad from the image class?? this would be problematic ) )

I noticed that SFML from a client point of view has no notion of matrix/transform multiplication order, (this is irritating haha) otherwise I may have been able to solve the problem a long time ago ( SFML has been getting in the way for a while, it is only recently that I discovered the transform order let down, which is when I was finally able to half solve my problem )...

Question:
Ok this explaination has gone on long enough and is beginning to spiral out of control.. Basically, how can I perform a zoom to point mechanism using SFML? any Ideas? I want to be able to zoom only certain things in the view as I will be rendering a tiled image to clear the screen instead of a colour.

Thank you

EDIT: I tried manually applying the desired translation transform to the shape.origin, while the transform works in and of itself, SFML internals are getting in the way (when i try to scale) so if I could figure out a way to cancel out the change the that scale makes to the origin, I should be set.

2
DotNet / SFML 2.0 and .NET Binding
« on: July 18, 2011, 11:02:13 am »
Hi, so I finally got around to compiling SFML 2.0 and im quite impressed with what ive seen so far, though I have had to implement some win32 work arounds due to lack of functionality in some areas that I was able to work around using SFML, alas my previous work around has been removed.

Anyway, the real reason I wanted to compile and use SFML 2.0 was for the C# binding. 1.6 freezes when creating a RenderWindow, but is otherwise fine in C++, I searched for hours for information on why this is happening and all I came up with was another forum thread here with someone who is experiencing the very same problem, sadly, no reply. I then saw another forum post of a guy who had written a small test application Thanking Laurent in Visual Studio 2010 (the version I have) with C# 2.0 bindings and so I thought that 2.0 might work for me. Unfortunatly I cannot find the bindings for .Net anywhere and Im here to ask for them.

Have they been taken down? If not where/how can I get them?

Thanks

3
General discussions / SFML Main
« on: October 11, 2009, 09:52:30 pm »
Hi, this question is mostly directed at Laurent.
I was wondering how these lines actually work or rather why they work when placed in a static library

Code: [Select]
#if defined(_WIN32)

    #include <windows.h>

    extern int main(int argc, char* argv[]);

    int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT)
    {
        return main(__argc, __argv);
    }

#endif // _WIN32


I tried this myself in the same .cpp as i was calling main but i get an error telling me that main cannot be overloaded. I would just like an explanation please :)

Thanks

4
DotNet / C# and SFML getting setup?
« on: October 04, 2009, 10:12:51 pm »
Hi guys, i wanted to try using SFML with C# so i downloaded the .Net version of the SFML assemblies, added references to them in my project but i get a (what would be in C++) linker error saying it cannot locate the csfml-graphics.dll.

Im a beginner C# programmer having only had a little experiance with the language and creating very basic projects that are quite useless :)
but perhaps someone who has experiance with C# can rectify my problem and also tell me if im doing something else wrong in my code.

Heres the code i have for my form.
Code: [Select]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace Windows_CSharp
{
public partial class Form1 : Form
{
SFML.Graphics.RenderWindow Window;
SFML.Graphics.Shape Rectangle;

public Form1()
{
InitializeComponent();
Window = new SFML.Graphics.RenderWindow(this.Handle);
Rectangle = SFML.Graphics.Shape.Rectangle( new SFML.Graphics.Vector2( 10, 10 ),
  new SFML.Graphics.Vector2( 400, 200 ),
  new SFML.Graphics.Color( 255, 40, 40 ) );

SFML.Window.Event Event = new SFML.Window.Event();
while (Window.IsOpened())
{
// How do i monitor events sent to the window?
Window.Clear();
Window.Draw(Rectangle);
Window.Display();
}

}
}
}


It is structured as close as possible to how i would go about creating the same application in C++ (my primary language being C++)

PS: Why are there no tutorials on .Net(mainly C#) / SFML Development?

5
Graphics / Anti-aliasing, not working correctly
« on: October 02, 2009, 10:55:51 pm »
Hi all, just started using SFML as i needed a simple API capable of creating multimedia applications (such as games) quickly and so far im very impressed.

But im in a spot of trouble here. When i create a png image with anti-aliasing in my image editor and then use it in SFML its not quite as smooth as it was in the image editor.. to give you better idea of what i mean, heres an image of my troubles. On the left we have a screen shot of a ball print screened from my application and on the right is the same ball in my image editor.



Ive tried changing the anti-aliasing settings in the WindowSettings class when creating my window and have also tried to sf::Image::SetSmooth but nothing..

Whats going on here?

Thanks in advance! :D


EDIT: ... Nevermind, seemed as though i needed to sf::Image::SetSmooth( false ), hmm thats going to be annoying... anywho sweet API thanks laurent :D

Pages: [1]
anything