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

Pages: [1] 2
1
General / Cannot find or open the PDB file
« on: August 23, 2011, 04:27:25 am »
I get these same errors, AFAIK you can ignore them, they wont interrupt development and im pretty sure it has nothing to do with SFML but rather visual studio (and possibly windows 7) itself.

2
General / Input class cannot copy App.GetInput()
« on: August 23, 2011, 04:24:18 am »
By accessing it directly he means you can just do this:

Code: [Select]
renderWindow.GetInput( ).IsKeyDown( code )

instead of having to store your own external reference to the input object.

3
General / Smoothest methods for movement?
« on: August 23, 2011, 04:17:29 am »
Im not sure if this is what your after, or what you mean by choppy but in platformers I generally add an element of acceleration/deceleration to lessen the binary feel of movement ( i.e. moving at constant speeds and stopping instantaneously)

It goes a little something like this

Code: [Select]

if ( key left is pressed and not key left is pressed )
  velocity -= acceleration factor
else if ( velocity < 0 )
  velocity += deceleration factor
  if ( velocity > 0 )
     velocity = 0

// ^ same for the right key only in the opposite direction
// ...


player x position += clamp( velocity, -4, 4 )


the acceleration does not have to be too slow, infact even a quick acceleration ( reaching max speed in a few frames ) helps, but that depends on your taste for the game.

4
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.

5
DotNet / SFML 2.0 and .NET Binding
« on: July 18, 2011, 11:52:01 am »
Ah! Fantastic, I have it working now! (those files were a bit hidden if you ask me). Works like a dream, just what I was looking for, especially with Tom Millers game loop I can now have some fun creating tools for 2D games :)

Haha good stuff! Keep it up :), your pretty much my only hope at a decent multi-media (mainly 2D rendering) set of APIs for C# haha!

6
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

7
General discussions / SFML Main
« on: October 15, 2009, 03:14:30 am »
Quote from: "OniLink10"
I think the problem might be the "extern" in the main declaration. Put all of that code after your main function and then remove the "extern int main( int argc, char* argv[] );" line.


Already tried that, doesnt work either, also just tested again and no luck.
I also tried putting the lines in a DLL and exporting them but it doesnt seem to work.. I kind of know why it doesnt work but cant put my finger on it..

8
General discussions / SFML Main
« on: October 12, 2009, 07:17:31 pm »
Quote from: "Laurent"
What if you put it in another .cpp file?


Hmmm, that seems to work, although i do still find it rather perculier.
As far as i know it should not make any difference.

9
General discussions / SFML Main
« on: October 12, 2009, 12:35:30 am »
Yes i created a windows application and checked that it was under linker sub-system

odd...

It works when linking to your static library and i checked the the project in the build folder, just to make sure i wasnt missing anything.

so here is the code, as i said i just slapped it into the main .cpp
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

int main( )
{

return 0;
}



But it works if i just link your static library without changing my entry point atall.

10
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

11
DotNet / C# and SFML getting setup?
« on: October 06, 2009, 12:46:05 am »
Quote from: "Laurent"
Why don't you look at the samples provided in the SDK? They show everything that you need.


Ah right, i thought they were in C++..

By the way, when trying to download the .NET bindings, only the direct download gives you the correct files, i usually get the mingw version from sourceforge..

12
DotNet / how to work without renderwindow?
« on: October 06, 2009, 12:38:53 am »
Its not crashing, its just that the main loop is blocking the windows form from monitoring events sent to it.. i have this same problem.

If someone knew of a way to force a winform to monitor events from within a loop that would should solve the problem... kinda

[EDIT!]
Ok so i figured out how to get it setup properly, and working with winforms also its better to start with an empty project when you do this instead of starting a winforms project.

heres the code i have:
Code: [Select]
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace SFML_Application
{
class Window : Form
{
public Window()
{
InitializeComponent();
}

private void InitializeComponent()
{
this.SuspendLayout();
//
// Window
//
this.ClientSize = new System.Drawing.Size(784, 562);
this.Name = "Window";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SFML Application";
this.ResumeLayout(false);

}
}

class SFMLApp
{
static void Main(string[] args)
{
Window Wnd = new Window();
SFML.Graphics.RenderWindow Scene = new SFML.Graphics.RenderWindow(Wnd.Handle);
SFML.Graphics.Shape Rect = SFML.Graphics.Shape.Rectangle(new SFML.Graphics.Vector2(0, 0),
new SFML.Graphics.Vector2(200, 100),
new SFML.Graphics.Color(255, 40, 40));


Wnd.Show();

while (Wnd.Created)
{
Application.DoEvents();
Scene.Clear();
Scene.Draw(Rect);
Scene.Display();
}
}
}
}


If you want to edit your winform, right click on the class that inherits from Form (Window i think) and select view designer.

There.

PS: it was Application.DoEvents( ) that allowed me to monitor events inside a loop.

13
DotNet / C# and SFML getting setup?
« on: October 04, 2009, 11:17:33 pm »
Quote from: "Laurent"
SFML.Net is a binding, which means that it requires the C binaries to work. They are provided in the archive that you downloaded ;)

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

The .Net API is 99% the same as the C++ API.


Yeah i managed to link against them, apparently they need to go in the "bin" folder of your project, anywho im now faced with another problem, how do i create a main loop because whats above doesnt work.

I tried setting the main loop to run when Idle.. but that doesnt work either (its weird and slow)

Ok i found a way to do it that works.. but imo it kinda sucks that it has to be done this way..
http://code.dawnofthegeeks.com/category/c/

Although im not quite sure how SFML window events are handled in C# could i get an example perhaps?

14
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?

15
Graphics / Anti-aliasing, not working correctly
« on: October 03, 2009, 09:28:35 pm »
So yeah, i updated my drivers (thanks for reminding me) and ran the samepl posted above again and i still get the same problem.

Also i ran the opengl sample provided with SFML and that seems to run fine, no slow downs at the start. Call me crazy, but im deffinatly seeing a slowstart / speedup within 1/2 of a second of that sample application.


EDIT: Ooooh, sorry my bad.. the slowstart only happens when running the application from within my IDE ( duh! *feels stupid* ), sorry about that man, anyway keep up the good work :)

Pages: [1] 2