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

Pages: [1]
1
General / Game window is smaller in my laptop...
« on: August 27, 2019, 04:39:12 pm »
I wrote a game on my computer which is to be presented in my laptop.

I set the dimensions (in pixels) for the game window, on my computer to be as large as I wanted it to be on my laptop.

But when I compile the game in my laptop.. the game window is very tiny!

What do I do now? Everything in the game from mouse events to graphics correspond to coordinates of the tiny window.

Is there anything that would help scale the window up a little? What about mouse events, do I have to rewrite everything?

2
Graphics / Can't construct a Texture object from another Texture object?
« on: August 15, 2019, 02:24:30 pm »
The documentation doesn't seem to have a mention about this so I'm wondering if this is normal.

I get the error:
An internal OpenGL call failed in Texture.cpp(98).
Expression:
   glFlush()
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.


When I try to construct a Texture object from another Texture object with loaded texture.
        sf::Texture temp1;
        temp.loadFromFile(image_location);
        sf::Texture player_texture{ temp };

No error if the texture object doesn't have a loaded texture already
        sf::Texture temp1;
        sf::Texture player_texture{ temp };
But of course this serves no purpose.


My original intent was to do this:
sf::Texture texture_initialize(std::string location) {
        sf::Texture texture;
        texture.loadFromFile(location);
        return texture;
}

--> inside a function:
        sf::Texture player_texture{ texture_initialize(image_location) };
 

3
General / How do I share a texture object amongst object instances?
« on: August 15, 2019, 07:06:22 am »
Here is an example class that I wrote:

class example {
private:
        sf::Texture player_texture;
public:
        sf::Sprite player_sprite;

        example() {
                player_texture.loadFromFile(fight_sprite_location);
                player_sprite.setTexture(player_texture);
        }
};

So the above class lets you make an object of the class and use that object's sprite instead of having to declare the texture and sprite in the main function.

Basically it's for tidying up my main function a  bit.

The problem however is that I might want to instantiate multiple instances of the class (all using the same texture itself, just their sprite attributions like position etc differ).

In that case each instance would have a separate texture object, which is a waste because really all the class instances need the same texture.


Is there a way to share a texture amongst object instances without having to allocate a new texture in each of the objects, and without having to declare a texture where the object has been created (I want as less code in main as possible, because I want my friends to be able to read the code).

Maybe something with the static keyword?

thx for reading  :)




4
General / Voice to text?
« on: March 01, 2019, 01:09:22 pm »
I need to take voice input for my program. Any suggestions? Is there anything simple?

Btw I'm using Windows 10, Visual Studio 2017, I'm okay with platform specific.

5
General / Can I pull events without having a window?
« on: February 20, 2019, 11:16:07 am »
I need to pull events without having a visible window. Can this be done without a window class? If I need to have a window class can I have it be hidden and always taking events even when it's not active?

I want this because: standard library of C++ doesn't allow taking of input without 'enter' following the input. So I was hoping SFML could help me with it.

Of course I could probably use SFML for the entire project but I'm only doing simple stuff.

Can I pull events from regular console that pops up when you run a C++ program (I use windows, so presumably we're talking about the windows console).
(While using SFML)

6
General discussions / Where do I put the SFML notice?
« on: February 17, 2019, 09:43:35 am »
1) When do I need to put the SFML notice
https://www.sfml-dev.org/license.php

2) If I made a project based on SFML and posted it on GitHub, do I need to mention the license, where do I mention it? As a text file at the main page? What do I name the text file?

3) Suppose I have not used the SFML DLLs but just copied part of the source code (eg. the part of the library related with clipboard manipulation) do I need to still put the SFML notice?

What happens if somebody didn't put the SFML notice?

7
I don't know where I'm going wrong. I'm using Visual Studio 2017.

I did exactly as told in https://www.sfml-dev.org/tutorials/2.5/start-vc.php
I even tried watching some Youtube videos but they all instructed to do the same thing.

I ran the code from the page and got errors like so:
LNK2019   unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)"..

and many errors like that.

I want to get SFML to work on build mode.

Under additional include libraries, I put the right path, I am able to include SFML without any errors.
I'm sure I added the right path for additional library directories as well.

Under Additional Dependencies I have:
sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-audio-s-d.lib
sfml-network-s-d.lib
sfml-system-s-d.lib
%(AdditionalDependencies)


I've been trying to do all kinds of random stuff to get SFML to work. I just don't get it.. Where have I gone wrong??

Also what is the 'bin' folder for? Are we never going to use it?


Pages: [1]
anything