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

Pages: 1 [2] 3 4 ... 7
16
SFML projects / Re: SnakeFML
« on: February 15, 2016, 09:09:55 pm »
What a fantastic game!  ;D

17
SFML projects / Re: Cendric: An RPG Platformer
« on: February 10, 2016, 04:02:20 pm »
That physics stuff just screams out "use Box2D" to me.  But if it's for learning purposes, it makes sense to do it yourself.

I am not convinced this is so straightforward. Box2D offers realistic physics, which is not the physics of classic retro platformers.

18
SFML projects / Re: Cendric: An RPG Platformer
« on: February 05, 2016, 06:43:51 pm »
This is very impressive.

Some minor notes on building:
To get it to compile on linux with gcc5.2 it was necessary to make some changes, namely
- forward declare Slotclone in InventoryEquipment.h
- take some iterators by copy instead of reference (auto rather than auto&)

Will be definitely following development!

19
SFML game jam / Re: Wanna another? (early 2016 edition)
« on: February 03, 2016, 11:50:18 am »
The previous wording was:
Quote
A link to source is required when submitting. (open source is good for the soul, man.)
I took the liberty to clarify it a bit while ensuring maximal usefulness, as code that's just posted somewhere without any license is as good as none, as no one can reuse it for anything (no rights given).

If people have problem with permissiveness and would prefer copyleft, we can probably allow that even though that would disallow quite some uses including using snippets as examples in future books or indie games trying to sell a few copies, unless all sources of such books and games would be released under given copyleft license. (If I'm wrong, just correct me someone, but this is how I understand copyleft.)

This is more or less correct. You can of course get in touch with the author, and they can license it appropriately for you.
(The same applies to code with no license; you can always communicate. Being able to study the code is already quite a useful thing too.)

20
SFML game jam / Re: Wanna another? (early 2016 edition)
« on: February 02, 2016, 01:18:17 pm »
Firstly, I would also be up for a new jam and will participate, subject to it not conflicting with anything else on.

Secondly, I am also in favour of everyone publishing their code, to serve as practical examples of game development with SFML. On the other hand, don't let this become another license debate; don't try to tell me whether I should copyleft it or not.

21
SFML projects / Re: Thor 2.0 released!
« on: January 20, 2016, 06:47:25 am »
You are correct. This reproduces the issue

if (event.type == sf::Event::KeyPressed){
    if (event.key.code == sf::Keyboard::Tab){
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::LShift))
            std::cout << "ShiftTab" << std::endl;
    }
}
if (event.type == sf::Event::KeyPressed){
    if (event.key.code == sf::Keyboard::Tab){
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::LControl))
            std::cout << "CtrlTab" << std::endl;
    }
}
 

I will test this on other OS/desktop. However, Shift+Tab does work fine for other applications (ie Firefox).

Edit: I will also add that the issue persists with this code
if (event.type == sf::Event::KeyPressed){
    if (event.key.code == sf::Keyboard::Tab){
        if (event.key.control)
            std::cout << "CtrlTab" << std::endl;
        if (event.key.shift)
            std::cout << "ShiftTab" << std::endl;
    }
}
 

Update: this was an SFML problem (didn't return the correct code) which has been fixed for a while

22
SFML projects / Re: SFGUI (0.3.0 released)
« on: January 19, 2016, 01:31:58 am »
Firstly, it is redundant, because I know there is a view in the canvas.
Secondly as I already remarked, if I was drawing something on a sf::RenderWindow/sf::RenderTexture and now wish to draw it on a sfg::Canvas, this requires extra work (given that I use the interface of sf::RenderTarget).

Is that all that is missing? I need an exhaustive shopping list before I consider this feature for addition. ;D

  • getDefaultView() and getViewport()
  • 4 map* functions
  • push/pop/reset GL states

These are the differences between sf::RenderTarget and sfg::Canvas at the moment. sf::RenderTarget::getSize() seems covered by sfg::Widget::GetAllocation().
Not sure about GL states, haven't tried mixing SFML and GL drawing on a canvas.
It will be great if sfg::Canvas was indistinguishable from sf::RenderTarget. This may be quite simple now, I don't know. (I had tried this in the past and ran away scared from the internals of the Canvas).

23
SFML projects / Re: Thor 2.0 released!
« on: January 19, 2016, 01:15:03 am »
Hello,

I am looking to implement ctrl+tab and shift+tab shortcuts in an application, with the help of Thor.Input. However, only the former works. This is a minimal example that reproduces the behavior:

#include <Thor/Input.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <iostream>

enum class Action{
    Close,
    ShiftTab,
    CtrlTab
};

int main()
{
    sf::RenderWindow window(sf::VideoMode(800,600),"SFML with Thor");
    window.setFramerateLimit(60);

    thor::ActionMap<Action> actionMap;
    thor::ActionMap<Action>::CallbackSystem system;

    actionMap[Action::Close] = thor::Action(sf::Event::Closed);
    system.connect(Action::Close, std::bind(&sf::RenderWindow::close, &window));

    thor::Action lctrl(sf::Keyboard::LControl, thor::Action::Hold),
                 rctrl(sf::Keyboard::RControl, thor::Action::Hold),
                 lshift(sf::Keyboard::LShift, thor::Action::Hold),
                 rshift(sf::Keyboard::RShift, thor::Action::Hold),
                 tab(sf::Keyboard::Tab, thor::Action::PressOnce);

    auto ctrl = lctrl || rctrl;
    auto shift = lshift || rshift;

    actionMap[Action::CtrlTab] = ctrl && tab;
    system.connect0(Action::CtrlTab, [](){
        std::cout << "CtrlTab" << std::endl;
    });

    actionMap[Action::ShiftTab] = shift && tab;
    system.connect0(Action::ShiftTab, [](){
        std::cout << "ShiftTab" << std::endl;
    });

    while (window.isOpen()){
        actionMap.update(window);
        actionMap.invokeCallbacks(system, &window);

        window.clear();
        window.display();
    }
}
 

CtrlTab appears on stdout everytime Ctrl+Tab is pressed; Shift+Tab does not. Instead, shift key by itself works.
Any clues would be appreciated.

24
SFML projects / Re: SFGUI (0.3.0 released)
« on: January 17, 2016, 01:34:01 am »
Hi,

Now that Canvas has SetView() and GetView(), is there any chance it will also get GetDefaultView() as well as the map* functions?

It has been slightly frustrating how the sfg::Canvas has been approximating the interface of sf::RenderTarget bit by bit but not quite (breaking things when replacing one).

25
To follow up on the matter of Boost.Geometry, I have put some of my efforts here.

sf::Vector2f is adapted to model the Point concept, very simply with the macro BG provides.
sf::FloatRect is adapted to model the Box concept. (the macro can't be used out of the box, as BG represents the Box in terms of bottom left and top right corner, rather than top left and size)

Already by doing these two, it is possible to insert the FloatRect into BG's rtree (a spatial indexing structure like a quad tree). An example of using the tree to determine collisions can be seen in this rudimentary invaders prototype.

The rest is unfinished, as an ideal design is not clear. I think that rather than registering SFML classes as any particular geometry, there should be lightweight 'views' that are registered instead, so that for example a sf::Shape may be viewed as either a filled or unfilled polygon. A sf::VertexArray could be a polygon but also just a linestring, etc

One neat free side-benefit is that registered geometries can be output in pretty text or SVG. For example

sf::FloatRect rect(0.f, 10.f, 10.f, 10.f);
std::cout << bg::wkt(rect) << '\n';

gives
POLYGON((0 0,0 10,10 10,10 0,0 0))


26
General discussions / Re: Logic error handling in SFML
« on: December 01, 2015, 01:53:54 pm »
If I want to deploy a 'release' build that still does some logic error checking, then let me worry about configuring that.

*adds vote for plain assert*

27
Seems like this "hardcore" myth is unkillable ::)

Just to prove how simple and powerful Boost.Geometry is:
namespace bg = boost::geometry;
typedef bg::model::d2::point_xy<float> Point;
typedef bg::model::polygon<Point>      Polygon;

// Create polygon geometry
Polygon polygon;
bg::append(polygon, Point(x0, y0));
bg::append(polygon, Point(x1, y1));
...

// Create point geometry
Point point(x, y);
bool pointInPolygon = bg::within(point, polygon);

And please don't complain about the type definitions, you have them a single time in your code and that's it. On the contrary, this allows you to use arbitrary geometry types. For example, you can easily make everything based on sf::Vector2f, to integrate your entire geometry logic with SFML in a matter of minutes.

Yes, you can make everything based on sf::Vector2f. Have you done this? If so, would you share your efforts with the community by any chance?

I am asking, because this has been on my mind for a while. My own efforts are not quite as polished as I 'd like, i.e. a uniform treatment of sf::Shape, sf::Sprite, sf::VertexArray and user-defined ranges of sf::Vector2f. And it required definining metafunctions.

Not that I disagree with your other points. Boost libraries are not only a way to avoid reinventing the wheel, they are also instructive; some APIs are controversial, even among Boost developers themselves, however there are always reasons why things are the way there are.

On the other hand there is no substitute for the instructive value of hand-implementing something; only then you get to wrestle with the problems and truly understand the implementation, performance considerations as well as interface choices.

28
General discussions / Re: Microbenchmarks
« on: November 05, 2015, 11:02:10 am »
For a start, if you don't hinder the optimizer at all, it will determine that the return values of the functions are not used and so optimize them away entirely. That makes for a superfast benchmark that measures doing nothing  :D

volatile prevents that. It is still possible that the compiler will be able to determine the result of a function and simply write that to the variable, hence Carruth's more involved tricks. Basically, you still compile with optimizations, because you want the benchmark as close as possible to production environment, but you don't want the optimizer to get rid of the code you 're trying to measure.
Inlining is not be prevented, but the inlined instructions should still be there.

These 'microbenchmarks' are a complement, not replacement to profiling.

29
General discussions / Microbenchmarks
« on: November 04, 2015, 08:23:25 pm »
Inspired by , I was thinking SFML could have a suite of microbenchmarks.

I have made a prototype at https://github.com/Kojirion/SFML/tree/benchmarks
This is using GoogleBenchmark as a submodule.



These are of course only a few of SFML's classes. It will be far simpler to have these benchmarks if/when there are unit tests.These
  • highlight the differences between getters that return a value in memory and those that perform a calculation.
  • highlight he difference between flipping an image vertically and horizontally
  • if these functions are refactored, they can serve as indication on how performance is affected

There are some differences to what Carruth did in the talk. He goes on to use perf to determine exactly what is being benchmarked, as well as using an assembly trick to prevent the optimizer from optimizing away the things he's interested in.

I have only gone as far as to use volatile for the return value of functions. This is a different strategy (he gets a question about it towards the end of the talk) and seems sufficient for the moment, as the functions which do not return a value do not appear optimized away (note how he had to put std::vector in the loop, while in what I have written so far, the variables can be defined outside).
But I have not gone through perf/assembly to verify.

And surely it looks pretty.

30
General discussions / Re: Invalid read in KDE
« on: June 29, 2015, 01:22:06 am »
Good.

Pages: 1 [2] 3 4 ... 7
anything