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

Pages: [1] 2 3
SFML projects / Veggie Snake [casual game]
« on: May 27, 2011, 05:03:57 pm »
Looks nice and simple :P

General / (Solved) Need help with errors after updating SFML
« on: May 26, 2011, 02:37:49 pm »
Are you linking in the correct order?
In your case it should be: -lsfml-graphics -lsfml-window -lsfml-system

SFML projects / M.A.R.S. - a random shooter
« on: May 25, 2011, 06:20:48 pm »
I am trying to compile on windows but I can't do it. You cmake file does not do everything by itself.

After some time I found this in cmake\modules\FindSFML.cmake:
# If SFML is not installed in a standard path, you can use the SFMLDIR CMake variable
# to tell CMake where SFML is.

It's quiet hidden, don't you think? But it works.

But then I get this:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
    linked by target "mars" in directory C:/Users/Philipp/Documents/C++/MARS/src
    linked by target "mars" in directory C:/Users/Philipp/Documents/C++/MARS/src

This should not happen, since you provide those in your package.
So am I just suppose to provide the paths to those libs? I only found .dll's in the ext_libs_for_windows dir. I don't think I can link against those with MinGW? Do I have to build both libs by myself?

Alright! I made it!
I build both libs (fribidi + taglib) by myself and installed them to my MinGW dir. I am sure I could have used the .dlls that are in the MARS folder but I wanted to have a clean build so I made sure everything is right.
Now I don't want to set the SFMLDIR. So I edited FindSFML.cmake so it can find my SFML build in my MinGW dir.

This is what I changed to make it work each time:
Code: [Select]
Index: cmake/modules/FindSFML.cmake
--- cmake/modules/FindSFML.cmake (Revision 200)
+++ cmake/modules/FindSFML.cmake (Arbeitskopie)
@@ -31,7 +31,8 @@
           /opt/local/  # DarwinPorts
           /opt/csw/    # Blastwave
-          ${SFMLDIR})
+          ${SFMLDIR}
+          C:/MinGW)
 # check the version number
@@ -68,7 +69,8 @@
-                        ${SFMLDIR})
+                        ${SFMLDIR}
+                        C:/MinGW)
Index: CMakeLists.txt
--- CMakeLists.txt (Revision 200)
+++ CMakeLists.txt (Arbeitskopie)
@@ -29,7 +29,7 @@
 # find the sfml2 headers and library
-find_package(SFML REQUIRED graphics system audio window)
+find_package(SFML REQUIRED audio graphics window system)
 # Foundation library needed for apple
@@ -46,7 +46,7 @@
  find_library(TAG_LIBRARY tag)
 # Fribidi library needed for bi-directional texts
- find_library(FRIBIDI_LIBRARY fribidi)
+ find_library(FRIBIDI_LIBRARY fribidi-0)
 # set the executable output path

Btw: I love your game!

General / Inventory system for text based rpg/mud
« on: May 25, 2011, 02:15:40 pm »
Quote from: "snaef98"
Would this be correct? What else is missing? It won't let me store bool values or strings inside the class though.

No! You really need to read the chapter about classes of your C++ book again (if you have one).

This is what I can tell you:
A class holds all information of a kind of object. In your case it holds a name, price, etc. So it's kind of a list of variables in your case, but a class can also contain functions. It should look more like this:

Code: [Select]
class Item
   Item(string equip, string title, int atk, int price, int slot, bool stack);
   string GetEquip();
   string GetEquipTitle();
   int GetEquipAtk();
   // ...
   string Equip;
   string EquipTitle;
   int EquipAtk;
   int EquipPrice;
   int EquipSlot;
   bool EquipStack;

You need to define all the functions. The Item() function is the constructor of the class. In your case it should set all the values of the member variables.

All (not always but almost) member variables should be private. That has some reasons:
- It's saver. You can not change the data by accident.
- You can easily change the Get functions without changing your whole other program. You could even change the type of the internal variable without showing it to the program.

Then you can do this in your main program:
Code: [Select]
Item sword("Sword", "Sword_Title", 20, 30, 1, false)
cout << sword.GetEquipAtk() << endl;

btw: I don't know what you want to do with stack.

For an array (list) of items you should use vectors.

Edit: sry not done with that post. just a minute..
Edit2: done :)

General discussions / Where to begin...
« on: May 25, 2011, 02:03:31 pm »
Don't worry it does.

I think it should go to the Help section. But if you think it fits here that should be true.

I researched a little and I found this:
Especially "The Game Design Document" will be interesting.

General discussions / Where to begin...
« on: May 24, 2011, 03:41:29 pm »
First of all you need to make a game design. If you don't know what that is you should look it up. After some time of planning you can start the programming. If you didn't use SFML yet try the tutorials first and get comfortable with it.
A good webpage about game making is http://www.gamedev.net/

Btw: This is the general discussion forum of SFML. Your question does not fit here at all :)

Graphics / Crazy bug using OpenGL lighting and RenderWindow
« on: May 20, 2011, 04:21:12 pm »
I did and there are only saves and restores around the two Draw() functions which I don't use at all. I tried and added lighting to the SFML2 example "OpenGL" and it works without any bugs. So I suppose the bad guy is the glMaterial function in this case because the example only uses textures. I will try to find out :)

General / Multithreading, splash screens and sf::Sprites
« on: May 20, 2011, 04:15:22 pm »
Your code works for me. I am using MinGW and SFML2 :)

Graphics / Crazy bug using OpenGL lighting and RenderWindow
« on: May 19, 2011, 10:33:24 pm »
Quote from: "Lokk"
And, there is an error on your gluPerspective ratio, App.GetWidth() and App.GetHeight() need to be casted to float numbers like this :

Thanks, your right.

Quote from: "Lokk"
SFML uses its own OpenGL statements, so you should include all your opengl calls within App.SaveGLStates(); and App.RestoreGLStates();

As your code doesn't work for me I looked at the documentation and found this:
More specifically, it must be used around code that calls Draw functions. Example:

 // OpenGL code here...
 // OpenGL code here...

I assume that window.Draw() is the only function that changes the GL states and I should put it around SFML code and not OpenGL code?! If thats true my code should work without SaveGLStates().

Another crazy thing:
- When I press "rebuild" and then "compile and build" (CodeBlocks+MinGW) it works the first time I execute (all 6 quads shown). Any other time it just shows 4 quads.

Now I get the feeling that it depends on my machine and that it is some kind of bug in my drivers. I will try on another machine and let you know :)

Python / pysfml2-cython building problems
« on: May 19, 2011, 08:40:24 pm »
Thanks for your response. I will try a "standalone" MinGW.

Another thing that confuses me is that I don't have a PCbuild dir.

Well. I will try some things and tell you how it worked out :)

Graphics / Crazy bug using OpenGL lighting and RenderWindow
« on: May 18, 2011, 06:03:46 pm »
Could somebody just try and compile? I would appreciate that.

Graphics / Sprites not Overlapping
« on: May 17, 2011, 02:04:37 pm »
Just draw the dynamic ones last. The last Sprite you draw will be the sprite displayed on top.

Window / Pixels off by one.
« on: May 17, 2011, 06:44:55 am »
In my understanding the size is 100x100 (0x0 to 99x99). At least that how it is everywhere else and I never had a 1 pixel border at two sides when I used background sprites.

Python / pysfml2-cython building problems
« on: May 16, 2011, 10:21:15 pm »

I have some problems with building pysfml2-cython with mingw32 on windows. I am using Python27.

My building log (--compiler=mingw32 is default):
Code: [Select]
C:\Users\Philipp\Documents\C++\pysfml2-cython>python setup.py build_ext --inplac
running build_ext
cythoning sf.pyx to sf.cpp
building 'sf' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Program Files\CodeBlocks\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\Py
thon27\include -Ic:\Python27\PC -c sf.cpp -o build\temp.win32-2.7\Release\sf.o
sf.cpp: In function 'PyObject* __pyx_pf_2sf_11SoundBuffer_7samples___get__(PyObj
sf.cpp:7838: warning: comparison between signed and unsigned integer expressions

sf.cpp: In function 'void __Pyx_RaiseArgtupleInvalid(const char*, int, Py_ssize_
t, Py_ssize_t, Py_ssize_t)':
sf.cpp:38407: warning: unknown conversion type character 'z' in format
sf.cpp:38407: warning: format '%s' expects type 'char*', but argument 5 has type
sf.cpp:38407: warning: unknown conversion type character 'z' in format
sf.cpp:38407: warning: too many arguments for format
sf.cpp: In function 'void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t)':
sf.cpp:38625: warning: unknown conversion type character 'z' in format
sf.cpp:38625: warning: format '%s' expects type 'char*', but argument 3 has type
sf.cpp:38625: warning: too many arguments for format
sf.cpp: In function 'void __Pyx_RaiseTooManyValuesError(Py_ssize_t)':
sf.cpp:38633: warning: unknown conversion type character 'z' in format
sf.cpp:38633: warning: too many arguments for format
sf.cpp: In function 'PyObject* __pyx_pf_2sf_5Image_14get_tex_coords(PyObject*, P
sf.cpp:15063: warning: '__pyx_v_p' is used uninitialized in this function
writing build\temp.win32-2.7\Release\sf.def

All this should be okay even there are some warnings. But then:
Code: [Select]
C:\Program Files\CodeBlocks\MinGW\bin\g++.exe -mno-cygwin -mdll -static --entry
_DllMain@12 --output-lib build\temp.win32-2.7\Release\libsf.a --def build\temp.w
in32-2.7\Release\sf.def -s build\temp.win32-2.7\Release\sf.o -Lc:\Python27\libs
-Lc:\Python27\PCbuild -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system -
lpython27 -lmsvcr90 -o C:\Users\Philipp\Documents\C++\pysfml2-cython\sf.pyd
g++: build\temp.win32-2.7\Release\libsf.a: No such file or directory
error: command 'g++' failed with exit status 1

I don't get this. Shouldn't it build a file called libsf.a?

Can somebody help?

SFML projects / Multitroids - asteroids clone, with a twist!
« on: May 16, 2011, 05:11:32 pm »
This seems very nice to me! I will try it later and build it for windows. I will contact you :)

Pages: [1] 2 3