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 - Chris Jozwiak

Pages: [1] 2
1
SFML projects / SFML Daily Show
« on: April 18, 2019, 01:59:36 pm »
Hey guys!
I'm planning on creating a daily show on my youtube channel making sfml videos kinda like tutorials but more just fun video's about game developmemt. It's going to be challenging keeping them in short episodic pieces. I was wondering if anyone here could give me some support once i start going with it. That stated, wondering if therea a certain place om the forum I could post each video where it didn't get in the way but where people would find it also. I'd also like to do q  & a once a week atleast. Thoughts?

2
Network / Noob network problem...
« on: May 07, 2017, 06:04:34 pm »
Afternoon or it will be when I'm done writing this post.
I have issues. Many many issues. My program compiles fine, both of them rather. My troubles ensue when I have my server and client open. Nothing is displayed and nothing happens. I am utilizing the basic code from the official networking tutorial, all that has changed is the port.

Code is the same as tutorial pretty much but:
Server:
(click to show/hide)


Client:
(click to show/hide)

The consoles display a blinking cursor and nothing else. I'm a noob with network programming. Enabled the port in my firewall, still nothing.

Edit 1:00 PM :
Server binds to port properly but client is unable to connect to the port. I feel as if it's something with my network.
I am running ubuntu 16.04. Not sure if something blocking something Fajsg;jaksjfg;lkajskrlgjlka. Yep.

3
Graphics / Crashing with drawTo Function.
« on: January 22, 2017, 04:55:24 pm »
Hello,
I've been trying to figure this out on my own.  I just started playing around with SFML again and I usually am able to move stuff around to make it work but I want to be able to understand what actually is going on.  I've had problems simplifying my code in the past to where the issue is, but here goes nothing.

Grid Class
Grid::Grid(int arraySize){
    arraySize = arraySize;
    gridLines[arraySize];
    std::cout << arraySize;
}
void Grid::drawTo(sf::RenderWindow &mWindow)
{
    for (int tRun = 0; tRun <= arraySize; tRun++){
    mWindow.draw(gridLines[arraySize]);

    }
Main Class
//Everything else in the file is irrelevant (Game Loop Stuff)
grid.drawTo(gameWindow);
 

4
Graphics / Nothing drawing to screen
« on: July 02, 2016, 04:46:22 pm »
I think somethings wrong with my Game loop.   I set everything up as it should be; Clear screen, Draw stuff, Display but it doesn't seem to be working.  I'm trying to work with classes, not going so well. It runs, the window opens and clears to white or whatever I set it to. 



cbEngine.cpp
#include "cbEngine.h"

cbEngine::cbEngine(int screenWidth, int screenHeight)
: mWindow(sf::VideoMode(screenWidth, screenHeight, 32), "App")

{


}

cbEngine::~cbEngine()
{
    //dtor
}

sf::RenderWindow& cbEngine::getWindow()
{
    if (runonce == true){
    std::cout << "Window Created" << std::endl;
    }

   return  mWindow;
}
sf::Event& cbEngine::getEvent(){
    return e;
}
void cbEngine::eventLoop(sf::RenderWindow &window, sf::Event event){
    if(runonce == true){
    std::cout << "Event Loop Initialized" << std::endl;
}
    while(window.pollEvent(event)){
        if(event.type == sf::Event::Closed){
            window.close();
            std::cout << "Window Exited by User." << std::endl;
        }

    }
}
void  cbEngine::runGame(sf::RenderWindow &window){
    stateManager sManager; //Create instance of stateManager class
    splashScreen splaScreen;
    splaScreen.setText();
    test.setFillColor(sf::Color::Red);
    test.setScale(sf::Vector2f(80,80));
    while(window.isOpen()){
            if (runonce == true){
            std::cout << "Window open" << std::endl;
            }
            //---Do Only if Debugging---//
    // Check to see if runonce is true; if true output to console that game is starting. //
    while (debug == true){
        if (runonce != false){
            std::cout << "Starting game..." << std::endl;
            runonce = false;
        }
        break;
    }
    // End of Debug Section //

    // Loop Structure 1.Clear window (Color = black) 2. Call stateManager 3. Display window //
    eventLoop(window, e); // Call event loop Initialize it with window and Event object
    window.clear(sf::Color::White); //Clear window black
    //sManager.selectState(getWindow());// Section not working WIP
    window.draw(test);
    window.display(); // Display everything to screen
    }
}




 
cbEngine.h
class cbEngine
{
private:

        //Declare Core Variables
        sf::RenderWindow mWindow;  //Create Base window object
        sf::Event e; // Initialize system event object
        bool runonce = true; // Boolean for running testing conditions only once (otherwise they'd run non stop alongside window.)
        bool debug = 1; //If Debug True certain conditions will be met and testing variables will be output to screen(Exclusive to Engine class)
        sf::RectangleShape test;  //Rectangleshape test
public:
        cbEngine(int screenWidth, int screenHeight); // Initialize Engine with integer screenWidth, screenHeight
        virtual ~cbEngine();
        //Declare core functions//
        //----------------------//
        sf::RenderWindow &getWindow();  //Returns main copy of window object
        sf::Event &getEvent();  //Returns main copy of event object
        void runGame(sf::RenderWindow &window); // Game Loop Runs through logic and displays everything to window
        void eventLoop(sf::RenderWindow &window, sf::Event event); //Runs through events


        //---End Declaration---//

    protected:

    private:
};

#endif // CBENGINE_H
 

#include "includes.h"

int main(){

    cbEngine Engine(800, 600);

    std::cout << "Main" << std::endl;
    Engine.runGame(Engine.getWindow());


    return 0;
}

5
Window / Text not drawing
« on: July 01, 2016, 03:10:43 am »
I can't figure out why my text won't display to my window.  I reference mWindow with each function.  Anyways the codes in multiple files so I uploaded it to a repository on GitHub. https://github.com/Sianide4000/Swaric-Game-Engine

6
Window / Passing in reference.
« on: June 28, 2016, 02:41:16 am »
I'd like to start off by saying I have read a C++ book. 
That said, I'd had a working example of using a reference to pass in the window to different files.  However the problem I had was having to pass in sf::RenderWindow &mWindow to pretty much every function that needed the window.  The problem lied when I tried to split off functions into different files I couldn't get the actual copy of the window I needed.  The deeper down the hierarchy I got it seemed I was getting lost in what I was trying to do.  It was a logic problem but I'm contemplating on how I could use one function to get a copy of the window.  Just looking for advice. =)

7
Window / BSOD when calling function...
« on: March 13, 2016, 03:26:45 am »
Let me begin by saying all my code is gone.  Not that it was much; I was just messing around with stuff.  It was one file "main.cpp".  After the BSOD when I reboot the file in reference was blank.  When I opened it up with notepad ++ it was filled with the word null that filled in where all my code was.  Nothing remains O_O. 
Now for the code.  It was a basic loop that displayed a window normally and drew text on screen that scrolled across.  I had a for loop for the movement of the text that was based off a clock I initialized.  Anyways everything worked fine until I tried messing with a key press and calling the function app.create(sf::VideoMode(800, 600), "App", sf::Style::FullScreen);  It worked fine but when I hit the F key multiple times my computer crashed and displayed something about dxmms.sys failing.  I don't plan on doing that again, just was wondering why this could have happened.

8
Window / Call to draw() crashes program.
« on: May 01, 2015, 04:05:24 am »
I am attempting to compile a very simple program with SFML.  Any attempt to draw a simple sf::RectangleShape results in a crash.  I have compiled SFML 2 using mingw-gcc 4.8.1 and can compile it perfectly fine without a draw call.  I have an outdated system and am on windows 7 and my GFX Card doesnt only had drivers for XP.  I have those installed.  I'm assuming this is the core of the problem but wanted another opinion. 

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

#define Window_Height 800
#define Window_Width 600



int main(){

    sf::RenderWindow window(sf::VideoMode(Window_Height, Window_Width), "First SFML Game");
    sf::RectangleShape arrofshape[10];
    sf::RectangleShape shape;
    bool draw = 1;
    for (int i; i < 10; i++){
        arrofshape[i].setFillColor(sf::Color::Red);
        arrofshape[i].setScale(sf::Vector2f(10,10));
    }

    while (window.isOpen()){

        sf::Event event;

        while(window.pollEvent(event)){

            if (event.type == event.Closed){
                window.close();
            }
        }

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

    window.display();

    }




    return 0;
}
 

9
Window / Compiling in Codeblocks gcc 4.8.1
« on: October 12, 2014, 05:33:43 pm »
Hello,
To start I cloned the source from Github.  Then used CMake to generate the makefiles for codeblocks.  I then opened the project and hit build and I am getting a errors.

Error:
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 4 second(s)) ===|
C:\Sfml\SFML\src\SFML\Window\Win32\WindowImplWin32.cpp:387:26: error: 'FLASHW_TRAY' was not declared in this scope
         info.dwFlags   = FLASHW_TRAY;
                          ^
mingw32-make.exe[2]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/Win32/WindowImplWin32.cpp.obj] Error 1
mingw32-make.exe[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
src\SFML\Window\CMakeFiles\sfml-window.dir\build.make:486: recipe for target 'src/SFML/Window/CMakeFiles/sfml-window.dir/Win32/WindowImplWin32.cpp.obj' failed
mingw32-make.exe[2]: Leaving directory 'C:/Sfml/SFML'
CMakeFiles\Makefile2:204: recipe for target 'src/SFML/Window/CMakeFiles/sfml-window.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/Sfml/SFML'
C:/Sfml/SFML/Makefile:116: recipe for target 'all' failed

 

10
General / New Square from old square...
« on: March 22, 2013, 01:11:28 am »
Not really related to sfml per say... But more to my project using sfml.  I want to draw a new square everytime my mouse is clicked.  Not sure how to do it though. My code is at www.cjozwiak.com

11
General / Loading problem...
« on: March 21, 2013, 01:14:24 am »
Hello, Once again.

I'm having trouble getting my vs 2012 environment to recognize the files I'm trying to load via sfml.  The code I have www.cjozwiak.com (Just an archive site for my code).  It works fine when I open up my .exe but the debug build gives me could load "arial.ttf and could not load "logo.png".

12
General / Link error .exe
« on: March 19, 2013, 06:08:30 am »
Hello I'm trying to figure out how to use classes with sfml.  I know I can but this is the first i've programmed oo style. I'm fairly new to programming in C++ altogether.  I'm using vs 2012 and I'm getting the error:
1>LINK : fatal error LNK1104: cannot open file 'C:\Users\brr\documents\visual studio 2012\Projects\sfmlgame\Release\sfmlgame.exe'

Here's my main.cpp:

#include "functions.h"
int main()
{
        functions func;
       
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);
        bool running = true;
    while (running)
    {
 
                func.window.clear();
        func.window.draw(shape);
        func.window.display();
    }

    return 0;
}

functions.h:

#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include<SFML\Network.hpp>
#include <SFML/Window.hpp>
class functions
{
public:
        functions(void);
        ~functions(void);
        void Events();
        void Window();
        sf::RenderWindow window;
        sf::Event event;
       
};

 

functions.cpp:


#include "functions.h"




functions::functions(void)
{
}


functions::~functions(void)
{
}

void functions::Window(){
        window.setSize(sf::Vector2u(800,600));
        window.setTitle("Test");
       


}

void functions::Events(){
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
       
}

13
Graphics / Font load issue...
« on: March 03, 2013, 07:44:59 pm »
I can't seem to get my program to load the font. 
CodE:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <iostream>
using namespace std;
int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!", sf::Style::Close);     
        bool running = true;
        bool startmenu = true;
        bool ingame = false;
        bool gamemenu = false;

        //Declare Objects
        sf::Font font;
        if (!font.loadFromFile("ubuntu.ttf")){
                cout << "Could not load font..." << endl;
                system("PAUSE");
        }
        sf::Text text("Test", font, 50);
       
        text.setPosition(20,10);
        text.setScale(20,20);
        sf::RectangleShape rect;
        rect.setFillColor(sf::Color::Red);
        rect.setSize(sf::Vector2f(20,20));
        rect.setPosition(40,40);
       
        while (running){               

               


                sf::Event event;
                if (window.pollEvent(event)){

                        if (event.type == sf::Event::Closed)
                                running = false;
                       

                }
       
                window.clear();
                window.draw(text);
                window.draw(rect);
                window.display();
       
       
       
        }
    return 0;
}
 
It shows me failed to load font "tu.ttf" Failed to create font face.

My font is ubuntu.ttf.. Why is it outputting tu.ttf?

14
General / When is sfml 2.0 going to be the current version?
« on: February 26, 2013, 03:09:45 am »
When will 2.0 be the current instead of just for testing.  Also when will all of the tutorials be released?

15
General / if statement and drawing to window problem...
« on: December 14, 2012, 05:40:32 pm »
Having a problem with drawing a rectangle to the window if my variable touching is equal to true.   The collision detection works fine.  If I put a printf statement within the if statement at the end it prints it out. I don't understand why it's not drawing.
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>
#include <SFML\Window.hpp>
#include <SFML\Network.hpp>
#define RAND_MAX 100;

   //Must get object to attach to player and follow player.
int main()
{
   
   sf::RectangleShape player;
   player.setSize(sf::Vector2f(30,30));
   player.setFillColor(sf::Color::Blue);
   sf::RectangleShape object;
   object.setSize(sf::Vector2f(30,30));
   object.setFillColor(sf::Color::Red);
   sf::RectangleShape object2;
   object2.setSize(sf::Vector2f(30,30));
   object2.setFillColor(sf::Color::Red);
   int x = rand();
   int y = rand();
   object2.setPosition(100,100);
   sf::RenderWindow window(sf::VideoMode(1024, 600), "Game");
   bool touching = false;
   
   player.setPosition(0,0);
   object.setPosition(100,100);

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

      while(window.pollEvent(event))
      {
         if (event.type == sf::Event::Closed)
            window.close();
         if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
            player.move(-3,0);
            
         }
         else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
            player.move(3,0);
         }
         else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
            player.move(0,3);
         }
         else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
            player.move(0,-3);
         }
         
         if (object.getGlobalBounds().intersects( player.getGlobalBounds())){
            touching = true;
         }
         
         
         
         
      }

      
      
      window.clear();
      window.draw(player);
      window.draw(object);
      if (touching){
            window.draw(object2);
            
            
         }
      window.display();
      
      


   

      }
   return 0;
      


}

Pages: [1] 2