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

Pages: [1] 2 3 4
1
Graphics / Re: Best way to implement a basic UI?
« on: March 24, 2019, 11:54:13 pm »
Like others have said, essentially in your game loop you'll need to:

1. Set the render window's view to your "main" view.
2. Draw all the "game" stuff.  The moving parts, etc.
3. Set the render window to a separate "UI" view.
4. Draw the UI stuff.

The UI's positions can be anything at all.  Since you're drawing them at a completely separate time as the game entities, and because it's on a completely different view, doing stuff like moving the "main" view won't effect the UI stuff at all.

2
General discussions / Re: What pain points do you experience using SFML?
« on: January 19, 2019, 09:16:46 pm »
It's also not very useful for anything but the very simplest case. A rich text component or even just multiline component with text alignment would make a big difference here.

This is by far my biggest gripe.  I find myself often having to do a lot of tinkering with sf::Text and wondering why I have to write my own functions for things like multi-line text centering.  When I asked about it a couple years ago I was told to do it myself.  Yeah, that's fine, I'm happy to do it, but it seems like there's a bit of functionality missing from sf::Text that is not just specific to my needs, but rather features that most users would want.  I can see why these features might be low priority, but they don't even seem to be on the roadmap anywhere.

3
General / Re: Making a game playble on other computers
« on: January 17, 2019, 05:58:33 pm »
Thank you so much!
One thing, when I tried to put them how they were in my projects folder (.exe in debug folder, rest of the files in a neighboring one) it didn't seem to find the .dll files, when I put everything into one folder it worked perfectly!
One last quick question, what advantage does compiling in release mode has over the debug one (just runs faster + won't initiate if your code isn't "complete" ?).
Oh and also, if I were to one day hopefully release a game, are there programs that make it hard to tamper with all the loose .txt and .jpg files, or do developers just code their own methods of securing these files into the game?
Thanks so much for your help!   :D :D

Ah!  Well I'm glad you figured out the file structure.  I think my instructions were a little confusing now that I look back.  It does make sense that you wouldn't keep the .exe file in the /debug folder.  Glad you got it working!

Release mode just makes things more stable, smooth, and fast, generally.  In the first game I released using SFML I noticed a considerable difference between debug and release mode in terms of performance, (not necessarily due to SFML, in fact it probably wasn't due to SFML).

As for the last point, if you have data in a .txt file, you can try making them .dat files, etc. but.... it's probably not worth the effort.  I encrypted all of my data files for my first game and left myself wondering what the point was.  If your game is cool enough that people want to modify it, then you should probably let them ;)

The only exception I can think of are things like Steam achievements or online play, in which case you'd need to store player information in accounts on a server instead of on their computer (way over my head).

4
General / Re: How do I pause an sf::Clock? (SFML 2.0)
« on: January 17, 2019, 05:53:23 pm »
Thanks for the explanation, that all makes sense.  FWIW I just tried sftools::Chronometer in a new 2.5 project and it works fine!  (And next time I'll make a new thread)

5
General / Re: Making a game playble on other computers
« on: January 16, 2019, 08:19:05 pm »
So, first of all I just want to explain the difference between debug mode and release mode.

If you have a class called "Player" and that class has a member value called jumpHeight and you never initialize that value, the debug compiler might say "Okay well I was never told what jumpHeight should be.  I'll make it 1." And your code runs fine.

Compiling in release mode, this doesn't happen.  Instead the compiler says "I was never told what jumpHeight should be so I'm not going to do anything."  This can cause your code to break or act completely different at runtime.

If you don't really plan on "releasing" your game, it doesn't really matter.  Except that when you compile in debug, your program generally runs slower, and if you set up SFML correctly, the compiler will look for the debug versions of the libraries (which, I assume are bigger but I don't actually know that).

So if you just want to show it to your friends it's not a big deal.

That said, here's what you will need to give them. (I recommend copying these things instead of moving them)
The .exe file produced by your compiler.
All of the sfml .dll files (Assuming you didn't link the libraries statically.)
All of the .dll files of any other libraries you used (again, assuming you linked dynamically, not statically)
All folders containing all images, sounds, fonts, etc.  They should be in the same relative position to your .exe file as they were in your project folder.
Zip em up!

If you give this to your friend and they unzip the files and double click the .exe file, it should work.  If it complains about a missing .dll file, then you probably missed one.  And, if you set up your code correctly, it should complain about missing files like images and fonts (SFML will throw errors for missing files in any case).

It's actually not too complicated.  You seem like you think you're overthinking it.  You're not!

6
General / Re: How do I pause an sf::Clock? (SFML 2.0)
« on: January 16, 2019, 07:35:46 pm »
Hi folks.  Yes, I'm replying to a very old thread.  If I should make a new one instead, let me know and I'll be happy to.

I found great success using sftools in the past but noticed on its repo: https://github.com/mantognini/sftools that it hasn't been updated in several years.  I suppose I'm just curious as to its current status.  I can understand why these tools aren't a part of SFML itself, but I did notice that it's specifically mentioned (and even documented somewhat) in SFML's documentation on github, and that the last edit to such documentation was done by eXpl0it3r: https://github.com/SFML/SFML/wiki/Source:-Chronometer

Is it "officially" part of the SFML project, if not the library itself?  If so, are there any plans to update it for SFML 2.5?  I'm not knowledgeable enough to look at the source code and determine whether anything would need to be updated.

7
Upgrading to 2.4.2 fixed the issue.  Thanks everyone!

8
General / Re: Upgrading SFML and Cmake
« on: April 14, 2017, 02:36:48 am »
Ok.  I was able to upgrade.

My problems stemmed from downloading the SFML binaries instead of compiling SFML myself.  I'm using a rather old version of code::blocks, so I'm not really sure why I was surprised to encounter compiler discrepancies between my files and SFML.  In any case, once I did all the stupid things I did to my own project, I compiled SFML myself and was upgraded in seconds.  Glad to know that I didn't have to change a single line of code to make mine compatible with 2.4.2.

Thanks for your help, everyone.

9
General / Re: Upgrading SFML and Cmake
« on: April 13, 2017, 11:20:23 pm »
Ok, cool.  Right now I am just trying to revert my project back to 2.0 and get it compiling, which unfortunately is not going well.  But, should I succeed at that, I will start over and compile SFML myself.

Thank you for the help, and sorry it took me so long to provide the relevant information ;)

10
General / Re: Upgrading SFML and Cmake
« on: April 13, 2017, 11:06:03 pm »
Thanks, exploiter.  The error messages I got were along these lines:

undefined reference to `_imp___zn2sf6stringc1erkssrkst6locale'|
and a similar one regarding Texture::loadFromFile().

Those error messages are long gone at this point because I have made such a mess of the whole thing -_-

When I asked cmake to tell me the state of SFML_LIBRARIES, however, it did list all the .dll files as being linked.

I'll see if I can reproduce the error, but does your reply mean you don't have any hunch at all based on the information I gave you?

11
General / Upgrading SFML and Cmake
« on: April 13, 2017, 07:20:33 pm »
Hi folks.  Since y'all suggested I upgrade SFML, I am trying to do that.

Here's my problem, and I've already found a few posts about it but they aren't solving my issues.
I downloaded SFML 2.4.2, GCC 6.1.0 MinGW (DW2) - 32-bit (I'm using codeblocks)

In my cmake files (I have two projects, one is a library I created and one is my game), I changed:
find_package(SFML REQUIRED COMPONENTS audio network graphics window system)
to
find_package(SFML 2.4 REQUIRED COMPONENTS audio network graphics window system)

Cmake did not complain a bit about either change, said it had successfully found 2.4.2, and everyone was happy.  I made sure too, that the SFML include directory was correct, and that the correct .dll files were listed.

When I compiled my library, everything went fine.
When I compiled my game, I got warnings that sf::Text.setColor() was deprecated, which seemed to me to indicate that the linking had worked.

Then, I got 40 undefined references.

I have tried everything I could find by googling, and haven't had success.  Here are my cmake files:
JollyLava (my library)

project(JollyLava CXX)
cmake_minimum_required( VERSION 2.6 )

# Set version information in a config.h file
set(myproject_VERSION_MAJOR 0)
set(myproject_VERSION_MINOR 1)

# Name of this library.
set(LIBRARY_NAME "JollyLava")

#
# --- Our CMake settings
#
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})

# Place libraries in the root BUILD directory.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # static
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) # dynamic

#
# --- Dependencies
#

# SFML
find_package(SFML 2.4 REQUIRED system window graphics network audio)
include_directories("${SFML_INCLUDE_DIR}")

# Box2D
find_package(Box2D REQUIRED)
include_directories("${BOX2D_INCLUDE_DIR}")

# Include headers.
include_directories(${CMAKE_SOURCE_DIR}/include)

# C++ source code.
add_subdirectory(src)

#
# --- Install
#
install(DIRECTORY include DESTINATION lib)
 

and JollyZorbit (my game)
project(JollyZorbit CXX)

cmake_minimum_required(VERSION 2.6)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules" ${CMAKE_MODULE_PATH})

#set(EXECUTABLE_NAME "JollyZorbit")
#add_executable(${EXECUTABLE_NAME} main.cpp)

find_package(JollyLava REQUIRED)
include_directories("${JOLLYLAVA_INCLUDE_DIR}")

find_package(SFML 2.4 REQUIRED audio network graphics window system)
include_directories("${SFML_INCLUDE_DIR}")
# Note - if I enable the following line I get the error "Cannot specify link libraries
# for target "debug" which is not built by this project"
#target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})


find_package(Box2D REQUIRED)
#set(BOX2D_LIBRARY C:/Box2D_v2.2.1/build/Box2D/libBox2D.a)
#set(BOX2D_INCLUDE_DIR C:/Box2D_v2.2.1/)
include_directories("${BOX2D_INCLUDE_DIR}")

find_package(Steamworks REQUIRED)
include_directories(${STEAMWORKS_INCLUDE_DIR})

# Include headers.
include_directories(${CMAKE_SOURCE_DIR}/include)

# C++ source code.
add_subdirectory(src)

#set_property(TARGET JollyZorbit PROPERTY WIN32_EXECUTABLE true)

Does anyone have any thoughts on what is wrong?  I am obviously quite a CMake newb, so please don't assume I know anything about what I'm doing.

Edit:  Here's a little extra info:
http://imgur.com/a/o5kpe

12
Well there's some DPI awareness added since 2.0 and lots and lots of bugfixes. But I can't give you any guarantees. With SFML 2.x being fully backwards compatible, an update shouldn't be an issue and you had like over 5 months to update. ;)

Thank you.  If updating isn't such a big deal I'll give it a shot ;)

And thank you, Mario, for further clarification.  I'll see what I can do.

13
No I haven't.  I'm a little scared to at this point.  Project is supposed to release in about 10 days and I have a billion other things to do BUT if "upgrade to 2.4.2 and it will be fixed" is the answer, then that's perfectly satisfactory to me.  I'll just have to do it then.

14
Sorry to bump an old thread but this issue remains in my program.  May I just re-ask:

Is there nothing I can do about this from my standpoint?  Anybody who plays my game and encounters this problem is going to think the game is broken.  Any tips?

15
Multi-line text alignment wouldn't look much different than your own custom solution with multiple sf::Text, the only difference is that the later you have to write it. ;)

It's something we might investigate further at one point, but there are a lot more important features and issues to take care of first.

Word.  I figured it was a low priority sort of issue.  Guess I'll get crackin'!

Pages: [1] 2 3 4
anything