• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
fir

winapi console trouble

7 posts in this topic

Some time ago I was trying move my winapi framework code to external static lib (you could call it flib) so I could use it as an api  which i could run from simple c environment like

 

 
void init_firs_framework();
void draw_frame_here();
 
 
void draw_frame_here()
{
  //....
}
 
void main()
{
  init_firs_framework();
}
 

 

but there appear some trouble. I am using winapi to setup my window

and want to use my flib as an only api avaliable to my main program -

the trouble is that compiling 'console' program such as my main program

 here makes an ugle blue console to appear, I do not need such sh*t here,

I also do not want to use WinMain instead of main() in my main program 

I just need to write c main program which will rely on my own flib api

not involving both c console on WinMain() environment - I was searching

abit but not found how to compile windows program which will not 

involve making console or winapi but come kind of raw compilation for

my own lib.

 

 

 

0

Share this post


Link to post
Share on other sites

All programs executed in the Windows console subsystem automatically have a console window created. That's simply part of how Windows works. However, depending on your compiler and linker you may be able to specify main() as the entry point for a program that uses the Windows subsystem. How you go about it would depend on your tool chain.

0

Share this post


Link to post
Share on other sites

All programs executed in the Windows console subsystem automatically have a console window created. That's simply part of how Windows works. However, depending on your compiler and linker you may be able to specify main() as the entry point for a program that uses the Windows subsystem. How you go about it would depend on your tool chain.

 

As i said I do not want to use window subsystem and i do not want to use console subsystem I just want to wrote 'Raw' c code program, which will be linking staticaly to my own flib.obj (which is using winapi)

And this is stupid problem as i said, i run my program sudenly totally unnecessary console do apear (And i cannot switch tu windows subsystem becouse i do not need it to, I just need pure main and code linked to my own framework)

Edited by fir
0

Share this post


Link to post
Share on other sites


As i said I do not want to use window subsystem

Actually what you said is that you don't want to use WinMain(). Entry point is not synonymous with subsystem, and just because you use the Windows subsystem doesn't mean you need to use WinMain() as your entry point unless your tool chain requires it. Some tool chains will allow you to use main() as your entry point even if you use the Windows subsystem. Again, how you would go about that would depend on your tool chain. But yes, you do need to switch to a different subsystem if you don't want the console window to show up. The operating system creates the console window for any application run in the console subsystem. There's nothing application code can do to suppress that console window creation if you run in the console subsystem. And you have to run in one of the subsystems. Subsystem is specified as part of the PE executable header. If you don't have a valid subsystem entry then the OS won't know how to launch your program.

0

Share this post


Link to post
Share on other sites

 


As i said I do not want to use window subsystem

Actually what you said is that you don't want to use WinMain(). Entry point is not synonymous with subsystem, and just because you use the Windows subsystem doesn't mean you need to use WinMain() as your entry point unless your tool chain requires it. Some tool chains will allow you to use main() as your entry point even if you use the Windows subsystem. Again, how you would go about that would depend on your tool chain. But yes, you do need to switch to a different subsystem if you don't want the console window to show up. The operating system creates the console window for any application run in the console subsystem. There's nothing application code can do to suppress that console window creation if you run in the console subsystem. And you have to run in one of the subsystems. Subsystem is specified as part of the PE executable header. If you don't have a valid subsystem entry then the OS won't know how to launch your program.

 

 

I tell you why I say I do not want a window subsystem - I got my own library flib.obj where I got my own api for making small 2d games it calls winapi internally.

 

 I want to set up some easy environment for making games 

in the form of c program using only my own libraray as an api 

calls - no direct calls to winapi or any other thing just the simplicity





#include "flib.h"          // -> flib.obj
 
void main()
{
    // game here using only functions 
    // given to you by flib and nothing more
}

I do not want to force a user of flib to any efforts (setting subsystem to windows or something)

 I would like give him a lib, make him fire the c compiler, include header in standard c environment (preferebly would like if it would work with many compilers) and go (als I do not need, f**ing console) 

What you would do it? I got a trouble here - and i consider it as a some kind of 'system' bug that it is some trouble to make it this way

Edited by fir
0

Share this post


Link to post
Share on other sites

You can do what SDL does and have your library contain WinMain() and use a preprocessor definition in a header to #define main to something else that your WinMain() will call. SDL uses SDL_main. That will allow the user to use main() without manually setting the entry point. However, the user will still need to implicit or explicitly set the subsystem to Windows. For example, in MSVC by creating a new Windows application rather than console application. If the user creates a console application the application is going to get a console window and there's nothing you can do to prevent that.

0

Share this post


Link to post
Share on other sites

You can do what SDL does and have your library contain WinMain() and use a preprocessor definition in a header to #define main to something else that your WinMain() will call. SDL uses SDL_main. That will allow the user to use main() without manually setting the entry point. However, the user will still need to implicit or explicitly set the subsystem to Windows. For example, in MSVC by creating a new Windows application rather than console application. If the user creates a console application the application is going to get a console window and there's nothing you can do to prevent that.

 

its sad i do not know what such windows subsystem code 

do - but maybe i can assume that it do about nothing

 

This all winmain seem to me to be an bad choice (design bug) in the windows system - some man do it bad 

 

the arguments that winmain carries should be IMo accesible

through some winapi call - to not breac clear c code program form :c

0

Share this post


Link to post
Share on other sites

The arguments are available via API calls. The HINSTANCE for the module can be found via GetModuleHandle(NULL), the command line via GetCommandLine(), nCmdShow can be found via GetStartupInfo() and checking the STARTF_USESHOWWINDOW bit of dwFlags. hPrevInstance is always NULL on any of the 32 or 64 bit versions of Windows.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0