Giter Club home page Giter Club logo

gf's People

Contributors

ahugeat avatar ilohama avatar jube avatar magestik avatar ms-lepol avatar niirozz avatar sherjilozair avatar slooowandfurious avatar thecubeoffire avatar vad3l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gf's Issues

error compiling gamedevframework on ArchLinux ARM with gcc-6.1.1 glibc-2.23-5

I'm not sure about the part of the system that could be related to this issue ?

The system uses

  • gcc 6.1.1
  • glibc 2.23-5

[alarm@alarm build]$ make
[ 0%] Building CXX object library/CMakeFiles/gf0.dir/Range.cc.o
/home/alarm/misc/gf/library/Range.cc:31:19: error: duplicate explicit instantiation of 'struct gf::v1::Range' [-fpermissive]
template struct Rangestd::size_t;
^~~~~~~~~~~~~~~~~~
make[2]: *** [library/CMakeFiles/gf0.dir/build.make:327: library/CMakeFiles/gf0.dir/Range.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:118: library/CMakeFiles/gf0.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

[Widgets] Bug with point to

#18
WidgetContainer doesn't do the job in the pointTo function on resized window....
Have to handle window resizing in it....

Mininum version of the dependencies

For now, the minimum versions of the dependencies are based on Debian stable. Before gf 1.0, a new Debian stable (stretch) will be out with new version:

The question is: do we put these versions as a minimum?

The answer will probably be yes for SDL2, Freetype and Boost but no for CMake (we can rely on an older CMake version for building gf, but which one?).

SDL completion

Hi!
I think that a little function like Keyboard::getKeyFromName() would be nice :)

Rendering Problem with SquareGrid Class

when using the SquareGrid Class when the window is resized the grid is shown twice , if you continue resizing the window the issue is more visible.

this is the code that i used

#include <gf/Event.h>
  #include <gf/RenderWindow.h>
  #include <gf/Window.h>
  #include <gf/Grid.h>
  int main() {
    gf::Window window("GFBattleship", { 500, 500});
    gf::RenderWindow renderer(window);
    gf::SquareGrid  test(gf::Vector2u(50,50),gf::Vector2f(10.0f,10.0f) , gf::Color::White ,1.0f);
    while (window.isOpen()) {
      gf::Event event;
      while (window.pollEvent(event)) {
        switch (event.type) {
                 case gf::EventType::Closed:
                 window.close();
                 break;
               }
    }
    renderer.draw(test);
    renderer.display();
  }
    return 0;
  }

when the window starts
error1

resized

error2

error3
Edit : i didn't clear the window , there is no issue

MacOS Support

I really loved the choices made by this library, but it's unfortunate that it doesn't support macos as of now. Any plans on supporting MacOS in the near future?

Workflow questions

Hello! I've read about this project following a comment on an user from the FastTracker II repo (an issue from it). And there was something curious that I wanted to know about this project in particular.

See, the project advertises itself as "It is not a game engine, it is more something like a framework, similar to libGDX in the Java world." and that is something that I am curious about, because LibGDX, by virtue of its Java heritage, can cross-compile and export on a variety of platforms from a single host/PC to many other OSes or devices. And this is where I am going with this.

What's the official way to release binaries from multiple OSes with this? Could one install something like MinGW on a Linux box and be able to cross-compile and build for Windows? I've noticed from this link (https://gamedevframework.github.io/v1.2.0/build_and_install.html) on the docs that Linux requires GCC or Clang while Windows requires MSVC. No mention of MinGW (be it from MSYS on Windows or from Linux itself)

Lastly. What's the scripting language support for this framework? Or are you meant to work natively with what the examples give? (so, C++)

Cheers!
MetalMaxMX

Unable to compile 101 from the wiki

Hi there,

I installed gf and tried compiling the simplest program with it but it seems cmake can't find gf::gf0.

Here is my project structure, alternatively I put it on a repo

.
├── assets
├── build
├── CMakeLists.txt
├── include
│   └── main.hpp
└── src
    └── main.cpp

when I try to cmake .. from the build directory I got this message :

-- Found GF (version "0.17.4") in /usr/local/lib/cmake/gf with components: graphics;core
-- Configuring done
CMake Error at CMakeLists.txt:11 (add_executable):
  Target "Spaceformer" links to target "gf::gf0" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.10)

#set(CMAKE_BUILD_TYPE Debug)

project(Spaceformer VERSION 1.0.0)

find_package(gf REQUIRED)

include_directories(${PROJECT_NAME} "include")

add_executable(${PROJECT_NAME}
        src/main.cpp
)

target_link_libraries(${PROJECT_NAME}
       gf::gf0
)

Here are some info on my system :

ArchLinux

  • sdl2 2.0.12-2
  • boost 1.72.0-2
  • freetype2 2.10.2-1
  • zlib 1:1.2.11-4
  • cmake 3.18.2-1

Cmake generating only x64 build for windows on develop branch

Hello,

When generated files with Cmake, he generated only a configuration for x64 on windows.

My version : Windows 10 and Cmake 3.17.0-rc3 and Visual Studio 2019

If it's should be like that, maybe update the documentation for windows and use .\vcpkg install sdl2:x64-windows freetype:x64-windows boost:x64-windows zlib:x64-windows instead .\vcpkg install sdl2 freetype boost zlib because vcpkg only install x86 packages if not defining it.

Custom shader and builtin variables

Hi,

I am trying to write a shader (taken from there, see attachment) to display a grid (as an alternative to gf::SquareGrid) but I get a bunch of OpenGL errors every frame.

[2019-01-24 13:35:11.362051][Warn] Uniform not found: 'u_texture'
[2019-01-24 13:35:11.362092][Warn] Attribute not found: 'a_color'
[2019-01-24 13:35:11.362108][Error] Error in OpenGL call:
	Location: /xxx/gf/library/graphics/RenderTarget.cc:273
	Expression: glEnableVertexAttribArray(colorLoc)
	Error: GL_INVALID_VALUE
	Description: A numeric argument is out of range.
[2019-01-24 13:35:11.362121][Error] Error in OpenGL call:
	Location: /xxx/gf/library/graphics/RenderTarget.cc:281
	Expression: glVertexAttribPointer(colorLoc, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), colorPointer)
	Error: GL_INVALID_VALUE
	Description: A numeric argument is out of range.
[2019-01-24 13:35:11.362148][Error] Error in OpenGL call:
	Location: /xxx/gf/library/graphics/RenderTarget.cc:291
	Expression: glDisableVertexAttribArray(locations.colorLoc)
	Error: GL_INVALID_VALUE
	Description: A numeric argument is out of range.

They originate from the fact that I don't use u_texture in the fragment shader, so while this uniform is present in the shader code, it is probably removed by the GLSL compiler. So, when GF sets the uniform every frame, it fails. The same issue also occurs with the vertex shader and a_color.

Could GF only set these uniforms if they are present in the compiled shader code?

OS: Ubuntu 18.04
GF version: v0.11.0

PS: the contribution guidelines indicate that I should add the "Bug" tag to this issue, but I would need write permissions on this repository to do that.
PS: this framework is great!

shader.vert.txt
shader.frag.txt

typo in AUTHORS.md

Hello ,

i believe there is a typo in authors , the word developpers has an extra p it should be developers.

gf_pong game not running

when i run gf_pong the window crashes and the following assertion is displayed
gf_pong: /path/to/gf/gf/library/graphics/View.cc:139: void gf::v1::View::setViewportNoCallback(const RectF&): Assertion `isClamped(viewport.left)' failed.

Os : Ubuntu mate 18.04
gf version : gf 0.13.0 (tested master branch and the develop branch )

sprite.png missing in examples

First thanks a lot for your nice game framework!
I looked a lot for a 'multimedia' framework that work on OpenGL ES. Most functions seems here for base of development :).

I tried all the examples, and the last one has a missing sprite.png file. This file isn't in the source tree either.

cd /usr/local/share/doc/GF/examples
./99_index
[1471371209][Debug][Graphics] Shader loaded from file: '/usr/local/share/gf/shaders/default.vert'
[1471371209][Debug][Graphics] Shader loaded from file: '/usr/local/share/gf/shaders/default.frag'
[1471371209][Debug][Graphics] Shader loaded from file: '/usr/local/share/gf/shaders/default.vert'
[1471371209][Debug][Graphics] Shader loaded from file: '/usr/local/share/gf/shaders/default_alpha.frag'
[1471371209][Warn][Graphics] Could not load image from file 'sprite.png': can't fopen

Build is broken.

Project can't be build:

CMake Error happens after cd build, cmake ../ -DGF_BUILD_GAMES=ON -DGF_BUILD_TOOLS=ON
Could not find SDL2 include directory

Ubuntu 20.04 (WSL)

Add game widgets

Based on an idea from @Xeryko

The idea is to add simple game widgets like buttons with text, or simple text or simple images. This issue is a place for discussing the design of this enhancement.

First each widget has a state.

enum class WidgetState {
  None,
  Hover,
  Selected,
  Active,
  Disabled,
};

Then the basic widget class which has a render() method similar to gf::Entity.

class Widget {
public:
  virtual void render(RenderTarget &target, const RenderStates &states);
  virtual RectF getGlobalBounds() = 0;

  void setFocus();
  void setHover();
  void setDisabled();
};

Then an activable widget is a widget that can be activated (either by a mouse click or by a gf::Action) and that calls a function when triggered. Not sure about this one (maybe it should be merged with Widget)

class ActivableWidget : public Widget {
public:
  void setActive();
  bool isActive() const;
private:
  Action& m_action;
  std::function<void()> m_handler;
};

The widget container handles mouse events and dispatch them to the widgets.

class WidgetContainer {
public:
  WidgetContainer(RenderTarget& target, View& view);
  void processEvent(const Event& event);

private:
  RenderTarget& m_target;
  View& m_view;
  std::vector<Widget*> m_widgets;
  Action *m_nextAction;
  Action *m_prevAction;
};

Finally, an example of Widget.

class TextWidget : public Widget {
public:
  virtual void render(RenderTarget &target, const RenderStates &states) override;
  virtual RectF getGlobalBounds() override;
private:
  Text& m_text;

  Color4f m_disabledTextColor;
  Color4f m_disabledOutlineColor;
  float m_disabledOutlineThickness;

  // ...
};

example 7 no red square

the example doesn't show a red square (line 72) ,it might be a replication error from the previous example
because the source file doesn't contain any code to create a square

on ubuntu mint 18.04 , using clang version 6.0.1 .

Colors

Trying to assign a grey color to a font seems not workinig.
I only have a white or a black color result.

[Doc] Git feature

Hello,

In the documentation, there's a simplier way to clone the repository :

git clone https://github.com/GamedevFramework/gf.git
cd gf
git submodule update --init
mkdir build
cd build
cmake ../ -DGF_BUILD_GAMES=ON -DGF_BUILD_TOOLS=ON
make

can be change to :

git clone --recursive https://github.com/GamedevFramework/gf.git
cd gf
mkdir build
cd build
cmake ../ -DGF_BUILD_GAMES=ON -DGF_BUILD_TOOLS=ON
make

Port Swoosh to gf

Swoosh is an "SFML Activity and Segue Mini Library". It allows to easily create transition screens.

Maybe it's related to #31.

Adding Outline to RectangleShape removes texture

is it normal that when i add setOutlineThickness to a RectangleShape object with a texture the texture is not displayed and the texture is replaced by white background ?
this should work according to the documentation , but it's possible i misunderstood the document

here is my code :

gf::Texture testTexture;
  if (!testTexture.loadFromFile("testTexture.png")) {
    return -1;
  }

gf::RectangleShape tile;

tile.setSize({ 75.0f, 75.0f });
tile.setOutlineColor(gf::Color::Blue);
tile.setOutlineThickness(2);
tile.setPosition({10 + (tile.getSize().width + 2), 10 + (tile.getSize().height + 2) });
tile.setTexture(testTexture);

}

Error when trying to build develop branch of GF on windows

Hello,

When trying to build develop branch of GF on windows, visual studio tells me the error :

RandomBinaryTree.cc(140,18): error C2039: 'runtime_error': is not a member of 'std'

Added #include <stdexcept> at the beginning of the file, but not sure if it's the correct solution.

Windows 10 and Cmake 3.17.0-rc3 and Visual Studio 2019

memory leak?

Texture.h

line 339
class GF_API Texture : public BareTexture {
};

line 67
class GF_API BareTexture {
public:
BareTexture(Format format);
~BareTexture();
};

Texture's parent class is BareTexture, but the destructor of BareTexture is not virtual

Multiple windows

Is it possible to render to multiple windows with gf? If so, how should it be done?

I have tried making a simple test application with multiple windows, however I am able to render only to the most recently created window, and it is not recognizing the events properly.

#include <gf/Color.h>
#include <gf/Event.h>
#include <gf/RenderWindow.h>
#include <gf/Window.h>

int main() {
    gf::Window window("window", {640, 480}, ~gf::WindowHints::Resizable);
    gf::Window window2("window 2", {640, 480}, ~gf::WindowHints::Resizable);

    gf::RenderWindow renderer(window);
    gf::RenderWindow renderer2(window2);

    while (window.isOpen() || window2.isOpen()) {

        if(window.isOpen()) {
            gf::Event event;
            while (window.pollEvent(event)) {
                switch (event.type) {
                    case gf::EventType::Closed:
                        window.close();
                        break;
                    case gf::EventType::KeyPressed:
                        if (event.key.scancode == gf::Scancode::Escape) {
                            window.close();
                        }
                        break;
                    default:
                        break;
                }
            }

            if(window.isFocused()) {
                renderer.setActive();
                renderer.clear(gf::Color::Red);
                renderer.display();
            }
        }

        if(window2.isOpen()) {
            gf::Event event2;
            while (window2.pollEvent(event2)) {
                switch (event2.type) {
                    case gf::EventType::Closed:
                        window2.close();
                        break;
                    case gf::EventType::KeyPressed:
                        if (event2.key.scancode == gf::Scancode::Escape) {
                            window2.close();
                        }
                        break;
                    default:
                        break;
                }
            }

            if(window2.isFocused()) {
                renderer2.setActive();
                renderer2.clear(gf::Color::Blue);
                renderer2.display();
            }
        }

    }
    return 0;
}

Example 40 arrow not in the right place

Hello ,

in example 40_ui ,when scalable, no scrollbar and scale Left check buttons are checked in the same time, the arrow for scaling the window doesn't show in the right place , border check button doesn't seem to affect this problem .

on ubuntu mint 18.04 , using clang version 6.0.1 .

screenshot at 2018-05-28 22-09-33

gf::BasicText not updating correctly his local bounds

Hello,

gf::BasicText not updating correctly his local bounds, when using alignment.

gf::TextWidget basicText("Hellooooooooo ? test", m_Font);
basicText.setDefaultTextColor(gf::Color4f(1,1,1,1));
basicText.setPosition({150.f, 100.f});
basicText.setAlignment(gf::Alignment::Center);
std::cout << basicText.getLocalBounds().getWidth() << " " << basicText.getLocalBounds().getHeight() << std::endl;

target.draw( basicText, states);

When you are executing this code in a render function, you will be able to see the getWidth() function not returning a correct value, in this case 0.
But if you use setParagraphWidth and set his value to 1.
You will be able to see the getWidth() return 1.

Bug_gf::BasicText

Sounds like width is calculated from paragraph width instead with letter.
Paragraph width calculation is correct when the paragraph width > letter width.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.