示例

欢迎浏览Wt的一些在线示例。

这些示例的源代码均包含在Wt的源代码发行包中。你可以通过每个示例下的 源代码浏览器查看。

示例源代码也以交叉链接的形式出现在 Wt示例doxygen文档中(自动开启新窗口)。

Hangman

Run example

This example implements a simple well-known game, including a user ranking system, which is persisted to a database using Wt::Dbo.

Some of the things illustrated in this example:

  • Different approaches to layout: using an HTML template, a layout manager, or by compositing basic widgets and CSS.
  • Using hidden content to optimize the user experience by preloading contents, used in this game to preload the various images used to show the hanging man.
  • Navigation is implemented using WAnchor which reference an internal path. Action is taken by reacting to internal path changes.
  • The example uses the authentication module (Wt::Auth) to authenticate users using a username/password, or using Google's beta OAuth 2.0 service.
  • A database which contains user information is accessed and updated using Wt::Dbo.
查看源代码