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

Pages: [1] 2 3 ... 6
1
General / Re: rbSFML
« on: July 27, 2012, 06:48:54 pm »
I'm back, using Archlinux this time. When trying to compile I get these errors:
Code: [Select]
[eric@Brictop Groogy-rbSFML-afda8ca]$ rake
Compiling ext/System/main.cpp
In file included from ext/System.hpp:33:0,
                 from ext/System/main.cpp:22:
ext/System/Vector2.hpp: In function 'VALUE rbVector2::ToRuby(VALUE)':
ext/System/Vector2.hpp:119:92: error: taking address of temporary array
ext/System/Vector2.hpp: In function 'VALUE rbVector2::ToRuby(const Vector2i&)':
ext/System/Vector2.hpp:133:76: error: taking address of temporary array
ext/System/Vector2.hpp: In function 'VALUE rbVector2::ToRuby(const Vector2u&)':
ext/System/Vector2.hpp:140:76: error: taking address of temporary array
ext/System/Vector2.hpp: In function 'VALUE rbVector2::ToRuby(const Vector2f&)':
ext/System/Vector2.hpp:147:76: error: taking address of temporary array
In file included from ext/System.hpp:34:0,
                 from ext/System/main.cpp:22:
ext/System/Vector3.hpp: In function 'VALUE rbVector3::ToRuby(VALUE)':
ext/System/Vector3.hpp:120:56: error: taking address of temporary array
ext/System/Vector3.hpp: In function 'VALUE rbVector3::ToRuby(const Vector3i&)':
ext/System/Vector3.hpp:135:79: error: taking address of temporary array
ext/System/Vector3.hpp: In function 'VALUE rbVector3::ToRuby(const Vector3f&)':
ext/System/Vector3.hpp:143:79: error: taking address of temporary array
rake aborted!
Command failed with status (1): [g++ -march=x86-64 -mtune=generic -O2 -pipe...]

Tasks: TOP => default => all => system
(See full trace by running task with --trace)

I did not follow all the instructions from the rbSFML page (I'm using the SFML version from my packet manager), but this does not look like it is the problem here.

2
General / Re: Runtime Errors - WinXP, MinGW (not code::blocks)
« on: July 08, 2012, 11:27:45 pm »
What kind of crash? The usual "An application has stopped working" windows error message?
If that is the case try recompiling SFML. Helped when I got these kind of errors once.

3
Window / Can't get OpenGL to work (SFML2, Windows, mingw)
« on: May 21, 2012, 11:19:29 pm »
After many failed attempts to learn a bit of OpenGL I wanted to try again, this time with the help of SFML. I can't even get simple examples to compile though. This is my test code:

#include <SFML/Window.hpp>

int main() {
        sf::Window app(sf::VideoMode(800, 600), "Test", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 0));
        GLuint buffer;
        glGenBuffer(1, &buffer);
       
        return 0;
}

The compiler complains about glGenBuffer not being declared. Using functions such as "glGetString(GL_VERSION)" works however (and returns the expected result). What am I doing wrong? Did something change from SFML 1.6 so I need to include more headers or is the mistake somewhere in my configuration?

4
General / Steel - Ludum dare entry made using rbSFML
« on: April 22, 2012, 10:15:15 pm »
I just finished a first "release candidate" for my ludum dare game and thought I'd share it here: https://github.com/downloads/thatfreakingguy/Steel/Steel%20-%20Windows%20binary.7z

Story, if you can call that:
After crashing on a strange, small planet made out of steel the only thing in sight is a lever. As you pull it, the planet seems to change...

It's a platformer. Not much more I can say :)

edit: Forgot to post the source: https://github.com/downloads/thatfreakingguy/Steel/Steel%20src.zip. Whatever you do, don't look at it!

5
General / Re: rbSFML
« on: April 21, 2012, 10:54:58 pm »
Changing to floats or using vectors directly did not work. However, adding "sleep 1" or even some lower amount (down to ~0.05) to the end of the loop displays the graphic. Same thing seems to happen when the first few frames take a bit to show up.

I'm not sure what you mean with "doing the state as an array.". Trying to replace
app.draw(vertices, SFML::Quads, state)
with
app.draw(vertices, SFML::Quads, [tex])
does not work due to an conversion error.

Sprite seem to show the same behavior (not having a texture) in this example. They also seem to lose size information and get thin. However in my game sprites worked fine, the texture seemed to be.

Everything works when I declare the RenderState before the loop and only assign the texture once. The texture seems to be damaged when it is attached to a RenderState often.

6
General / Re: rbSFML
« on: April 21, 2012, 10:05:48 pm »
There are still problems. This code paints "img.png" to the screen:
#include <SFML/Graphics.hpp>

int main() {
        sf::RenderWindow app(sf::VideoMode(800, 600), "Vertices Test");
       
        sf::Texture tex;
        tex.loadFromFile("img.png");
       
        while (true) {
                sf::Vertex vertices[4];
               
                vertices[0].position = sf::Vector2f(0, 0);
                vertices[0].texCoords = sf::Vector2f(0, 0);
                vertices[1].position = sf::Vector2f(0, 100);
                vertices[1].texCoords = sf::Vector2f(0, 256);
                vertices[2].position = sf::Vector2f(100, 100);
                vertices[2].texCoords = sf::Vector2f(256, 256);
                vertices[3].position = sf::Vector2f(100, 0);
                vertices[3].texCoords = sf::Vector2f(256, 0);
               
                sf::RenderStates state;
                state.texture = &tex;
               
                app.clear();
                app.draw(vertices, 4, sf::Quads, state);
                app.display();
        }
}
The same in ruby draws a white rectangle:
require "sfml/graphics"

app = SFML::RenderWindow.new([800, 600], "Vertices Test")
       
tex = SFML::Texture.new
tex.loadFromFile("img.png")

while true
        vertices = Array.new(4) { SFML::Vertex.new }
       
        vertices[0].position = [0, 0]
        vertices[0].tex_coords = [0, 0]
        vertices[1].position = [0, 100]
        vertices[1].tex_coords = [0, 256]
        vertices[2].position = [100, 100]
        vertices[2].tex_coords = [256, 256]
        vertices[3].position = [100, 0]
        vertices[3].tex_coords = [256, 0]
       
        state = SFML::RenderStates.new
        state.texture = tex
       
        app.clear()
        app.draw(vertices, SFML::Quads, state)
        app.display()
end

7
General / Re: rbSFML
« on: April 21, 2012, 07:53:07 pm »
I am interested in showing up rbSFML so other users see it. Would you mind having a rbSFML logo on your ludum dare project? =)
I'd love to! Where can I find one? I remember there being some in the "A new logo for SFML" thread (like this one).

I am having a problem compiling the latest version though:
Code: [Select]
Compiling ext/Graphics/RenderTarget.cpp
ext/Graphics/RenderTarget.cpp: In function 'VALUE rbRenderTarget::Draw(int, VALUE*, VALUE)':
ext/Graphics/RenderTarget.cpp:288: error: invalid conversion from 'void*' to 'sf::Vertex*'
rake aborted!
Command failed with status (1): [g++  -O3 -fno-omit-frame-pointer -g -Wextr...]

And i can't find a VertexArray class in rbSFML:
Code: [Select]
irb(main):015:0> puts SFML.constants.sort
BINDING_VERSION
BlendAdd
[...]
Vector2
Vector3
Vertex
VideoMode
View
Window

Speed shouldn't matter that much in this case though, I just need vertices so I can stretch my images over distorted rectangles.

8
General / Re: rbSFML
« on: April 21, 2012, 06:27:45 pm »
Thank you once again for your support and the binding. Ludum dare has so far been been a joy to code, regardless of the currently missing documentation. I'll show something once I have the first "complete" version.

I'm still having problems using vertices though. This is my test code:
require "sfml/graphics"

app = SFML::RenderWindow.new [800, 600], "Vertices Test"

vertices = Array.new(2) { SFML::Vertex.new }
vertices[0].position = [0, 0]
vertices[1].position = [1, 1]

state = SFML::RenderStates.new

app.draw vertices, 4, SFML::Lines, state # Variant 1
app.draw vertices, SFML::Lines, state # Variant 2
Variant 1 doesn't work because 1..3 parameters are expected. Looking at the source code, it appears that the vertex count the array provides is used. So I was guessing variant 2 would work, it leads to a segmentation fault tough. How do I use it correctly?

Also, another request: Also make Vector2 and Vector3 different number types.

9
General / Re: rbSFML
« on: April 21, 2012, 11:51:07 am »
It appears to be impossible to create a new render state. Or am I doing something wrong?
Code: [Select]
irb(main):009:0> state = SFML::RenderStates.new
RuntimeError: can't modify frozen SFML::Transform

Edit: Also, the PrimitiveTypes for drawing vertices don't appear to make sense. They contain 0, 1, 2, true, false, nil and SFML::Quads isn't initialized.
Code: [Select]
irb(main):014:0> puts SFML::Lines
0
=> nil
irb(main):015:0> puts SFML::Points
false
=> nil
irb(main):016:0> puts SFML::LinesStrip
true
=> nil
irb(main):017:0> puts SFML::Triangles
1
=> nil
irb(main):018:0> puts SFML::TrianglesStrip

=> nil
irb(main):019:0> puts SFML::TrianglesFan
2
=> nil
irb(main):020:0> puts SFML::Quads
NameError: uninitialized constant SFML::Quads
        from (irb):20
        from C:/Ruby193/bin/irb:12:in `<main>'

10
General / Re: rbSFML
« on: April 20, 2012, 10:19:19 pm »
I tried out the audio package as well, and found another mystifying thing: When calling a non existent method on a SFML::Music object the program crashes. Not just a simple "undefined method" error, but a full "Ruby interpreter has stopped working" error message. No other classes seem to have this behavior. Playing music seems to work fine for me though (when using the right method).

11
General / Re: rbSFML
« on: April 20, 2012, 06:29:53 pm »
Should it work when I exclusively give floats as arguments? Both these lines give the same error as before:
bar = SFML::Rect.new(0.5, 0.5, 1.to_f, 1.to_f)
bar = SFML::Rect.new(0.5, 0.5, 1.0, 1.0)
I think the type of number shouldn't matter in this case. Usually floats, bignums and fixnums can be used exchangeable, so they should be here as well. I personally think the code I posted looks valid (to me at least) and should therefore work (or, as it's called in the programmer's guide, it should follow the "Principle of Least Surprise". Not being able to use one type of number was a surprise for me). It doesn't feel consistent right now.

12
General / Re: rbSFML
« on: April 20, 2012, 05:05:20 pm »
I've been playing around with rbSFML a bit more and seem to have problems with number types (never thought I'd see that in ruby). When using this test code:
require "sfml/graphics"

foo = SFML::Rect.new(0, 0, 1, 1)
bar = SFML::Rect.new(0.5, 0.5, 1, 1)
puts foo.intersects?(bar)
I get an error:
Code: [Select]
sh.exe"-3.1$ ruby test.rb
test.rb:4:in `initialize': Did not receive expected types ( 'Fixnum', 'Float' ) (TypeError)
        from test.rb:4:in `new'
        from test.rb:4:in `<main>'

What am I doing wrong?

13
General / Re: Samples of SFML 2.0 RC runs very choppy
« on: April 20, 2012, 12:56:40 am »
Currently SFML takes a very long time to check for a gamepad when none is accessible. To fix this you can either plug in a gamepad or follow the instructions in Laurent's post here (requires recompiling SFML though).

It will hopefully be fixed soon.

14
General / Re: rbSFML
« on: April 19, 2012, 09:44:06 pm »
Just downloaded that fix. You seem to have a typo ;)
Code: [Select]
sh.exe"-3.1$ ruby main.rb
c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': undefined method `load_from_tream' for class `SFML::Texture' (NameError)
        from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from main.rb:1:in `<main>'
Either that or I suck at downloading again.

15
General / Re: rbSFML
« on: April 19, 2012, 08:02:15 pm »
Reredownloaded and rerecompiled SFML and made sure that I replace every SFML dll I have on my machine and got it to work.
Thank you for the binding and your support!

I'll try to use this for the upcoming ludum dare. How well do small scale games in ruby perform? I've heard that ruby's garbage collection and it being a scripting language slows down real-time applications quite a bit, but for smaller projects this shouldn't really be problem, right? (Also, sorry if these questions are too off-topic. I don't really know where else to ask them.)

Pages: [1] 2 3 ... 6
anything