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

Pages: [1] 2
1
General / How to draw a simple sprite with OpenGL?
« on: February 14, 2015, 08:34:16 pm »
Hello, im new to OpenGL, and so far, i am able to draw a triangle with this simple code:

glClearColor(1,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBegin(GL_TRIANGLES);

glVertex2d(-0.5f, -0.5f);
glVertex2d(0, 0.5f);
glVertex2d(0.5f, -0.5f);

glEnd();

window.display();

But how do i put a texture on it? I have read the tutorial here at the bottom of the page
http://www.sfml-dev.org/tutorials/2.2/graphics-sprite.php

I have created a texture, loaded it, and then call
sf::Texture::bind(&texture);

But my triangle is still white.

2
DotNet / How do i load a font correctly?
« on: December 09, 2013, 11:55:07 pm »
Hi.

When i deploy my project in VS2012 Professional, the content in my game will get generated into .DEPLOY files, however, the ttf files for fonts will not get generated. So im getting an error when i try to install and play my game. (See the Attachments).

Right now in my code, i just write something like

                       
Font arial = new Font(@"Content\arial.ttf");
Text text = new Text("Hello", arial);
 

Also, in my project, i have deleted the Output path so it will look and load from the bottom of the project.
Everything works fine, its just when i deploy, it will give me an error about the missing ttf file.

I hope somebody knows how to solve it :-)

Thanks

3
General / Is it okay to have two pollevent() on one event?
« on: February 02, 2013, 01:58:39 am »
ex:

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"test");
sf::Event ev;
void world1();

int main()
{
        while(mywindow.isOpen())
        {
                while(mywindow.pollEvent(ev))
                {
                        switch(ev.type)
                        {
                        case sf::Event::Closed:
                                mywindow.close();
                        case sf::Event::KeyPressed:
                                if(ev.key.code == sf::Keyboard::Space)
                                        world1();
                        }
                }
                mywindow.clear(sf::Color(0,200,0));
                mywindow.display();
        }
}

void world1()
{
        bool go = true;
        while(go)
        {
                while(mywindow.pollEvent(ev))
                {
                        switch(ev.type)
                        {
                        case sf::Event::KeyPressed:
                                if(ev.key.code == sf::Keyboard::Left)
                                        go = false;
                        }
                        mywindow.clear(sf::Color(200,0,0));
                        mywindow.display();
                }
        }
}
 

here, the ev variable is polled by two different pollevents, deppending on where the loop is executing, is that okay?

4
http://sfgui.sfml-dev.de/guide/getting_ … rom_source

I barely understand 1 single line

What is building from source?
What is binary releases?
I have also tried to look at what Cmake is... is it a building tool or wtf?... :S

Its my first time trying out a GUI, so i have no experience with it what so ever...

Man... i wish somebody was next to me and could show me how to get this done in 3 mins, instead of i have to look around 5 hours and trying to figure it out myself... and fail anyway.

Need some damit help >_< i really want to get started with this gui... it looks so awesome.
Thanks in advance!!

(Btw, i also posted this on the sfgui forums.)

5
General / What GUI should i use for SFML?
« on: December 12, 2012, 02:01:49 am »
Hey man  :D

And what GUI's do you recommend me to use that is compatible with the SFML renderwindow?

I want a GUI that has some documentation and tutorials on how to set up the thing and easy to use, because its first time im trying out a GUI in c++. So i have absolute no experience with GUIs.

Thanks in advance  :)

6
Graphics / how do i draw lines/polygons?
« on: December 10, 2012, 11:47:48 pm »
Hey folks :)

How do i draw all kinds of primitives?
I know circleshape and rectangleshape, that was pretty easy,
but cant seem to figure out how to draw lines and polygons

ive looked at the documentation but i cant figure it out, 
and also the 1.6 tutorials... but it doesnt work the same as 2.0 :(

I will be grateful for any help you guys can provide  :D

7
General / Need some general information about integrating Qt with SFML
« on: November 21, 2012, 07:49:49 pm »
Hello  ;D (it might be a dumbass question, sorry). But i just wanna know what Qt exactly kinda is, when integrating it with sfml

Is it something nice to use when you want to make a gamemenu with all kinds of buttons and images?

Normally when i make a gamemenu for my game, then i load the images, make int variables to control where the button is etc... which kinda take long time to make and its gonna get pretty messed up.

But is it that Qt can take care of?
It looks cool, but i dont know if i should learn it, if i shouldn't use it anyway   :P

8
General / How do i put icons at my application?
« on: November 14, 2012, 11:22:27 pm »
ive looked at

http://www.sfml-dev.org/documentation/2.0/classsf_1_1Window.php#a63af61e026fba08e3153fd013620bcc0

void sf::Window::setIcon, but i didn't really understand it because it only have 3 parameters which is width, height and pixels. But where should i load the big & small icons?

Thanks for all your support  ;D

9
SFML projects / Hungry Snake 1.1 Released!!!
« on: November 13, 2012, 12:00:42 am »
Hungry Snake 1.1 is now released!

download at:
http://www.mediafire.com/?u8ucz7m1lucalq3

Changelog:
- Rat stealing your food
- Healthpack
- Some other minor bugfixes, balances and features


Remember to uninstall the 1.0 if you have it... because i dont know how to make it able to update instead of installing a whole new version.

Also, A big thanks to you all for helping me in the forum, especially to exploiter!!  :D

Images & Sounds Credits goes to:

Tibia
http://www.freesound.org/
Google

10
General / need help with a weird problem (working with files)
« on: November 06, 2012, 11:18:54 pm »
Hello everybody  :)
I have the weirdest problem when im working with files and saving them as highscore.

It took me about 3 hours to figure out why sometimes it would save the highscore on the harddrive, and why sometimes it woulnd't when i have to release and make an installer for it.

It works perfectly when im debugging it on my own computer, but not when i make an installer for it.

So my question is, is this how to work with files?

#include <SFML\Graphics.hpp>
#include <fstream>
#include <string>
#include <sstream>

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"ddsada");
sf::Event ev;
sf::Font myfont;

sf::Text t_score;
sf::Text t_highscore;
int score = 0;
int highscore = 5;


template <typename T>
std::string toString(T arg)
{
        std::stringstream ss;
        ss << arg;
        return ss.str();
}

int main()
{
        mywindow.setVerticalSyncEnabled(true); //60 fps
        myfont.loadFromFile("thefont.ttf");
        t_score.setFont(myfont);
        t_highscore.setFont(myfont);
        t_highscore.setPosition(0,50);

        std::ifstream inputfile("highscore.txt");
        inputfile >> highscore;
        inputfile.close();

        while(mywindow.isOpen())
        {
                t_score.setString(toString("Score= ") + toString(score));
                t_highscore.setString(toString("Highscore= ") + toString(highscore));

                while(mywindow.pollEvent(ev))
                {
                        if(ev.type == sf::Event::Closed || ev.key.code == sf::Keyboard::Escape)
                                mywindow.close();
                }
                mywindow.clear(sf::Color(0,200,0));

                score++;
                mywindow.draw(t_score);
                mywindow.draw(t_highscore);

                mywindow.display();
        }

        if(score > highscore)
        {
                std::ofstream outputfile("highscore.txt");
                outputfile << score;
                outputfile.close();
        }

}
 

So when i make an installer for it... it actually doesn't work when i include the highscore.txt (and the dll files) and make the installer for it.

It only works when i include the files i need (the dll files) and after i install it, then i have to make a new highscore.txt file (eg. in my deskop) and then put it in my c drive where the program actually is (where the font and dll files are).


Sorry, theres alot of reading and text. But im very very close to make my game fully functional and i want to show it to you all  ;D.

I just cant make this file thing to work  >:(

11
General / How do i make an installer for my sfml 2.0 game?
« on: November 05, 2012, 11:10:16 pm »
Good evening   ;D

I just finished my game and i want to show it to my friend.
How do i make and installer for it?

I know how to do it with allegro. i used "Advanced Installer" and i just had to include some redistributable files and some allegro dll. files.

But what should i include with sfml?


12
Window / How do you make the keyboard just click one time? (SFML 2.0)
« on: November 04, 2012, 12:03:43 pm »
Hello  ;D

I have a problem with the keyboard input thing... i just want it to click 1 single time instead of 2 or 3 times when i click a key.

Heres my code... just so you can see what i mean. Also... Does key A count as "left mouse click"?... it looks like it does. (u can copy and paste if you wanna test)

#include <SFML/Graphics.hpp>
#include <sstream>
#include <string>

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"dsda");
sf::Event ev;

int x = 0;

template <typename T>
std::string toString(T arg)
{
        std::stringstream ss;
        ss << arg;
        return ss.str();
}

int main()
{
        sf::Text mytext;
        mywindow.setVerticalSyncEnabled(true);

        while(mywindow.isOpen())
        {
                mytext.setString(toString(x));
                while(mywindow.pollEvent(ev))
                {
                        if(ev.key.code == sf::Keyboard::A)
                        {
                                x++;
                        }
                }
                mywindow.clear(sf::Color(0,200,0));
                mywindow.draw(mytext);
                mywindow.display();

        }
}
 

13
General / Question about preprocessor
« on: October 31, 2012, 12:17:48 am »
Hey folks :)
i just want to show a small example about scope when dealing with preprocessor and functions that i have a little problem with

So.... i have the main functions and another function in a header... heres my code.

//MAIN.CPP

#include <SFML\Graphics.hpp>
#include "world1.h"

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"dsadsa");
sf::Event ev;

int main()
{
        while(mywindow.isOpen())
        {
                while(mywindow.pollEvent(ev))
                {
                        if(ev.type == sf::Event::Closed)
                                mywindow.close();
                }
                world1();
               
        }
}
 

//WORLD1.H

#include <SFML\Graphics.hpp>

void world1()
{
        mywindow.clear(sf::Color(0,200,0));
        mywindow.display();
}
 

So basically, the problem is that an error aqquires and says that mywindow is unidentified.

I actually tried to define my RenderWindow variable "before" i #included the world1.h.
And that worked.... but is that really how you should do it to make my renderwindow variable be accessed in all function in other headers?

14
General / How do i write variables contents in text?
« on: October 25, 2012, 01:22:05 am »
For example

int x = 10;

sf::text mytext;
mytext.setfont(myfont);
myfont.setstring("bla bla bla (x)") // i want to write "bla bla bla 10"

mywindow.draw(mytext);

So how do i write my variable x's contents if i had to track my score?

15
General discussions / When is SFML 2.0 gonna be compatible with VC 2012?
« on: October 25, 2012, 12:29:45 am »
Hey, sorry if its already been posted, but i couldn't seem to find it.

But when is SFML 2.0 gonna be compatible with VC 2012?

Pages: [1] 2