[img]http://imgkk.com/i/dr0bjx.png[/img]
Look at that sexy motherfucker.
I'm trying to get Qt fully working inside a texture (well, in my experimenting setup, currently an SDL_Surface). This would mean you can have a fully-functional native UI complete in-game.
The above isn't native GUI rendering - it's actually rendered to an SDL_Surface, which is then blit to the screen (so, theoretically, I would be able to take this code and then adapt it to rendering to an OpenGL/Direct3D texture, which could be used in-game).
I'm working on a calculator, currently it's only in console: I'm going to start to adapt a GUI tomorrow.
[url]http://www.2shared.com/file/6861733/24fc0e49/EZ-calc.html?[/url]
There's a download if anyone wants to check it out(c/c welcome)
Here's the source:
[cpp]
#include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
//Welcome to the jungle, babe.
//EZcalc - sKeletor
int main()
{
int i;
cout << "Welcome to EZcalc, designed and written my Zyphlen Kotani [sKeletor]." << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. See the instructions" << "\n";
cout << "2. Use the calculator" << "\n" << "\n";
cin >> i;
if(i == 1)
{
system("CLS");
cout << "Instructions" << "\n" << "\n";
cout << "1. Choose the operation you wish to complete (addition, subtraction," << "\n" << "multiplication or division)" << "\n";
cout << "2. Input the first integer in your calculation" << "\n";
cout << "3. Input the second integer in your calculation" << "\n";
cout << "4. If you wish to do multiple calculations, repeat this sequence" << "\n" << "\n";
system("pause");
system("CLS");
int ret;
cout << "Would you like to continue to the calculator?" << "\n" << "\n";
cout << "1. Yes" << "\n";
cout << "2. No" << "\n" << "\n";
cin >> ret;
if(ret == 1)
{
while(true)
{
system("CLS");
int op;
cout << "What operation would you like to complete?" << "\n" << "\n";
cout << "1. Addition" << "\n";
cout << "2. Subtraction" << "\n";
cout << "3. Multiplication" << "\n";
cout << "4. Division" << "\n" << "\n";
cin >> op;
if(op == 1)
{
system("CLS");
int adda;
int addb;
int addc;
cout << "Please enter your first integer: ";
cin >> adda;
cout << "\n" << "Please enter your second integer: ";
cin >> addb;
cout << "\n" << adda << " + " << addb << " = " << adda + addb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> addc;
if(addc == 1)
{
continue;
}
else if(addc == 2)
{
break;
}
}
else if(op == 2)
{
system("CLS");
int suba;
int subb;
int subc;
cout << "Please enter your first integer: ";
cin >> suba;
cout << "\n" << "Please enter your second integer: ";
cin >> subb;
cout << "\n" << suba << " - " << subb << " = " << suba - subb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> subc;
if(subc == 1)
{
continue;
}
else if(subc == 2)
{
break;
}
}
else if(op == 3)
{
system("CLS");
int mula;
int mulb;
int mulc;
cout << "Please enter your first integer: ";
cin >> mula;
cout << "\n" << "Please enter your second integer: ";
cin >> mulb;
cout << "\n" << mula << " * " << mulb << " = " << mula * mulb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> mulc;
if(mulc == 1)
{
continue;
}
else if(mulc == 2)
{
break;
}
}
else if(op == 4)
{
system("CLS");
int diva;
int divb;
int divc;
cout << "Please enter your first integer: ";
cin >> diva;
cout << "\n" << "Please enter your second integer: ";
cin >> divb;
cout << "\n" << diva << " / " << divb << " = " << diva / divb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> divc;
if(divc == 1)
{
continue;
}
else if(divc == 2)
{
break;
}
}
}
}
else if(ret == 2)
{
return 0;
}
}
else if(i == 2)
{
while(true)
{
system("CLS");
int op;
cout << "What operation would you like to complete?" << "\n" << "\n";
cout << "1. Addition" << "\n";
cout << "2. Subtraction" << "\n";
cout << "3. Multiplication" << "\n";
cout << "4. Division" << "\n" << "\n";
cin >> op;
if(op == 1)
{
system("CLS");
int adda;
int addb;
int addc;
cout << "Please enter your first integer: ";
cin >> adda;
cout << "\n" << "Please enter your second integer: ";
cin >> addb;
cout << "\n" << adda << " + " << addb << " = " << adda + addb;
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> addc;
if(addc == 1)
{
continue;
}
else if(addc == 2)
{
break;
}
}
else if(op == 2)
{
system("CLS");
int suba;
int subb;
int subc;
cout << "Please enter your first integer: ";
cin >> suba;
cout << "\n" << "Please enter your second integer: ";
cin >> subb;
cout << "\n" << suba << " - " << subb << " = " << suba - subb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> subc;
if(subc == 1)
{
continue;
}
else if(subc == 2)
{
break;
}
}
else if(op == 3)
{
system("CLS");
int mula;
int mulb;
int mulc;
cout << "Please enter your first integer: ";
cin >> mula;
cout << "\n" << "Please enter your second integer: ";
cin >> mulb;
cout << "\n" << mula << " * " << mulb << " = " << mula * mulb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> mulc;
if(mulc == 1)
{
continue;
}
else if(mulc == 2)
{
break;
}
}
else if(op == 4)
{
system("CLS");
int diva;
int divb;
int divc;
cout << "Please enter your first integer: ";
cin >> diva;
cout << "\n" << "Please enter your second integer: ";
cin >> divb;
cout << "\n" << diva << " / " << divb << " = " << diva / divb << "\n" << "\n";
system("pause");
system("CLS");
cout << "What would you like to do?" << "\n" << "\n";
cout << "1. Perform another operation" << "\n";
cout << "2. Exit" << "\n" << "\n";
cin >> divc;
if(divc == 1)
{
continue;
}
else if(divc == 2)
{
break;
}
}
}
}
}
[/cpp]
[QUOTE=nullsquared;16296245][img]http://imgkk.com/i/dr0bjx.png[/img]
Look at that sexy motherfucker.
I'm trying to get Qt fully working inside a texture (well, in my experimenting setup, currently an SDL_Surface). This would mean you can have a fully-functional native UI complete in-game.
The above isn't native GUI rendering - it's actually rendered to an SDL_Surface, which is then blit to the screen (so, theoretically, I would be able to take this code and then adapt it to rendering to an OpenGL/Direct3D texture, which could be used in-game).[/QUOTE]
Just wondering what are some of the difficulties you're running into (if any)
[QUOTE=Klownox;16296863]I'm working on a calculator, currently it's only in console: I'm going to start to adapt a GUI tomorrow.
//code
[/QUOTE]
You should separate some of that code into functions. This improves design and readability. You can also use those functions in other projects.
[QUOTE=Klownox;16296863]I'm working on a calculator, currently it's only in console: I'm going to start to adapt a GUI tomorrow.
[url]http://www.2shared.com/file/6861733/24fc0e49/EZ-calc.html?[/url]
There's a download if anyone wants to check it out(c/c welcome)
Here's the source:
-snip-[/QUOTE]
That's an awful lot of forking you're doing there. "cls" and "pause" are only really guaranteed to be avaivable on Windows, and this is not really what the system() function is for (and it's awfully slow).
Instead of "system("pause");", you can use "cin.get();".
For clearing the console, you could use a function much like this:
[cpp]
#ifdef _WIN32
#include <windows.h>
#endif
void clearConsole()
{
#ifdef _WIN32
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
DWORD dwConSize;
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hCon, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacterA(hCon, cast(TCHAR)' ', dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hCon, &csbi);
FillConsoleOutputAttribute(hCon, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hCon, coordScreen);
#else
cout << "\033[2J";
#endif
}
[/cpp]
[QUOTE=Guru-guru;16292396][img]http://davidjokinen.com/GameAlpha3.png[/img]
Made it finally work in a web-browser and put it online. Added a simple but stupid looking GUI window. Made the people smarter. Added explosions when you want to delete people.[/QUOTE]
lol the drowning guys are raising the roof!
[IMG]http://img411.imageshack.us/img411/9507/drown.gif[/IMG]
[QUOTE=jA_cOp;16297240]That's an awful lot of forking you're doing there. "cls" and "pause" are only really guaranteed to be avaivable on Windows, and this is not really what the system() function is for (and it's awfully slow).
Instead of "system("pause");", you can use "cin.get();".
For clearing the console, you could use a function much like this:
[cpp]
#ifdef _WIN32
#include <windows.h>
#endif
void clearConsole()
{
#ifdef _WIN32
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
DWORD dwConSize;
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hCon, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacterA(hCon, cast(TCHAR)' ', dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hCon, &csbi);
FillConsoleOutputAttribute(hCon, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hCon, coordScreen);
#else
cout << "\033[2J";
#endif
}
[/cpp][/QUOTE]
Cross platform way of clearing the console:
[cpp]
int i;
for(i = 0; i < 30; i++)
printf("\n");
[/cpp]
:smug:
Wait, what is this: cout << "\033[2J";
[QUOTE=ltkerr0r;16297435]lol the drowning guys are raising the roof!
[IMG]http://img411.imageshack.us/img411/9507/drown.gif[/IMG][/QUOTE]
Wow haha.. Do I know you or did you guess the link?
EDIT:
Can you make a gif of the explosion and the woman drowning.
Here is the link so anyone can play it [url]http://davidjokinen.com/test.php[/url]
[QUOTE=PvtCupcakes;16297840]Cross platform way of clearing the console:
[cpp]
int i;
for(i = 0; i < 30; i++)
printf("\n");
[/cpp]
:smug:
[/QUOTE]
lol....
[QUOTE=PvtCupcakes;16297840]Cross platform way of clearing the console:
[cpp]
int i;
for(i = 0; i < 30; i++)
printf("\n");
[/cpp][/QUOTE]
Oh come on, some newbie might take you seriously. (You could at least have used putchar! :v:)
[QUOTE=PvtCupcakes;16297840]Wait, what is this: cout << "\033[2J";[/QUOTE]
\033 is an escape sequence, meaning the start of a command in an ANSI escape sequence compliant console. [2J is the command for clearing the console.
The MSDOS console isn't ANSI compliant (nor does it try to be, although an extension exists), so you have to do it manually with the WinAPI.
I like my console like I like my women. Overly complex, and requiring [i]manual[/i] work :pervert:
[QUOTE=Guru-guru;16297866]Wow haha.. Do I know you or did you guess the link?[/QUOTE]
I followed the breadcrumbs.
[QUOTE=Chandler;16298437]I like my console like I like my women. Overly complex, and requiring [i]manual[/i] work :pervert:[/QUOTE]
You'd just love the Win32 API then.
[QUOTE=HubmaN;16298647]You'd just love the Win32 API then.[/QUOTE]
uhno
[QUOTE=HubmaN;16298647]You'd just love the Win32 API then.[/QUOTE]
The Win32 API is usually fairly simple for being C, it has very descriptive names too, unlike your typical POSIX API.
Busy wrestling with my terrible code to get an SFML GUI working. It's all fine until I try and attach widgets to a window.
[img]http://i27.tinypic.com/1zdcf3d.jpg[/img]
Here it is working fine, with button, window and button attached to window. The blue highlight appears if you put your mouse over a part you can interact with. And then I use the "Spawn more windows button" and:
[img]http://i29.tinypic.com/71igt1.png[/img]
Complete and utter failure.
[QUOTE=jA_cOp;16299385]The Win32 API is usually fairly simple for being C, it has very descriptive names too, unlike your typical POSIX API.[/QUOTE]
I have been shown... who is the boss.
[img]http://www.overclock3d.net/gfx/articles/2009/05/21211010477l.jpg[/img]
Cocoa+IB's got a smaller learning curve, IMO, but that's enough of that.
Got text input finally working, although it's rather uncontrollable as it is because I'm just appending an input character on a string I pass in (and return) on an interval. My function calls have also become rather cryptic, but I'm loath to create structs to pass around. For a fun time, guess what the parameters do.[media]http://www.cubeupload.com/files/a93c00untitled.png[/media]
I'm still thinking of other widgets to do.
[QUOTE=nullsquared;16296245][img]http://imgkk.com/i/dr0bjx.png[/img]
Look at that sexy motherfucker.
I'm trying to get Qt fully working inside a texture (well, in my experimenting setup, currently an SDL_Surface). This would mean you can have a fully-functional native UI complete in-game.
The above isn't native GUI rendering - it's actually rendered to an SDL_Surface, which is then blit to the screen (so, theoretically, I would be able to take this code and then adapt it to rendering to an OpenGL/Direct3D texture, which could be used in-game).[/QUOTE]
This is interesting, will be following this.
[QUOTE=nullsquared;16296245][img_thumb]http://imgkk.com/i/dr0bjx.png[/img_thumb]
Look at that sexy motherfucker.
I'm trying to get Qt fully working inside a texture (well, in my experimenting setup, currently an SDL_Surface). This would mean you can have a fully-functional native UI complete in-game.
The above isn't native GUI rendering - it's actually rendered to an SDL_Surface, which is then blit to the screen (so, theoretically, I would be able to take this code and then adapt it to rendering to an OpenGL/Direct3D texture, which could be used in-game).[/QUOTE]
Good lord, how'd I miss that for an entire day?
[QUOTE=Benji;16289513]What is CakePhysics intended for Overv? Just a learning experience?[/QUOTE]
A learning experience, something to show what I can do and a fun 2d physics sandbox with multiplayer and scripting possibilities.
[QUOTE=Sporbie;16290105]He would first have to make something better than Phun, which is free.
He might be able to since Box2d is far superior to whatever Phun is using, if he is using Box2d.[/QUOTE]
Yes, I'm using Box2D. It's easy to use, fast and it has pretty much all the features of Havok, but in 2D as far as I can tell.
Now, yesterday I coded sliders and a GUI which can actually do something:
[img]http://i28.tinypic.com/2diewl1.jpg[/img]
[url=http://hosting.overvprojects.nl/download.php]Here[/url]'s a link for you to try out.
Wow, that works really well, Overv! It appears to be very efficient, running well over 50 boxes, all interacting with each other at over 50 FPS.
It's quite sexy as well, I might add.
[QUOTE=Senney;16302144]Wow, that works really well, Overv! It appears to be very efficient, running well over 50 boxes, all interacting with each other at over 50 FPS.
It's quite sexy as well, I might add.[/QUOTE]
Box2d is FAST. Looks like he's got vsync on anyway so it's probably running at 200+ fps easily
That gui is coming along nicely overv
Fun to play around with Cake Physics :D.
[QUOTE=Overv;16301866]
[url=http://hosting.overvprojects.nl/download.php]Here[/url]'s a link for you to try out.[/QUOTE]
I have an idea for this, you can work towards it later on though. Basically a scripting system, you load a script and it spawns boxes at specific places at specific times. E.g. a tower building script spawns 2 boxes at X:48 then 4 at X:50 then 2 at X:52 each like 0.5 seconds apart.
[QUOTE=gilly_54;16302734]I have an idea for this, you can work towards it later on though. Basically a scripting system, you load a script and it spawns boxes at specific places at specific times. E.g. a tower building script spawns 2 boxes at X:48 then 4 at X:50 then 2 at X:52 each like 0.5 seconds apart.[/QUOTE]
The scripting will be way more advanced than that :).
[QUOTE=Chandler;16297039]Just wondering what are some of the difficulties you're running into (if any)[/QUOTE]
Well, Qt has an OpenGL renderer. However, what you need to do is create a Qt window, then create a Qt OpenGL widget, and inside of there you would do your own OpenGL stuff, and then Qt will render it's own stuff on top of your scene.
However, what I want to do is this: skip everything (I don't want to use Qt to handle my window/input/etc.), and just render the Qt GUI to a texture. This way, you can, for example, put a Qt GUI inside an in-game computer
(skipping the fact that I don't see an equivalent Direct3D widget, which would make this kind of useless in a multi-render system framework)
Would be cool if you would generate a normal map and you could use it for actually physical buttons.
[QUOTE=Overv;16301866]A learning experience, something to show what I can do and a fun 2d physics sandbox with multiplayer and scripting possibilities.
Yes, I'm using Box2D. It's easy to use, fast and it has pretty much all the features of Havok, but in 2D as far as I can tell.
Now, yesterday I coded sliders and a GUI which can actually do something:
[img]http://i28.tinypic.com/2diewl1.jpg[/img]
[url=http://hosting.overvprojects.nl/download.php]Here[/url]'s a link for you to try out.[/QUOTE]
Needs more linux bins.
[QUOTE=ZomBuster;16303463]Would be cool if you would generate a normal map and you could use it for actually physical buttons.[/QUOTE]
Good lord, make them steep and self-shadowing, too, for maximum depth'n'jizz.
[QUOTE=ZomBuster;16303463]Would be cool if you would generate a normal map and you could use it for actually physical buttons.[/QUOTE]
That would be awesome and probably actually not too difficult.
Sorry, you need to Log In to post a reply to this thread.