• 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.

war3cadu12

Members
  • Content count

    19
  • Joined

  • Last visited

Community Reputation

110 Neutral

About war3cadu12

  • Rank
    Member
  1. Well, I have been working on it. Other problem is that I can't make textbox input in Chinese or Japaese, any idea? (All font are working.)
  2. Well. it works for now Thank you for help, +1 rep.
  3. Like that: [source lang="csharp"]spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);[/source] or just [source lang="csharp"]spriteBatch.Begin(SpriteSortMode.Texture, BlendState.NonPremultiplied);[/source] Let me know if that is correct?
  4. I was trying make a font system, and I can't fix anti-aliasing, unicode is working. [img]http://i47.tinypic.com/rqwtmq.png[/img] Here is my code: [source lang="csharp"]protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.CornflowerBlue); Font font = new Font("Arial Unicode MS", 32, FontStyle.Bold, GraphicsUnit.Pixel); Bitmap bitmap = new Bitmap(500, 500, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bitmap); g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; g.DrawString("anti aliasing, ????", font, new SolidBrush(System.Drawing.Color.White), 0, 0, StringFormat.GenericDefault); bitmap.Save("buffer"); float offset = font.SizeInPoints / font.FontFamily.GetEmHeight(font.Style) * font.FontFamily.GetCellAscent(font.Style); Texture2D texture; using (FileStream fileStream = new FileStream("buffer", FileMode.Open)) { texture = Texture2D.FromStream(GraphicsDevice, fileStream); } spriteBatch.Begin(); spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height), Microsoft.Xna.Framework.Color.Black); spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(0, 50, texture.Width, texture.Height), Microsoft.Xna.Framework.Color.Red); spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(0, 100, texture.Width, texture.Height), Microsoft.Xna.Framework.Color.GreenYellow); spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(0, 150, texture.Width, texture.Height), Microsoft.Xna.Framework.Color.Green); spriteBatch.End(); base.Draw(gameTime); }[/source]
  5. Thanks for helping, it is working now, I tested my game for an hour. There is a bug in your alignment, it's an easy-to-fix bug. One more thing, can I add a setFont function?
  6. Here is code: [code]´bool drawText(int red, int green, int blue, int alpha, string text, string filenamefont, string align, int size, int x, int y) { SDLCFont = TTF_OpenFont(filenamefont.c_str(), size); if (!SDLCFont == NULL) { if (red > 255) { red = 255; } if (green > 255) { green = 255; } if (blue > 255) { blue = 255; } if (alpha > 255) { alpha = 255; } SDL_Color scolors; SDL_Rect offset; int width = 0; int height = 0; scolors.r = red; scolors.g = green; scolors.b = blue; if (TTF_SizeText(SDLCFont, text.c_str(), &width, &height) == 0) { if (align == "left") { offset.x = x-width; } else if (align == "center") { offset.x = x-width/2; } else if (align == "right") { offset.x = x; } offset.y = y; SDLMessages = TTF_RenderText_Blended( SDLCFont, text.c_str(), scolors ); //SDL_SetAlpha(SDLMessages, SDL_SRCALPHA, alpha); if ( SDL_BlitSurface(SDLMessages, NULL, SDLFunctionsScreenGame, &offset) ) { //SDL_Flip(SDLMessages); return true; } } } else { cout << "Error TTF: " << TTF_GetError() << endl; return false; } TTF_CloseFont(SDLCFont); return false; }[/code] when I got an error with the last code, I created my own class for it: cpp [code] #include "include.h" using namespace std; SDL_Surface *TTFScreenGame = NULL; void onTextStart(SDL_Surface* SceenGame) { TTFScreenGame = SceenGame; } Text::Text(string filename, int size) { TTF_Init(); ttffont = TTF_OpenFont(filename.c_str(), size); if (!filename.length() == 0 && size) { ifstream CheckFile(filename); if ( CheckFile.is_open() ) { ttffont = TTF_OpenFont(filename.c_str(), size); if (!ttffont == NULL) { cout << "Loaded TTF: \"" << filename << "\"" << endl; ttfloaded = true; } else { cout << "Error: " << TTF_GetError() << endl; ttfloaded = false; } CheckFile.close(); } else { cout << "Error: Can't find \"" << filename << "\" file." << endl; ttfloaded = false; } } else { cout << "Error: You did not enter filename and/or size" << endl; ttfloaded = false; } } Text::~Text() { delete ttffont; delete messages; ttffont = NULL; messages = NULL; TTF_CloseFont(ttffont); SDL_FreeSurface(messages); } void Text::Render(int red, int green, int blue, int alpha, string text, string align, int size, int x, int y) { if (ttfloaded == false) { return; } if (red > 255) { red = 255; } if (green > 255) { green = 255; } if (blue > 255) { blue = 255; } if (alpha > 255) { alpha = 255; } SDL_Color scolors; SDL_Rect offset; int width = 0; int height = 0; scolors.r = red; scolors.g = green; scolors.b = blue; if (TTF_SizeText(ttffont, text.c_str(), &width, &height) == 0) { if (align == "left") { offset.x = x-width; } else if (align == "center") { offset.x = x-width/2; } else if (align == "right") { offset.x = x; } offset.y = y; messages = TTF_RenderText_Blended(ttffont, text.c_str(), scolors ); SDL_SetAlpha(Messages, SDL_SRCALPHA, alpha); SDL_BlitSurface(messages, NULL, TTFScreenGame, &offset); } } int Text::GetFontWidth(string text) { int width = 0; int height = 0; if (TTF_SizeText(ttffont, text.c_str(), &width, &height) == 0) { return width; } return 0; } [/code] h [code]#ifndef TEXT_H #define TEXT_H #include "include.h" using namespace std; void onTextStart(SDL_Surface* SDLTTFScreeGame); class Text { private: SDL_Surface *messages; TTF_Font *ttffont; bool ttfloaded; public: Text(string, int); ~Text(); void Render(int, int, int, int, string, string, int, int, int); int GetFontWidth(string); }; #endif[/code]
  7. Thanks you for helping me. I have another problem here, could you help me? The thing is that when I draw a text, after something like 4 min the text just disappears. It's really weird. Any ideas?
  8. I'm trying to make an insert input so you can type your nickname. I made a box to limit the number of characters but the problem is that you can type unlimitedly and the box won't stop you. I want as soon as the character reach the end of the box I won't let the user type more or push the last characters back, like it would be normally in other games. I hope you understand me [img]http://public.gamedev.net/public/style_emoticons/default/smile.gif[/img] [img]http://i43.tinypic.com/34qkc4o.jpg[/img]
  9. Anyone? I have to use SDL 1.3?
  10. One more, I have problem with SDL_SetColors and SDL_Palette, Let dont me set colors the images....
  11. I am deaf, and Im not good speaking and/or question. One more, I mean that If mouse is clicked in textbox(in up) was working, but not textbox2(in down). I was fixing gui for 2 hours, still doesn't work. "Why is guix and guisizex pointers to dynamic memory?" Becuase I was testing this, it still bugged. Edit: I forget I did not write "textbox->Events(evets);" Sorry guys! ... Im dumb
  12. I mean if mouse is clicked in textbox [img]http://i39.tinypic.com/242byxg.png[/img] Edit: Uhu Mouse doesnt show... >.>
  13. I was adding my own gui textbox using classes, when I clicked the textbox, it says false Edit: Fixed, Im dumb
  14. Bump. I need it working 100% any keys.
  15. Thanks[color="#B57438"][b] YogurtEmperor[color="#000000"].[/color][/b][/color] One more, Is there fix for "¹²³£¢¬" ? Sorry for the stupid questions again. Edit: Again is there no "é è ã â ê ê `` ´´" ;(