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

Pages: 1 [2] 3 4 ... 6
16
SFML projects / BGB: Bull's Game Builder
« on: October 15, 2008, 09:36:48 pm »
ooh squirell :).. i would love to look at your implementation of it :)

17
SFML projects / Particles!
« on: October 12, 2008, 07:53:49 pm »
Quote from: "coral"
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"

Where are these?
They wasn't included in your package!


where did it complain about theese? i can't find theese includes anywhere in the package i uploaded here: http://www.mediafire.com/?i1hwmluqmgq

18
SFML projects / Particles!
« on: October 10, 2008, 10:47:34 am »
Quote from: "coral"
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"

Where are these?
They wasn't included in your package!


oops some leftovers from my other code.. it should work by just removing them.. i do not believe they are used anywhere... but i will try to get a new package up when i get home :)

19
Window / A time question
« on: October 08, 2008, 08:12:38 pm »
i don't know if you fixed this alredy but i finaly managed to remember to check this whan i was home and able to :)..
The problem is as others have pointed out this row:
Code: [Select]
y += force - offset;

The reason is that your MAX_FORCE constant is not time based .. meaning that when your force reaches MAX_FORCE it will be frame rate depandant and not frame time depandant as you whant it to be :)

so heres a solution:
Code: [Select]

//change it to a static const to keep c++ typesafety
static const float MAX_FORCE = 205.f;
...
//gravity should realy be a constant :)
const float gravity = 31.4f;
...
//and here we make sure it is kept time based
y += (force - offset) * frameRate;


now this should work fine :)

20
Window / A time question
« on: October 01, 2008, 06:12:05 pm »
Quote from: "dabo"
Didn't work. the variable force has already been multiplied with the frame time when we get to that line of code.

Code: [Select]
if(!standing)
force += gravity * frameRate;


strange... oh well i'm heading home from work now i will see if i can have a look at it when i get home ...

21
Window / A time question
« on: October 01, 2008, 04:21:45 pm »
have your tried to multiply this line by frametime as well ?
Code: [Select]
y += force - offset;

might solve it (not that i have look deeply into your code yet but if that doesn't work i will try to do that)

22
General / Help *lol*
« on: September 25, 2008, 05:31:03 pm »
Quote from: "ravenheart"


could i have any problems with that coz laurent said to inherit sf::Drawable  ?


depends on how Laurent have implemented sf::Shape if it has a virtual destructor it should be safe to inherit from.

if you inherit from sf::Drawable you will have to implement all the drawing yourself (using openGL). if you inherit from sf::Shape you also inherit Shapes render code meaning you do not need to implement it yourself :)

sdo i would say you definatly whant to inherit from sf::Shape.. and if that is unsafe you should go with composition :)

23
General / Help *lol*
« on: September 25, 2008, 05:10:27 pm »
Quote from: "ravenheart"
well to have a little solution i added a function

Code: [Select]

Shape get()
{
return Shape;
}

App.Draw(bat.get());



it works but i doubt its best solution


you could also make a Draw function in the bat class

Code: [Select]

class Bat
{
public:
    void Draw(const sf::RenderWindow &rw) const
    {
        rw.Draw(shape);
    }
private:
    sf::Shape shape;
};


or have Bat inherit from Shape

Code: [Select]

class Bat : public sf::Shape
{
public:
    void MySpecialFunc();
};


in the later example you can pass your Bat object to the Draw function of RenderWindow.

so what you need to ask your self is this. does bat have a shape, or is bat a shape. if it is a shape then inheritance is a good solution .. if it has a shape then composition would be the way to go. the rule is to generally prefer composition because inheritance will give you a overhead. usually not noticeable in small projects but still a good thing to keep in mind / know about.

EDIT: wow .. i was realy slow .. 3 posts between my click to ansawer and post :D

24
General / Collision per vectors ?
« on: September 24, 2008, 03:14:04 pm »
Quote from: "ravenheart"
and how can i get the direction from where my ball came? only collision is not enough, i need to know where the ball hit ,
my bat can be moved up down left and right, so i need to know in what direction the ball should bounce



prev_position - cur_positon = direction_vector

a good way of defining how the ball should move would be a direction vector and a speed value. then you just have to read up on some vector math and be ready to go :)

25
General / Collision per vectors ?
« on: September 24, 2008, 11:16:06 am »
Quote from: "ravenheart"
and how do i do it when i want to manage many bricks that disappear when hit?

something like a bool exists?


yeah that will work :). you could also look into managing your objects dynamically in some way this would probably be a "nicer" solution start with checking out std::vector.

26
General / Collision per vectors ?
« on: September 24, 2008, 09:30:33 am »
make a google search for "circle rectangle intersection" or something similar and you should probably get some good results :) but for a breakout clone i think rectangle-rectangle intersections will suffice. And they are dead simple to do :)

27
General discussions / Benchmark : SDL vs SFML
« on: September 22, 2008, 11:22:43 pm »
Quote from: "Ceylo"
Quote from: "heishe"
plus if you use sdl + opengl you don't automatically get this nice oop layout that sfml has.

How do you handle events with SDL and without a loop ?


OOP (object oriented peogramming) not loop ;)

28
Graphics / Layering?
« on: September 22, 2008, 08:29:18 pm »
Quote from: "coral"
Hi, in the process of making a game and it became very clear to me that i need to use a heavy amount of layers.

Is there a function for doing this (like moving the objects in 3d space) or do i need to write my own functions like Layer1() Layer2() which them contains app draw and that?


ther is no built in support for that in sfml (as far as i know anyway) so yes you will have to implement it yourself :)

Quote from: "coral"

And i wondered if there was an easy way of loading VERY EASY models into SFML (in 3D) or opengl from Blender?


Again no this you will have to do yourself. sfml is strictly 2d :)

but it shouldn't be that hard to implement ...

29
General / float precision
« on: September 19, 2008, 04:22:48 pm »
Quote from: "ravenheart"
well now that works, but now i have another prblem:

in out there is the current score, when a new game is started

the timer is at 0.00, when the game befor had lets say 111.11 s, then
in the new game 0.0011 is shown because i only use out.seekp(0) to get new data in it how can i clear a ostringstream ?


you could also create new stringstreams every time :) ..
Code: [Select]

int main()
{
  float myval = 0.5f;
  std::string myval_str;
  {
    std::stringstream ss;
    ss << myval;
    myval_str = ss.str();
  }
}


scopes can have their uses :)

30
Graphics / Re: Topic can be deleted
« on: September 16, 2008, 10:01:44 am »
Quote from: "ravenheart"
2 mins of googling and i found what i was looking for^^
 ( i´m glad i remember anything since the days i learnd c++ =)

out << seekp(0);

was all i needed to add

sry for spamming



that shouldn't be necessary ... this is the function i use and it has worked well for quite some time :)
Code: [Select]

template<class T>
std::string ToString(T val)
{
    std::stringstream ss;
    ss << val;
    return ss.str();
}


you can also go the C way
char buf[64];
sprintf(buf, "%d%, val);

but then you need to watch out for buffer overruns and keeping track of what type val actually is .. so the stringstream version is definitely recommended :)

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