Author Topic: [QT] Desktop Derp  (Read 9428 times)

0 Members and 2 Guests are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
[QT] Desktop Derp
« on: June 04, 2013, 10:43:36 pm »
Inspired by jujus Browser Derp I made a Desktop Derp in C++ using QT! So far all it does is moving randomly around (with gif changing).
I'll have to come up with some good rules for which gif comes when (or make somebody else do that for me :P)
code upload soon!

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #1 on: June 06, 2013, 07:57:20 pm »
Here we go (as promised): https://github.com/Sorunome/DesktopDerp

EDIT: I'm having trouble with a systemtrayicon and a rightclick-menu, if anybody wants to help me :D
« Last Edit: June 06, 2013, 08:00:40 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [QT] Desktop Derp
« Reply #2 on: June 09, 2013, 11:53:30 am »
Warning ! |\|00|3 question incoming ! 3... 2... 1...
How do I compile it ? I tried g++ main.cpp -o derpy but I have a no such file or directory error about QMainWindow (I installed the full Qt5 group in Arch).
I also tried qmake, make then ./DesktopDerp but it does nothing.
Edit : Aww... maybe I'm missing the GIFs ? :P
« Last Edit: June 09, 2013, 11:55:20 am by Streetwalker »

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [QT] Desktop Derp
« Reply #3 on: June 09, 2013, 12:57:55 pm »
Quote
Edit : Aww... maybe I'm missing the GIFs ?
I downloaded a gif and it appears, I suggest using QMovie.isValid() ;)
BTW: Compiling with qt4 works, too.

Quote
EDIT: I'm having trouble with a systemtrayicon and a rightclick-menu, if anybody wants to help me :D
I may be able to help. Did you read http://qt-project.org/doc/qt-4.8/qsystemtrayicon.html#setContextMenu]http://qt-project.org/doc/qt-4.8/qsystemtrayicon.html#setContextMenu]http://qt-project.org/doc/qt-4.8/qsystemtrayicon.html#setContextMenu?
It accepts a QMenu, like in http://qt-project.org/doc/qt-4.8/mainwindows-menus.html

BTW2: http://www.learncpp.com/cpp-tutorial/101-constructor-initialization-lists/ :P

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [QT] Desktop Derp
« Reply #4 on: June 09, 2013, 01:45:59 pm »
Yeah in README.md it says Qt5 but in DesktopPonies.pro it says "greaterThan(QT_MAJOR_VERSION, 4)".

I've put a GIF and hardcoded the name to see it work, it looks like Derpy's just randomly moving around. You need to make her follow the mouse like Juju's ! :D
Edit : Whoops, didn't read the OP correctly I guess. :P Seriously, you owe it to the world. :trollface:
« Last Edit: June 09, 2013, 01:49:29 pm by Streetwalker »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #5 on: June 09, 2013, 02:33:16 pm »
Yeah, i still have to upload the gifs, and i compile it over qt creator, it says it uses these lines (untested):
qmake /home/sorunome/desktopponies/DesktopPonies/DesktopPonies.pro -r -spec linux-g++-64 CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
make in /home/sorunome/desktopponies/build-DesktopPonies-Desktop-Debug

it just has to create the c++ files out of the .ui files and then make in the new directory.

EDIT: Yeah Vogtinator, i'll take a look, thanks

And I noticed a bug O.O after like a sertain number of gifs it just can't load new ones anymore, any idea why?
« Last Edit: June 09, 2013, 02:34:25 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [QT] Desktop Derp
« Reply #6 on: June 09, 2013, 02:36:23 pm »
Quote
And I noticed a bug  after like a sertain number of gifs it just can't load new ones anymore, any idea why?
While reading the source I noticed you're not freeing "QDesktopWidget *desk = new QDesktopWidget;", maybe that's the issue?

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #7 on: June 09, 2013, 02:40:03 pm »
maybe, how do i free that? I've never done something like that in C++ >.>

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [QT] Desktop Derp
« Reply #8 on: June 09, 2013, 02:40:58 pm »
As simple as it sounds:
Code: [Select]
desk = new QDesktopWidget;
free desk;

Edit: If you don't use pointers, it'll be done automatically if it gets out of scope, like this:
Code: [Select]
{
QDesktopWidget desk;
}
//desk will be freed
« Last Edit: June 09, 2013, 02:45:05 pm by Vogtinator »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #9 on: June 09, 2013, 02:47:06 pm »
As simple as it sounds:
Code: [Select]
desk = new QDesktopWidget;
free desk;


uho, i need to decalre by QDesktopWidget *desk = new QDesktopWidget;
and free desk gives me the error that it expects a ; before desk

EDIT: but for soem reason i don't think it is the desk, because i just use that to check the boundries of the screen every frame.
« Last Edit: June 09, 2013, 02:49:16 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [QT] Desktop Derp
« Reply #10 on: June 09, 2013, 02:49:18 pm »
Oh, sorry, I mistook free for delete,
Code: [Select]
delete desk; should work.
« Last Edit: June 09, 2013, 02:50:08 pm by Vogtinator »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #11 on: June 09, 2013, 02:50:49 pm »
Ok, let's see, it'll take like half an hour or longer.

BTW, can I somehow overgo the minimizing on when somkebody hits the show desktop button?
If not, can I somehow maximize my window?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [QT] Desktop Derp
« Reply #12 on: June 09, 2013, 02:50:56 pm »
Hmmm... That's why one shouldn't use two languages that are similar in the core but with little differences. :P

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #13 on: June 09, 2013, 03:05:27 pm »
I added now the gifs to the repo :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [QT] Desktop Derp
« Reply #14 on: June 09, 2013, 03:06:18 pm »
Ah cool. Pulling. :D