Author |
Message |
SS
Joined: Sat Aug 16, 2008 8:38 am Posts: 6670 Location: Darkest Antartica Country:
Gender: Male
Skype: Thaiberium
Currently Playing: The Game
|
If you mean by syntax and lexicon, yes. Here let me show you: This is a rather simple object class. Notice the similarities and the differences.
|
Fri Mar 13, 2009 4:22 pm |
|
|
Captain Mew
Joined: Mon Aug 11, 2008 6:40 am Posts: 1648 Location: ... Not America
|
that looks like simple Java See how this is normal C++ This is Win32 | | | | Code: 1. #include <windows.h> /* Windows header */ 2. 3. LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); 4. char szClassName[ ] = "WindowsApp"; /* Class ID */ 5. 6. int WINAPI 7. WinMain (HINSTANCE hThisInstance, 8. HINSTANCE hPrevInstance, 9. LPSTR lpszArgument, 10. int nFunsterStil) 11. 12. { 13. HWND hwnd; 14. MSG messages; 15. WNDCLASSEX wincl; 16. 17. wincl.hInstance = hThisInstance; 18. wincl.lpszClassName = szClassName; 19. wincl.lpfnWndProc = WindowProcedure; /* See end of code */ 20. wincl.style = CS_DBLCLKS; 21. wincl.cbSize = sizeof (WNDCLASSEX); 22. wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); 23. wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); 24. wincl.hCursor = LoadCursor (NULL, IDC_ARROW); 25. wincl.lpszMenuName = NULL; 26. wincl.cbClsExtra = 0; 27. wincl.cbWndExtra = 0; 28. wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Default windows background colour */ 29. 30. if (!RegisterClassEx (&wincl)) 31. return 0; 32. 33. hwnd = CreateWindowEx ( 34. 0, 35. szClassName, /* Classname */ 36. "Windows App", /* Title Text */ 37. WS_OVERLAPPEDWINDOW, 38. CW_USEDEFAULT, /* Default x... */ 39. CW_USEDEFAULT, /* ...and default y position of window */ 40. 640, /* The programs width... */ 41. 480, /* ...and height in pixels */ 42. HWND_DESKTOP, 43. NULL, 44. hThisInstance, 45. NULL 46. ); 47. 48. /* Make the window visible on the screen */ 49. ShowWindow (hwnd, nFunsterStil); 50. while (GetMessage (&messages, NULL, 0, 0)) 51. { 52. TranslateMessage(&messages); 53. DispatchMessage(&messages); 54. } 55. 56. /* Return: wParam from a quit message usually = 0 */ 57. return messages.wParam; 58. } 59. 60. LRESULT CALLBACK 61. WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 62. { /* Called when window processes a message */ 63. switch (message) 64. { case WM_DESTROY: /* Destoy message: called if you press the "x" in the top right corner */ PostQuitMessage (0); /* Send a message to quit */
break; default: return DefWindowProc (hwnd, message, wParam, lParam); }
return 0;
} | | | | |
K f*** the numbers on the side I'm tryna learn Win32, so it's hellahard
|
Fri Mar 13, 2009 4:32 pm |
|
|
SS
Joined: Sat Aug 16, 2008 8:38 am Posts: 6670 Location: Darkest Antartica Country:
Gender: Male
Skype: Thaiberium
Currently Playing: The Game
|
Win32... Is there like another name for it? Well I'll look it up later. It seems like its for UI programming or some such. The following is code for an OpenGL program. Try it out. To run it, you need the OpenGL libraries though. | | | | Code: #include <GL/glut.h> #include <math.h> #include <stdlib.h> #include <time.h>
static float angle=0.0,ratio, angle2; static float x=0.0f,y=1.75f,z=5.0f; static float lx=0.0f,ly=0.0f,lz=-1.0f; static GLint snowman_display_list; static float mbx,mby,mbz; float ang=0; float Rmin=0.3; float Rmax=2.5; float t=0.0; float inc=0.00005;
void changeSize(int w, int h){ if(h == 0){ h = 1; } ratio = 1.0f * w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(45,ratio,1,1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(x, y, z, x + lx,y + ly,z + lz,0.0f,1.0f,0.0f); }
void Time_Delay(int dur) { clock_t start_time; start_time = clock(); while((clock() - start_time) < dur ){ } }
void drawSnowMan() { glColor3f(1.0f, 1.0f, 1.0f); glTranslatef(0.0f ,0.75f, 0.0f); glutSolidSphere(0.75f,20,20); glTranslatef(0.0f, 1.0f, 0.0f); glutSolidSphere(0.25f,20,20); glPushMatrix(); glColor3f(0.0f,0.0f,0.0f); glTranslatef(0.05f, 0.10f, 0.18f); glutSolidSphere(0.05f,10,10); glTranslatef(-0.1f, 0.0f, 0.0f); glutSolidSphere(0.05f,10,10); glPopMatrix(); glColor3f(1.0f, 0.5f , 0.5f); glRotatef(0.0f,1.0f, 0.0f, 0.0f); glutSolidCone(0.08f,0.5f,10,2); }
void Draw_Magic_Ball(void){ float R; R=Rmin*(1-t)+Rmax*t; glPushMatrix(); glColor3f(0,0,1); glRotatef(ang,0,1,0); glTranslatef(-2,1,0); glutWireSphere(R,50,50); glPopMatrix(); ang+=0.01; t+=inc; if (t>=1){ inc=-inc; } if (t<=0){ inc=-inc; } }
GLuint createDL() { GLuint snowManDL; snowManDL = glGenLists(1); glNewList(snowManDL,GL_COMPILE); drawSnowMan(); glEndList(); return(snowManDL); }
void initScene() { glEnable(GL_DEPTH_TEST); snowman_display_list = createDL(); }
void renderScene (void){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(0.9f,0.9f,0.9f); glBegin(GL_QUADS); glVertex3f(-100.0f,0.0f,-100.0f); glVertex3f(-100.0f,0.0f,100.0f); glVertex3f(100.0f,0.0f,100.0f); glVertex3f(100.0f,0.0f,-100.0f); glEnd(); for (int i = -3; i<3; i++) for (int j=-3;j<3;j++){ glPushMatrix(); glTranslatef(i*10.0,0,j*10.0); glCallList(snowman_display_list); glPopMatrix(); } Draw_Magic_Ball(); glutSwapBuffers();
} void orientMe(float ang) { lx = sin(ang); lz = -cos(ang); glLoadIdentity(); gluLookAt(x, y, z, x + lx,y + ly,z + lz, 0.0f,1.0f,0.0f); }
void moveMeFlat(int i) { x = x + i*(lx)*0.1; z = z + i*(lz)*0.1; glLoadIdentity(); gluLookAt(x, y, z, x + lx, y + ly, z + lz, 0.0f,1.0f,0.0f); }
void inputKey(int key, int x, int y) { switch (key) { case GLUT_KEY_LEFT:angle -= 0.01;orientMe(angle); break; case GLUT_KEY_RIGHT:angle +=0.01;orientMe(angle); break; case GLUT_KEY_UP:moveMeFlat(1); break; case GLUT_KEY_DOWN:moveMeFlat(-1); break; } }
void main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(640,360); glutCreateWindow("SnowMen from Lighthouse 3D"); initScene(); glutSpecialFunc(inputKey); glutDisplayFunc(renderScene); glutIdleFunc(renderScene); glutReshapeFunc(changeSize); glutMainLoop(); } | | | | |
|
Sat Mar 14, 2009 8:59 am |
|
|
Captain Mew
Joined: Mon Aug 11, 2008 6:40 am Posts: 1648 Location: ... Not America
|
wow, OpenGL looks kinda... complicated. Let me try it in C#, since I'm switching to that since Win32/MFC is a load of crap Or, maybe Direct 3D is better for making 2D/3D games. Looky here, OpenGl vs. Direct3D http://en.wikipedia.org/wiki/Comparison ... d_Direct3D
|
Sat Mar 14, 2009 3:29 pm |
|
|
SS
Joined: Sat Aug 16, 2008 8:38 am Posts: 6670 Location: Darkest Antartica Country:
Gender: Male
Skype: Thaiberium
Currently Playing: The Game
|
Nice find. Note, when compiling and running, you need to have the OpenGL libraries. I cannot stress that enough.
OpenGL is pretty powerful but it seems so system intensive. That and it has a rather difficult structure. That last example was a simple first person viewer of a field full of snowmen.
If I were to make a game right now however, I'd still be using Java.
|
Sat Mar 14, 2009 5:24 pm |
|
|
Original Unbastard
Joined: Sun Aug 17, 2008 5:39 pm Posts: 1248
Gender: Anime Girl
Skype: Nacritico
Currently Playing: LOL
|
If you ask me, I would say that the best system to use now-adays for game coding is flash... But this is not because flash itself is a good lenguage, even when I think is a good lenguage. In fact, it's some great limitations: forbidding the usage of user's local files, everything should be stored into the file (making the organization more complicated), saving things outside a specific place, the bad use of the CPU's RAM, etc. The reason why I say this, is because the wide and easy distribution of flash material. No mather what kind of game you do, or even if it's kind of boring... as long as it's above the abridge flash game (which is pretty crappy), then a lot of people will play it. People will have an easy and fast way of finding it (newgrounds) and will no be afraid of downloading something with virusus. And if create a 'somehow' good game, you have your chance of becoming greatly popular. An example of this is our forum administrator Cleod, who created a pretty crappy game (no offense Greg, but the first version of Super Smash Flash sucked big time), and yet he is pretty known in the internet.
_________________SALU2'S ™ _________________ join date: January 08, 2007 Posts on old MG: 2432, level 16 nà chóu
|
Sat Mar 14, 2009 7:37 pm |
|
|
Captain Mew
Joined: Mon Aug 11, 2008 6:40 am Posts: 1648 Location: ... Not America
|
If I do say so myself, Actionscript isn't the complete best thing to use for game making. I highly prefer C++ or C# not just that a lot of people made game making SDK's for it, ex. XNA or Dark GDK, but the normal coding process itself can make wicked games, even better than some Flash games out there.
And I do agree with you Nac, Super Smash X is even better than SSF1
|
Sat Mar 14, 2009 8:17 pm |
|
|
Original Unbastard
Joined: Sun Aug 17, 2008 5:39 pm Posts: 1248
Gender: Anime Girl
Skype: Nacritico
Currently Playing: LOL
|
What I was trying to say was that, even when AS might be a little bit lammer than other lenguages, it's one of the most popular and easy to distribute "game lenguages". So, unless you are doing real professional coding (A.K.A producing a game for console), I highly suggest you to program your games in AS.
_________________SALU2'S ™ _________________ join date: January 08, 2007 Posts on old MG: 2432, level 16 nà chóu
|
Sat Mar 14, 2009 9:19 pm |
|
|
necrolium
Joined: Wed Nov 12, 2008 9:23 pm Posts: 124 Location: Charlotte, NC
Gender: Male
|
Here is a sample of programming in Game Maker: | | | | Code: var blue, aqua, green, yellow, text;//This calls the variables to the next action blue = c_blue;//This sets the variable blue to the color blue aqua = c_aqua;//This sets the variable aqua to the color aqua green = c_green;//This sets the variable green to the color green yellow = c_yellow;//This sets the variable yellow to the color yellow text = "Hello"//This will make the variable text to show a text if keyboard_check_pressed(vk_space){//This is if you press space then perform the next action draw_color_text(x,y,text,blue,aqua,green,yellow,1); | | | | |
Game Maker Language is nowhere near as good and complex as C and C++ and c# and Delphi and Java, you get the point, but it is a great programming language for those who wants to begin at game making and it is capable to produce complex/advanced and great quality games.
_________________Game Maker Awesomenessness http://www.youtube.com/watch?v=11DylA2AuJI
|
Sat Mar 14, 2009 11:06 pm |
|
|
Original Unbastard
Joined: Sun Aug 17, 2008 5:39 pm Posts: 1248
Gender: Anime Girl
Skype: Nacritico
Currently Playing: LOL
|
| | | | necrolium wrote: Here is a sample of programming in Game Maker: | | | | Code: var blue, aqua, green, yellow, text;//This calls the variables to the next action blue = c_blue;//This sets the variable blue to the color blue aqua = c_aqua;//This sets the variable aqua to the color aqua green = c_green;//This sets the variable green to the color green yellow = c_yellow;//This sets the variable yellow to the color yellow text = "Hello"//This will make the variable text to show a text if keyboard_check_pressed(vk_space){//This is if you press space then perform the next action draw_color_text(x,y,text,blue,aqua,green,yellow,1); | | | | |
Game Maker Language is nowhere near as good and complex as C and C++ and c# and Delphi and Java, you get the point, but it is a great programming language for those who wants to begin at game making and it is capable to produce complex/advanced and great quality games. | | | | |
Well, that's it's porpouse... but I trully believe that it's not good for creating advance and complex games. You CAN create them, but it's a waste of energy and time.
_________________SALU2'S ™ _________________ join date: January 08, 2007 Posts on old MG: 2432, level 16 nà chóu
|
Sun Mar 15, 2009 8:55 am |
|
|
necrolium
Joined: Wed Nov 12, 2008 9:23 pm Posts: 124 Location: Charlotte, NC
Gender: Male
|
Can you show me a sample of walking to the right in c++ by pressing the right arrow key?
_________________Game Maker Awesomenessness http://www.youtube.com/watch?v=11DylA2AuJI
|
Sun Mar 15, 2009 9:18 am |
|
|
Captain Mew
Joined: Mon Aug 11, 2008 6:40 am Posts: 1648 Location: ... Not America
|
I'll try, I can call myself a whiz in C++ Picturebox is the image This also works with C#, but replace :: and -> with . EDIT: You think we should make some sort of Coding help guide thread in the Coder's Paradise. Like GameMaker FAQ and help, but with language's like C++, Java, etc.
|
Sun Mar 15, 2009 2:01 pm |
|
|
necrolium
Joined: Wed Nov 12, 2008 9:23 pm Posts: 124 Location: Charlotte, NC
Gender: Male
|
That's complicated. This is how you do that in game maker: You should make a FAQ for c++. I should help sirtopeia with his FAQ too.
_________________Game Maker Awesomenessness http://www.youtube.com/watch?v=11DylA2AuJI
|
Sun Mar 15, 2009 3:19 pm |
|
|
SS
Joined: Sat Aug 16, 2008 8:38 am Posts: 6670 Location: Darkest Antartica Country:
Gender: Male
Skype: Thaiberium
Currently Playing: The Game
|
The thing about Flash is that it was not originally meant for gaming. Neither was Java but I digress. If you're talking about embedding games in a webpage, Java is just as good as flash. That's the least amount of HTML you need to implement Java in a webpage. As for event driven programs, Java uses listeners, so I guess it could be a bit more complicated that in GameMaker.
|
Sun Mar 15, 2009 3:39 pm |
|
|
Captain Mew
Joined: Mon Aug 11, 2008 6:40 am Posts: 1648 Location: ... Not America
|
The C++ is actually shorter and easier than the GML one
|
Sun Mar 15, 2009 8:33 pm |
|
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|