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.


Topics - Putarda

Pages: [1] 2
1
Graphics / Is it ok to reverse y axis?
« on: June 04, 2017, 09:26:14 am »
So I found that SFML is using conventional coordinate system where -Y goes up and +X goes right. But since my game engine classes are based on normal coordinate system (conventional mathematical coordinate system), the reverted Y axis is breaking them. Should I reverse Y axis, and is this idea wrong? And how can I reverse it. Thanks :).

2
General / How to make installer for my game?
« on: May 29, 2017, 09:16:44 pm »
How can I make an installer that will install all my game files and install latest VC++ redistributables? And what about OpenAL and it's license? Thanks :).

3
General / How to make game logic independent of fps? [SOLVED]
« on: May 21, 2017, 10:15:01 am »
In my game engine, the whole logic and draw is repeating in while loop. The problem is, if someone has big fps, his game logic will go faster than someone who has small fps. How can I make my game logic independent of fps? Thanks :).

4
Hello everyone :). So after months i finally got my engine done. Engine uses SFML 2.4.1. Gravity simulation I made, worked fine on my computer (which runs Windows 10) without any error, but when I gave my friend a simulation, he got an error which says "The program can't start because api-ms-win-crt-utility-l1-1-0.dll is missing from your computer". http://imgur.com/a/be3lE
After that, I tried a simulation on my laptop which runs Windows 7. And I got an error but with different message. I looked at internet for solution and I found I need to install Visual C redist 2015. After installing, I tried running a simulation and got the same error as my friend. After that day, my friend told me simulation worked fine on his computer which runs Windows 10. So I concluded that build is only for Windows 10. My question is how do I make my simulation compatible for all Windows. Thanks :)

5
Graphics / Get sprite position relative to view
« on: January 10, 2017, 09:07:40 pm »
My window is using letterbox view (which I found on this website), and whenever window is resized, it's pixel size changes but ratio not. The problem is, I don't  know how to get sprite position relative to the view not world position. Btw I fixed mouse position with this code:
                        sf::Vector2f mouse_position = getWindow()->mapPixelToCoords(sf::Mouse::getPosition(*getWindow()));

                        if (event->mouseMove.x >= playbutton->getPosition()->x && mouse_position.x <= playbutton->getPosition()->x + playbutton->getCurrentSize().width
                                && mouse_position.y >= playbutton->getPosition()->y && mouse_position.y <= playbutton->getPosition()->y + playbutton->getCurrentSize().height)

6
General / Fatal error in project. (using dll engine)
« on: December 13, 2016, 11:04:38 pm »
Created new empty C++ project and added inc dir, lib dir, input... of my engine .dll and in C++>General in Additional Inc Dire added location of SFML includes. I compiled it and got this

and output is:
'TestDLL.exe' (Win32): Loaded 'E:\JAVA DEVELOPER\CSHARP Workspace\TestDLL\Debug\TestDLL.exe'. Symbols loaded.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\kernel32.dll'
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'E:\JAVA DEVELOPER\CSHARP Workspace\TestDLL\TestDLL\Light Speed Engine.dll'. Symbols loaded.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'E:\JAVA DEVELOPER\CSHARP Workspace\TestDLL\TestDLL\sfml-graphics-2.dll'. Module was built without symbols.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'E:\JAVA DEVELOPER\CSHARP Workspace\TestDLL\TestDLL\sfml-window-2.dll'. Module was built without symbols.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'E:\JAVA DEVELOPER\CSHARP Workspace\TestDLL\TestDLL\sfml-system-2.dll'. Module was built without symbols.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvoglv32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dbghelp.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
The thread 0x1cd4 has exited with code 0 (0x0).
The thread 0x1fe8 has exited with code 0 (0x0).
The thread 0xf50 has exited with code 0 (0x0).
The thread 0xe50 has exited with code 0 (0x0).
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'TestDLL.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winsta.dll'. Cannot find or open the PDB file.
Exception thrown at 0x6F7BCF5E (vcruntime140.dll) in TestDLL.exe: 0xC0000005: Access violation reading location 0x00CC4000.

GameTest (project) main class:
#include <Engine.h>
#include <Window.h>
#include <iostream>

int main() {

        ls::Engine* engine = new ls::Engine;

        ls::Window_Blueprint window_blueprint("Intros Manager", ls::Vector(1920, 1080));

        //window_blueprint.icon_source = "icon.png";

        engine->initialize(window_blueprint);

        delete engine;

        return 0;
}
 

And opens Window.h (heade of engine):
#ifndef WINDOW
#define WINDOW

#include "Vector.h"
#include <string>

#ifdef LIGHTSPEEDENGINE_EXPORTS
#define LIGHTSPEEDENGINE_API __declspec(dllexport)
#else
#define LIGHTSPEEDENGINE_API __declspec(dllimport)
#endif

namespace ls {

        struct LIGHTSPEEDENGINE_API Window_Blueprint {

                std::string name;

                Vector resolution;

                bool resizable = true;

                bool fullscreen = false;

                int framerate = 30;

                std::string icon_source;

                Window_Blueprint() = default;

                Window_Blueprint(std::string window_build_name, Vector window_build_resolution) : name(window_build_name), resolution(window_build_resolution) {}

        };

        sf::View LIGHTSPEEDENGINE_API getLetterboxView(sf::View window_view, sf::Vector2u* window_resolution_vector2f);

}

#endif
 

I hope if someone can help me :). Thanks.

7
I'm not an profesional C++ programmer just to be clear. I made my own game engine and I compiled it as Win32 DLL, and engine is using SFML. When I added engine to my GameTest project, I got error "cannot open source file SFML\Graphics.hpp...". Tried making test engine without sfml, and it worked fine. Idk how to use dll which uses another dll, and there is no tutorial on the internet.

8
General / Finished engine code. Compile it as static library or dynamic?
« on: December 04, 2016, 09:13:55 pm »
I finally finished my game engine and I don't know should I compile it as static or dynamic library? While searching for an answer, I found that dll is better if you just use OpenGL without SFML.  ::)

9
Graphics / White flicker at the window opening.
« on: November 20, 2016, 02:47:07 am »
At the window opening, little white screen appears for a 0.1 seconds. That's not a big problem, but it irritates me. Is it because of debuging? Or maybe it's because startDraw and startRun functions start at the same time (code below).

                sf::Thread run_thread(&Engine::startRun, this);

                createWindow(window_build);

                run_thread.launch();

                startDraw();

10
Is it possible to create class which inheritance sf::Drawable and which sf::Drawable can be overwritten by an sfml Drawable class for example sf::CircleShape?

If so, would it look like this?
sf::RectangleShape s;

sf::Drawable* f = &s;

Object* d = &f; //My class which inhertiance sf::Drawable

11
Graphics / Rendering object through virtual function
« on: October 30, 2016, 01:14:40 pm »
Is this good idea? This is the only way I found how to render rectangleshape from derived class.

Object (base class) and Rectangle (derived class)
        class Object {

        private:

                std::string name;

        public:

                Object() = default;

                Object(std::string object_name) : name(object_name) {}

                virtual void draw(sf::RenderWindow* renderwindow) = 0;

                virtual void setPosition(float, float) = 0;

                virtual void setRotation(float) = 0;

                const std::string* getName() {
                       
                        return &name;
                }

                const virtual Position getPosition() = 0;

                const virtual Rotation getRotation() = 0;

        };

        class Rectangle : public Object {

        private:

                sf::RectangleShape rectangleshape;

        public:

                Rectangle() = default;

                Rectangle(std::string name, float width, float height) : rectangleshape(sf::Vector2f(width, height)), Object(name) {}

                void draw(sf::RenderWindow* renderwindow) {

                        renderwindow->draw(rectangleshape); //is this good idea, will this slow my Engine?

                }

                void setPosition(float position_x, float position_y) {

                        rectangleshape.setPosition(position_x, position_y);

                }

                void setRotation(float angle) {

                        rectangleshape.setRotation(angle);

                }

                sf::RectangleShape* getRectangleShape() {

                        return &rectangleshape;
                }

                const Position getPosition() {

                        return Position(rectangleshape.getPosition().x, rectangleshape.getPosition().y);
                }

                const Rotation getRotation() {

                        return Rotation(rectangleshape.getRotation());
                }

        };

And here is render:
        void Engine::startDraw() {

                sf::View view;

                view.setSize(1920, 1080);
                view.setCenter(view.getSize().x / 2, view.getSize().y / 2);

                view = getLetterboxView(view, window.getSize().x, window.getSize().y);

                while (isOpen()) {
                       
                        sf::Event event;

                        while (window.pollEvent(event))
                        {

                                switch (event.type) {

                                case sf::Event::Closed:

                                        run = STOP;

                                        window.close();

                                        return;
                                case sf::Event::Resized:

                                        view = getLetterboxView(view, event.size.width, event.size.height);

                                        break;

                                }

                        }

                        window.clear(sf::Color::Black);
                        window.setView(view);

                        getObject("rect")->draw(&window); //good idea?

                        window.display();

                }

        }

If not, can someone give me a better way  :)? Thanks.

12
So basicly I have few question that I need to know to continue my Engine  ;D.

1. Does opengl render off the screen shapes (sf::Rectangle, sprite...). For example if rectangle position is at 1281 but screen is 1280, will it be rendered?
2. Is it true that 2D games screen is just a plane in 3D space with texture on it? Like this:
3. When I'm making my infinite runner, is it better to move my camera (sf::view) and generate map when it needs to appear or to just move all sprites at the opposite running direction and generating a map when it needs to appear?
4. Similar as third question, when I make my adventure game. Do I need to load my whole scene/map at the beggining, or to generate it when it needs to appear?

5. And one more important question. At the beggining of the game, should I load all objects, entities and particles to resource map. And when I need for example to spawn enemy, I just take that entity type from resource map and duplicate it in my other map called screen map which will render it and share it. Is that good mechanism for my Engine?

I'm making my first engine, and I'm looking it to be good as possible. I hope someone can answer my questions. Thanks.

13
Window / How to properly set icon to window?
« on: October 08, 2016, 12:38:46 am »
I searched on the internet for the answer, and all I found were topics older than 8 years. My question is what is the best and properly way to set icon to the render window? And also to .exe.

14
Graphics / Render function freezes before while is Open
« on: October 02, 2016, 03:11:46 pm »
In my function Game::startDraw(), before draw starts I call window.setActive(true), after that rest of the code is freezed. But, if there is std::cout, freeze is declined. Why??

Working code:
        void Game::startDraw() {

                window.setActive(true);

                std::cout << "Don't freeze!";

                while (isOpen()) {
                       
                        sf::Event event;

                        while (window.pollEvent(event))
                        {

                                switch (event.type) {

                                case sf::Event::Closed:

                                        setRun(STOP);

                                        window.close();

                                        return;

                                }

                        }

                        window.clear(sf::Color::Blue);

                        for (auto object : getObjects()) {

                                window.draw(*object->getSprite());

                        }

                        window.display();

                }

        }

I'm not sure but I think problem is caused by window.setActive().
Window create function:
        void Window::createWindow(Game::Game* game, sf::RenderWindow* game_window) {

                sf::ContextSettings window_settings;

                window_settings.antialiasingLevel = 16;

                game_window->create(sf::VideoMode(1920, 1080), *game->getName(), sf::Style::Fullscreen, window_settings);

                game_window->setVerticalSyncEnabled(true);

                game_window->setActive(false);

        }

15
Window / Aspect ratio confusion
« on: September 28, 2016, 12:50:04 am »
Currently i'm at the point where I don't know where to start. I want to make game where view will be equal on different screen resolutions. I don't know how and where to start and how other games do it. How do i calculate that. For good explanation i will be so thank thankful  :).

Btw here is my window code and render code:

Window.cpp:
        void Window::createWindow(Game::Game* game, sf::RenderWindow* game_window) {

                sf::ContextSettings window_settings;

                window_settings.antialiasingLevel = 16;

                game_window->create(sf::VideoMode::getDesktopMode(), *game->getName(), sf::Style::Fullscreen, window_settings);

                game_window->setVerticalSyncEnabled(true);
               
                game_window->setActive(false);

        }

Game.cpp (render code):
        void Game::startDraw() {

                window.setActive(true);

                sf::RenderTexture screen_layer_rendertexture;

                sf::Sprite screen_layer_sprite;

                if (!screen_layer_rendertexture.create(1920, 1080)) {

                        Main::printError("Can't create the texture.");

                        exit(-1);

                }

                screen_layer_rendertexture.setSmooth(true);

                screen_layer_sprite.setTexture(screen_layer_rendertexture.getTexture());

                while (isOpen()) {

                        sf::Event event;

                        while (window.pollEvent(event))
                        {

                                switch (event.type) {

                                case sf::Event::Closed:

                                        setRun(STOP);

                                        window.close();

                                        return;
                                }

                        }

                        screen_layer_rendertexture.clear(sf::Color::White);

                        for (auto object : getObjects()) {

                                screen_layer_rendertexture.draw(*object->getSprite());

                        }

                        screen_layer_rendertexture.display();

                        window.clear(sf::Color::Red);

                        window.draw(screen_layer_sprite);

                        window.display();

                }

        }

Pages: [1] 2
anything