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

Pages: [1]
1
General / SFML & Qt Error
« on: March 23, 2011, 07:34:05 pm »
Hi!

I am not completely sure this problem is related with SFML AND qt or if it's just random.
I've been programming an application in qt and I was just gonna start the sfml part but whenever I include a
sfml header, no matter what header I chose, I receive this error on line 37 in the file which includes the sfml header:
Quote
1>c:\...\mainwindow.h(37) : error C2143: syntax error : missing '}' before '('

Then you may ask; what's on line 37... Well:
Code: [Select]

// Mainwindow.h
namespace EDIT
{
enum ACTION
{
UNDO,
REDO,
CUT,
COPY,
PASTE,
DELETE // <-- This is line 37
};
}
I have no clue what's causing this problem but any help is greatly appreciated

2
Network / Network Problems
« on: February 11, 2011, 11:54:28 am »
Hi!

Quick question, I need to send data to a server via an UDP connection. I'm using a protocol for counter strike 1.6 to communicate with the server.
For a certain request (retrieving server information) you have to send an info string. This string has to end with x00 but I can't send this x00 since it also terminates the string.

In brief: How to send a data string with an zero at the end? (ex: \xFF\x6A\xGS\x00)

EDIT: I got help on the IRC. For those interested in the solution just add 1 to the string length (Socket.send(string, strlen(string) + 1);

3
Network / Converting Code
« on: January 27, 2011, 09:46:17 pm »
Hi!

I am stuck at this piece of code which I am not quite sure on how I should
convert. For a little background; this script is used with Half Life (GoldSrc)
to retrieve the current map, number of players etc. on the server.

This is the code for the script in ruby:
Code: [Select]
# start querying servers and storing results in the "results" array
servers.each do |x|
x.chomp!
 case x.split(':')[2]
 when "hl"
   begin
    timeout(1) do
     begin
      socket = UDPSocket.new
      socket.connect(x.split(':')[0], x.split(':')[1].to_i)
      socket.send("\xff\xff\xff\xffinfostring \n", 0)
      a = socket.sysread(16384).delete("\xff").split("\\")
      results << "HL/CS: \x037 #{a[20]} -\x036 #{a[22]}\x0313
#{a[6]}/#{a[12]}\x033 IP: #{x.split(':')[0]}:#{x.split(':')[1]}"
     rescue Errno::ECONNREFUSED
      results << "HL/CS Server: #{x.split(':')[0]}:#{x.split(':')[1]} is
down at the moment (connection refused)"
     end
    end
   rescue TimeoutError
    results << "HL/CS Server: #{x.split(':')[0]}:#{x.split(':')[1]} is
down
at the moment (timed out)"
end
#End the HL query

If I understand everything correctly you are supposed to send a string of data
containing "...\xffinfostring..." to a specific address and a port. The problem lies
in the method that this script uses for retrieving this information.

I cannot interpret what socket.sysread means but is it equal to SocketUDP.Listen(port)?

4
D / DSFML2 Problems
« on: October 15, 2010, 10:53:19 pm »
Hi everyone!

I'm using the following test code for my script:
Code: [Select]
module main;

import dsfml.graphics.all;
import dsfml.window.all;
import dsfml.system.all;

void main(string[] args)

{

RenderWindow app = new RenderWindow(VideoMode(800, 600, 32), "SFML D-Test");

while(app.isOpened())
{
app.clear(Color(255, 255, 255));
}
}
I've kept the code minimal to avoid errors though I have one.
Whenever I run the application I am met by the error
Quote
object.Error: Access Violation
An exception was thrown while finalizing an instance of class dsfml.graphics.renderwindow.RenderWindow
Any suggestions?

5
General discussions / SFML & OpenGL (3D Models)
« on: July 22, 2010, 02:15:03 pm »
Hi!

I wanted a straight answer to this question since the other answers were a bit imprecise. So I'll make
it plain; is it possible to use SFML with 3d models if you use openGL calls?

The reason for this is because I will probably need a huge amount of animations and if these are going to
be 2d I'll have a pretty busy life ahead of me painting :(

6
DotNet / WindowsForms | Rendering Class
« on: July 16, 2010, 05:10:39 pm »
Hi!

I've recently started using SFML for the .NET platform and everything has gone smooth so far. Since the reason for
me using SFML with C# instead of C++ is because C# offers (IMO) better support and ease when creating window applications.

As you might all know; to be able to draw in a Windows Form with SFML you have to connect a SFML
device (RenderWindow in this case) with a Window Control. I wanted to do this in a structured way so I chose to make
a class controlling the drawing. So far it looks like this:

Code: [Select]

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using SFML;
using SFML.Graphics;
using SFML.Window;

namespace X_C_Sharp
{
    class SFMLPanel : Panel
    {
        RenderWindow _renderWindow;
        //SFML.Graphics.View _renderView;

        public SFMLPanel() : base()
        {
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            _renderWindow = new RenderWindow(this.Handle);
            //_renderWindow.CurrentView.SetFromRect(new FloatRect(0, 0, this.Width, this.Height));
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            _renderWindow.Clear(new Color(255, 255, 255));
            base.OnPaint(e);
            _renderWindow.Display();

            //this.Invalidate();
        }

        // To be implemented...
        protected override void OnResize(EventArgs eventargs)
        {
            base.OnResize(eventargs);
        }

        public void Draw(Drawable objectToDraw)
        {
            _renderWindow.Draw(objectToDraw);
        }

        public void Draw(PostFx postFX)
        {
            _renderWindow.Draw(postFX);
        }

    }
}

As of now I think this class provides the required functions which I need though there are a few drawbacks which I haven't been able
to solve (the reason for me posting this thread). You can think of this new panel (replacing System.Windows.Forms.Panel) as 2 objects; a layout
and a drawing area (this is where SFML comes into the picture). The problem is that the SFML area i stretched to fit the layout (Panel area).

For example; when I increase the panel size I do not want the SFML area (its size) to stretch but instead increase its size (bigger drawing area).
Currently all pictures and shapes which are drawn is stretched and none of them has the specified size (the size which I specify in pixels).

What I though could be a solution was altering the RenderWindow view (commented out) but all my attempts altering the view has been in vain.
The size of the view seems to be constant (though I just assume since I haven't been working much at all with SFML).

Pages: [1]
anything