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

Pages: [1]
1
Graphics / Make stuff big. Really big.
« on: May 14, 2008, 07:25:11 am »
Well. Yes.
How stupid of me. :P
Thanks. :)

2
General discussions / PostFX - random numbers?
« on: May 11, 2008, 04:26:44 pm »
Make it simpler? :)
Psuedo code:
Code: [Select]

int table[] = { 0,9,1,8,2,7,3,6,4,5 }
int random()
{
  int v = table[i];
  i++;
  if( i > 9 ) i = 0;
  return v;
}

Make the table bigger, is a nice suggestion. :P

But then again, a texture might be a better solution.

3
General discussions / PostFX - random numbers?
« on: May 11, 2008, 03:38:07 pm »
I'm haven't used GLSL at all, ever, but you can still create functions in it? If so, why don't you make your own random function?

It won't be truly random, but there doesn't exist anything remotely like a truly random function on home computers. Yet it might be good enough to do what you want. You can pass values to it from C++ to use as a random seed. I'm sure you would find info about this rather quickly using google.

4
Graphics / Move by Keypressing
« on: May 10, 2008, 02:43:55 pm »
Code: [Select]
  if (Angle > 0)
   {
      Angle += 360;
   }
   if (Angle > 360)
   {
      Angle -= 360;
   }


Let's pretend Angle is 1.
Ok, then we, following the logic above, adds 360 to Angle, since Angle is greater than 0.
Now Angle is 361, and we must now substract 360 from it, making Angle equal to 1. again.

I do believe this is what you should use;
Code: [Select]
  if (Angle < 0)
   {
      Angle += 360;
   }
   if (Angle >= 360)
   {
      Angle -= 360;
   }

Now, Angle will increase by 360 if it is below 0.
And Angle will decrease by 360 if it greater or equal to 360.

5
Graphics / Move by Keypressing
« on: May 10, 2008, 02:26:35 pm »
Code: [Select]
  if (Angle > 0)
   {
      Angle += 360;
   }
   if (Angle > 360)
   {
      Angle -= 360;
   }

Now that doesn't look completley right, does it? ;)

6
Graphics / Move by Keypressing
« on: May 10, 2008, 02:15:14 pm »
Code: [Select]

x = x + cos(angle) * speed;
y = y + sin(angle) * speed;

You might have to convert the angle to radians for this to work.
Cannot remember exactly how, but a quick google should help you on that.

7
Graphics / Make stuff big. Really big.
« on: May 10, 2008, 12:00:42 pm »
Works just great. :)

Got a new little problem...

I have a lot of tiles in one texture and only wants to draw one at a time instead of the whole image. After some digging around in the docs I came up with this. But the result is a bit wrong.

The left one is the one produced by SFML, the right one is what I was expecting.
As you can see, the left one only got half of the edge pixels drawn.

The relevant code used:
Code: [Select]

tiles_gfx = Image.new("tiles.png")
tiles_gfx.setSmooth( false )
tiles = Sprite.new( tiles_gfx )

# ... later in the source

tiles.setSubRect( IntRect.new(0,0,8,8) )
win.draw( tiles )

8
Graphics / [Solved] Loading Images Inside a Thread
« on: May 09, 2008, 04:49:44 pm »
That's one way to do it. :)
I don't think I would need such a function anyway. Was just trying to think ahead a little. :)

9
Graphics / [Solved] Loading Images Inside a Thread
« on: May 09, 2008, 03:26:42 pm »
:shock:

I... I made an contribution? Holy crap!  :lol:

How about a function to create the internal textures right away? Some people might want to know that everything is loaded and ready when the main loop starts. (just to make everyone happy :)

10
Graphics / [Solved] Loading Images Inside a Thread
« on: May 09, 2008, 01:13:40 pm »
Just one idea that popped up in my head while reading this.

How about you load the images into the system RAM instead of the graphics memory? (Like in the good old days)
Add a flag to the image loading functions to let people decide for them self if they want to use this.
Then, when the thread is finished you just call a function that transfers it into graphics memory. Would that work? Or do the image loading code depend much on OpenGL?

Forgive me if it was a silly idea, I'm not that skilled when it comes to lowlevel stuff. :)

11
General discussions / Open Pandora and SFML
« on: May 09, 2008, 12:17:58 pm »
You know what sucks? I saved up some money and ordered myself an GP2X about a year ago. Had tons of problems with the reseller, got almost no replies from them about my order and no sign of the product. After about three months and a filed police report for fraud, it arrived in my mailbox.

Soon after that, the F200 was announced.

... And then Pandora.  :lol:

Anyway, I hope the OpenGL ES port goes well. Would love to play around with it in the future, if I have a machine to run it on. (Doesn't some mobile phones support it? Would rock if I could play a SFML game on mine :))

12
Graphics / Make stuff big. Really big.
« on: May 09, 2008, 10:49:34 am »
Excellent! Will try this out as soon as I get off from work!

Thanks a lot!  :D

13
Graphics / Make stuff big. Really big.
« on: May 09, 2008, 09:52:56 am »
Uhm... Never mind that. Was just checking if you guys were awake.  :oops:

How about the blurriness of the sprites? Can I some how turn off the mipmapping/texturefilter/whateveritis that is causing it? I'm going to try to get some retro feel to it so I want nice crisp pixels. :)

14
Graphics / Make stuff big. Really big.
« on: May 09, 2008, 12:21:48 am »
Hello, found out about SFML not long ago and is trying it out.
I love the ruby language and was happy I found a promising graphics library for it.
Using the prebuilt windows Ruby package, and I have a couple of questions.

First, How can I set up the projection matrix, or whatever it is called, to make the resolution 160x120, and still keep the window size as 640x480.
I tried something like this, but is having some problems.
Code: [Select]
# The graphics mode we want to use
mode = VideoMode.new( 640,480, 32)
# Open up a window
win = RenderWindow.new( mode, "My test", 0 )
# Set up a view
view = View.new( FloatRect.new(0,0,160,120) )

For some reason sprites isn't getting scaled.
I draw them using   win.draw( my_sprite ) and its drawn at the top left, and in its original size.

It also looks a bit blury. (Most likely because of subpixel accuracy or mipmapping or something. I'm not so good at this hardware accelerated thingys :) )

Would really appreciate some help.

If needed, here's what I have at the moment. It's not much but I have only been working on it for an hour or so.

Code: [Select]
require 'RubySFML'
include SFML


# The graphics mode we want to use
mode = VideoMode.new( 640,480, 32)

# Open up a window
win = RenderWindow.new( mode, "My test", 0 )

# Set up a view
view = View.new( FloatRect.new(0,0,160,120) )

# Misc settings
win.showMouseCursor( false )
win.useVerticalSync( true )


# Load images

tiles_gfx = Image.new("tiles.png")
tiles = Sprite.new( tiles_gfx )


# Main loop
done = false
while !done

while e = win.getEvent()
done = true if e.type == Event::Closed or
(e.type == Event::KeyReleased and e.code == Key::Escape)
end

# GFX
win.draw( tiles )

  win.display()
sleep(0.01)
end


Thank you

Pages: [1]
anything