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

Pages: 1 [2]
16
General / Re: Get screenshot
« on: August 20, 2014, 09:11:11 pm »
Hey this is how I do it ( I Put it into the events code block)

case sf::Keyboard::F12:
                                        {
                                                sf::Image screen = window.capture();
                                                srand(time(0));
                                                long double randomNum = 0;
                                                for(int i = 0; i < 5; i++)
                                                {
                                                        randomNum = rand() % 125000000 + 1;
                                                }
                                                string fileName = "Screenshots\\" + std::to_string(randomNum) + ".png";
                                                screen.saveToFile(fileName);
                                                break;
                                        }

I am using a randum num generator for the names of the screens... you dont need to do that

17
General / Re: Very High CPU Usage.
« on: August 20, 2014, 08:24:11 pm »
Ok I Figured it out what is going on now can someone help me figure it out???
Well I downloaded Fraps to benchmark my game and either with or without window.SetFramerateLimit(60) / window.SetVirtualSync(enabled) <- something close  to that , dont remember the syntax atm... fraps only counts about 4... 5 fps!!!!!! so he is not maxing out the fps, also btw Fraps is not recording the game???? Just a black screen and my mouse moving around. Please Help :)

18
General / Re: Very High CPU Usage.
« on: August 20, 2014, 07:58:46 pm »
I am going to try what Gobbles suggested, just want more suggestions in case his dont work... And I don't think getting half full CPU is good? with such a little thing so far.

19
General / Re: Very High CPU Usage.
« on: August 19, 2014, 11:57:10 pm »
Please someone post more ideas ;(

20
General / Re: Very High CPU Usage.
« on: August 19, 2014, 12:35:16 am »
Alright I'll put a minimal example here...

I am using SFML 2.1 and I got it from SFML site -> Download -> 2.1 -> Windows -> Visual Studio 2010 10 (I didn't recompiled with CMAKE or whatever, just straight from the site...)

So I guess this example is ok? :

#include <sfTheora.h>
#include <SFML/Audio.hpp>
#include <SFML/Config.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <SFML/OpenGL.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include "textCreator.h"
#include "mainScreen.h"
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <string>
#include "variables.h"
#include "Funcs.h"

using namespace std;

int main()
{
        sf::ContextSettings settings;
        settings.antialiasingLevel = 8;
        sf::RenderWindow window(sf::VideoMode(fullscreen.width, fullscreen.height), "SFML Project", sf::Style::Fullscreen, settings);
        sf::Clock clock;

//      window.setVerticalSyncEnabled(true); <- I removed it because it wasnt doing anything and yes I tried //frame rate limit as well!
       
        mainFont.loadFromFile("Fonts\\sansation.ttf"); //mainFont is located on file variables.h

        sf::Text pressENT;
        pressENT.setColor(sf::Color::White);
        pressENT.setFont(mainFont);
        pressENT.setString("Press [ENTER] to Skip this Video");
        pressENT.setPosition(fullscreen.width-(fullscreen.width*0.65), fullscreen.height-(fullscreen.height*0.10));

        sftheora::Video introVideo("intro.ogg");

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
          //... normal event codes here + a few ones like mouse clicks, F12 etc that I inserted
                               
        }

                introVideo.update(clock.restart());

        window.clear();
                if(introVideo.isDone() == false)
                {
                        window.draw(introVideo);
                        window.draw(pressENT);
                }
                if(introVideo.isDone() == true)
                {
                        if(isMainScreenOn==true)
                        {
                                mainScreen::drawMainScreen(&window); //mainScreen.h / mainScreen.cpp... it's basically //a collection of items that are drawn if you want I can post that as well?
                        }
                }
        window.display();
    }
    return EXIT_SUCCESS;
}

21
General / Re: Very High CPU Usage.
« on: August 19, 2014, 12:15:44 am »
Nope, I have the build set as Release and I open it with "Debug->Build Solution (F7)" I wait untill it says "Build Completed" down there, then I go to Visual Studio 2010/Projects/Project Name/Release/.exe here <- and I open it

22
General / Re: Very High CPU Usage.
« on: August 19, 2014, 12:13:32 am »
I think so? I used window.setFramerateLimit(60); (I also tried other values)

23
General / Very High CPU Usage.
« on: August 19, 2014, 12:05:23 am »
Hello, I am currently working on a game with SFML (2.1), I am using Visual C++ 2010.
Just to start my computer is not the best, maybe not even close :P however this is way too exagerated as all I have done so far is a little bit of the main menu and it uses 56% of the CPU... And However I can play Call of Duty : Modern Warfare 2 (which I Suppose it's heavier then a little bit of the main menu of my game...) and it only uses about 36%...

So yeah, I Do not know where the problem is... I have tried many things, I have tried not loading an intro video (I Am Using SfTheora 1.4 to do so) by removing all of the SfTheora calls and everything associated to it, I had one multi-thread call which was just scrolling text around the screen , I tried removing it as well, I tried removing a function (void) which was cycling the colors of a text, I tried commenting out the WHOLE events  code block ... I tried removing vSync, I tried using framerate limit, I tried who knows what! I went from every part of my code, changing things... NOTHING, The CPU just keeps at that level pretty much :( With a thing THIS small (so far) I guess it shouldn't even be on 1% CPU... MAX I would say like 4%... So... Why does it stay like that?

Please Make Any Suggestions and tell me if you need anything to help me out :(



Thanks :)

Pages: 1 [2]
anything